svn commit: r267964 - in stable: 10/sys/amd64/amd64 10/sys/i386/i386 10/sys/i386/include 10/sys/i386/xen 10/sys/pc98/pc98 9/sys/amd64/amd64 9/sys/i386/i386 9/sys/i386/include 9/sys/i386/xen 9/sys/p...

John Baldwin jhb at FreeBSD.org
Fri Jun 27 17:22:21 UTC 2014


Author: jhb
Date: Fri Jun 27 17:22:18 2014
New Revision: 267964
URL: http://svnweb.freebsd.org/changeset/base/267964

Log:
  MFC 261781:
  Don't waste a page of KVA for the boot-time memory test on x86.  For amd64,
  reuse the first page of the crashdumpmap as CMAP1/CADDR1.  For i386,
  remove CMAP1/CADDR1 entirely and reuse CMAP3/CADDR3 for the memory test.

Modified:
  stable/9/sys/amd64/amd64/pmap.c
  stable/9/sys/i386/i386/machdep.c
  stable/9/sys/i386/i386/pmap.c
  stable/9/sys/i386/include/pmap.h
  stable/9/sys/i386/xen/pmap.c
  stable/9/sys/pc98/pc98/machdep.c
Directory Properties:
  stable/9/sys/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/sys/amd64/amd64/pmap.c
  stable/10/sys/i386/i386/machdep.c
  stable/10/sys/i386/i386/pmap.c
  stable/10/sys/i386/include/pmap.h
  stable/10/sys/i386/xen/pmap.c
  stable/10/sys/pc98/pc98/machdep.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/9/sys/amd64/amd64/pmap.c
==============================================================================
--- stable/9/sys/amd64/amd64/pmap.c	Fri Jun 27 17:18:54 2014	(r267963)
+++ stable/9/sys/amd64/amd64/pmap.c	Fri Jun 27 17:22:18 2014	(r267964)
@@ -619,7 +619,7 @@ void
 pmap_bootstrap(vm_paddr_t *firstaddr)
 {
 	vm_offset_t va;
-	pt_entry_t *pte, *unused;
+	pt_entry_t *pte;
 
 	/*
 	 * Create an initial set of page tables to run the kernel in.
@@ -663,14 +663,11 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 	pte = vtopte(va);
 
 	/*
-	 * CMAP1 is only used for the memory test.
-	 */
-	SYSMAP(caddr_t, CMAP1, CADDR1, 1)
-
-	/*
-	 * Crashdump maps.
+	 * Crashdump maps.  The first page is reused as CMAP1 for the
+	 * memory test.
 	 */
-	SYSMAP(caddr_t, unused, crashdumpmap, MAXDUMPPGS)
+	SYSMAP(caddr_t, CMAP1, crashdumpmap, MAXDUMPPGS)
+	CADDR1 = crashdumpmap;
 
 	virtual_avail = va;
 

Modified: stable/9/sys/i386/i386/machdep.c
==============================================================================
--- stable/9/sys/i386/i386/machdep.c	Fri Jun 27 17:18:54 2014	(r267963)
+++ stable/9/sys/i386/i386/machdep.c	Fri Jun 27 17:22:18 2014	(r267964)
@@ -2363,7 +2363,7 @@ physmap_done:
 	phys_avail[pa_indx++] = physmap[0];
 	phys_avail[pa_indx] = physmap[0];
 	dump_avail[da_indx] = physmap[0];
-	pte = CMAP1;
+	pte = CMAP3;
 
 	/*
 	 * Get dcons buffer address
@@ -2385,7 +2385,7 @@ physmap_done:
 			end = trunc_page(physmap[i + 1]);
 		for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) {
 			int tmp, page_bad, full;
-			int *ptr = (int *)CADDR1;
+			int *ptr = (int *)CADDR3;
 
 			full = FALSE;
 			/*

Modified: stable/9/sys/i386/i386/pmap.c
==============================================================================
--- stable/9/sys/i386/i386/pmap.c	Fri Jun 27 17:18:54 2014	(r267963)
+++ stable/9/sys/i386/i386/pmap.c	Fri Jun 27 17:22:18 2014	(r267964)
@@ -271,11 +271,10 @@ struct sysmaps {
 	caddr_t	CADDR2;
 };
 static struct sysmaps sysmaps_pcpu[MAXCPU];
-pt_entry_t *CMAP1 = 0;
-static pt_entry_t *CMAP3;
+pt_entry_t *CMAP3;
 static pd_entry_t *KPTD;
-caddr_t CADDR1 = 0, ptvmmap = 0;
-static caddr_t CADDR3;
+caddr_t ptvmmap = 0;
+caddr_t CADDR3;
 struct msgbuf *msgbufp = 0;
 
 /*
@@ -450,7 +449,6 @@ pmap_bootstrap(vm_paddr_t firstaddr)
 		SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1)
 		SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1)
 	}
-	SYSMAP(caddr_t, CMAP1, CADDR1, 1)
 	SYSMAP(caddr_t, CMAP3, CADDR3, 1)
 
 	/*

Modified: stable/9/sys/i386/include/pmap.h
==============================================================================
--- stable/9/sys/i386/include/pmap.h	Fri Jun 27 17:18:54 2014	(r267963)
+++ stable/9/sys/i386/include/pmap.h	Fri Jun 27 17:22:18 2014	(r267964)
@@ -416,8 +416,8 @@ struct pv_chunk {
 
 #ifdef	_KERNEL
 
-extern caddr_t	CADDR1;
-extern pt_entry_t *CMAP1;
+extern caddr_t	CADDR3;
+extern pt_entry_t *CMAP3;
 extern vm_paddr_t phys_avail[];
 extern vm_paddr_t dump_avail[];
 extern int pseflag;

Modified: stable/9/sys/i386/xen/pmap.c
==============================================================================
--- stable/9/sys/i386/xen/pmap.c	Fri Jun 27 17:18:54 2014	(r267963)
+++ stable/9/sys/i386/xen/pmap.c	Fri Jun 27 17:22:18 2014	(r267964)
@@ -249,9 +249,9 @@ struct sysmaps {
 	caddr_t	CADDR2;
 };
 static struct sysmaps sysmaps_pcpu[MAXCPU];
-static pt_entry_t *CMAP3;
+pt_entry_t *CMAP3;
 caddr_t ptvmmap = 0;
-static caddr_t CADDR3;
+caddr_t CADDR3;
 struct msgbuf *msgbufp = 0;
 
 /*

Modified: stable/9/sys/pc98/pc98/machdep.c
==============================================================================
--- stable/9/sys/pc98/pc98/machdep.c	Fri Jun 27 17:18:54 2014	(r267963)
+++ stable/9/sys/pc98/pc98/machdep.c	Fri Jun 27 17:22:18 2014	(r267964)
@@ -1953,7 +1953,7 @@ getmemsize(int first)
 	phys_avail[pa_indx++] = physmap[0];
 	phys_avail[pa_indx] = physmap[0];
 	dump_avail[da_indx] = physmap[0];
-	pte = CMAP1;
+	pte = CMAP3;
 
 	/*
 	 * Get dcons buffer address
@@ -1974,7 +1974,7 @@ getmemsize(int first)
 			end = trunc_page(physmap[i + 1]);
 		for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) {
 			int tmp, page_bad, full;
-			int *ptr = (int *)CADDR1;
+			int *ptr = (int *)CADDR3;
 
 			full = FALSE;
 			/*


More information about the svn-src-all mailing list