Date: Wed, 9 Mar 2011 12:14:49 +0000 (UTC) From: Sergey Kandaurov <pluknet@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r219425 - in stable/8/sys: amd64/amd64 vm Message-ID: <201103091214.p29CEnsA008505@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pluknet Date: Wed Mar 9 12:14:49 2011 New Revision: 219425 URL: http://svn.freebsd.org/changeset/base/219425 Log: MFC r202897,r208164,r212174: msgbufp mapping changes on amd64. r202897 by alc: Simplify the mapping of the system message buffer. Use the direct map just like ia64 does. r208164 by alc: Correct an error of omission in r202897: Now that amd64 uses the direct map to access the message buffer, we must explicitly request that the underlying physical pages are included in a crash dump. r212174 by avg: vm_page.c: include opt_msgbuf.h for MSGBUF_SIZE use in vm_page_startup Approved by: alc, kib (mentor), avg (mentor) Modified: stable/8/sys/amd64/amd64/machdep.c stable/8/sys/amd64/amd64/pmap.c stable/8/sys/vm/vm_page.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) Modified: stable/8/sys/amd64/amd64/machdep.c ============================================================================== --- stable/8/sys/amd64/amd64/machdep.c Wed Mar 9 07:43:51 2011 (r219424) +++ stable/8/sys/amd64/amd64/machdep.c Wed Mar 9 12:14:49 2011 (r219425) @@ -157,6 +157,8 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, extern vm_offset_t ksym_start, ksym_end; #endif +struct msgbuf *msgbufp; + /* Intel ICH registers */ #define ICH_PMBASE 0x400 #define ICH_SMI_EN ICH_PMBASE + 0x30 @@ -1288,7 +1290,7 @@ add_smap_entry(struct bios_smap *smap, v static void getmemsize(caddr_t kmdp, u_int64_t first) { - int i, off, physmap_idx, pa_indx, da_indx; + int i, physmap_idx, pa_indx, da_indx; vm_paddr_t pa, physmap[PHYSMAP_SIZE]; u_long physmem_tunable; pt_entry_t *pte; @@ -1521,9 +1523,7 @@ do_next: phys_avail[pa_indx] -= round_page(MSGBUF_SIZE); /* Map the message buffer. */ - for (off = 0; off < round_page(MSGBUF_SIZE); off += PAGE_SIZE) - pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + - off); + msgbufp = (struct msgbuf *)PHYS_TO_DMAP(phys_avail[pa_indx]); } u_int64_t Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Wed Mar 9 07:43:51 2011 (r219424) +++ stable/8/sys/amd64/amd64/pmap.c Wed Mar 9 12:14:49 2011 (r219425) @@ -105,7 +105,6 @@ __FBSDID("$FreeBSD$"); * and to when physical maps must be made correct. */ -#include "opt_msgbuf.h" #include "opt_pmap.h" #include "opt_vm.h" @@ -116,7 +115,6 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mman.h> -#include <sys/msgbuf.h> #include <sys/mutex.h> #include <sys/proc.h> #include <sys/sx.h> @@ -211,7 +209,6 @@ static int shpgperproc = PMAP_SHPGPERPRO */ pt_entry_t *CMAP1 = 0; caddr_t CADDR1 = 0; -struct msgbuf *msgbufp = 0; /* * Crashdump maps. @@ -578,11 +575,6 @@ pmap_bootstrap(vm_paddr_t *firstaddr) */ SYSMAP(caddr_t, unused, crashdumpmap, MAXDUMPPGS) - /* - * msgbufp is used to map the system message buffer. - */ - SYSMAP(struct msgbuf *, unused, msgbufp, atop(round_page(MSGBUF_SIZE))) - virtual_avail = va; *CMAP1 = 0; Modified: stable/8/sys/vm/vm_page.c ============================================================================== --- stable/8/sys/vm/vm_page.c Wed Mar 9 07:43:51 2011 (r219424) +++ stable/8/sys/vm/vm_page.c Wed Mar 9 12:14:49 2011 (r219425) @@ -100,6 +100,7 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_msgbuf.h" #include "opt_vm.h" #include <sys/param.h> @@ -108,6 +109,7 @@ __FBSDID("$FreeBSD$"); #include <sys/kernel.h> #include <sys/limits.h> #include <sys/malloc.h> +#include <sys/msgbuf.h> #include <sys/mutex.h> #include <sys/proc.h> #include <sys/sysctl.h> @@ -313,6 +315,19 @@ vm_page_startup(vm_offset_t vaddr) new_end + vm_page_dump_size, VM_PROT_READ | VM_PROT_WRITE); bzero((void *)vm_page_dump, vm_page_dump_size); #endif +#ifdef __amd64__ + /* + * Request that the physical pages underlying the message buffer be + * included in a crash dump. Since the message buffer is accessed + * through the direct map, they are not automatically included. + */ + pa = DMAP_TO_PHYS((vm_offset_t)msgbufp->msg_ptr); + last_pa = pa + round_page(MSGBUF_SIZE); + while (pa < last_pa) { + dump_add_page(pa); + pa += PAGE_SIZE; + } +#endif /* * Compute the number of pages of memory that will be available for * use (taking into account the overhead of a page structure per
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201103091214.p29CEnsA008505>