Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2012 22:02:11 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@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: r230282 - in stable/8/sys: amd64/amd64 i386/i386 pc98/pc98
Message-ID:  <201201172202.q0HM2Bo5009300@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Tue Jan 17 22:02:11 2012
New Revision: 230282
URL: http://svn.freebsd.org/changeset/base/230282

Log:
  MFC r224516:
  
   Introduce a tunable to disable the time consuming parts of bootup
   memtesting, which can easily save seconds to minutes of boot time.
   The tunable name is kept general to allow reusing the code in
   alternate frameworks.

Modified:
  stable/8/sys/amd64/amd64/machdep.c
  stable/8/sys/i386/i386/machdep.c
  stable/8/sys/pc98/pc98/machdep.c
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/8/sys/amd64/amd64/machdep.c	Tue Jan 17 21:55:20 2012	(r230281)
+++ stable/8/sys/amd64/amd64/machdep.c	Tue Jan 17 22:02:11 2012	(r230282)
@@ -1288,7 +1288,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
 {
 	int i, physmap_idx, pa_indx, da_indx;
 	vm_paddr_t pa, physmap[PHYSMAP_SIZE];
-	u_long physmem_tunable;
+	u_long physmem_tunable, memtest, tmpul;
 	pt_entry_t *pte;
 	struct bios_smap *smapbase, *smap, *smapend;
 	u_int32_t smapsize;
@@ -1351,6 +1351,14 @@ getmemsize(caddr_t kmdp, u_int64_t first
 		Maxmem = atop(physmem_tunable);
 
 	/*
+	 * By default keep the memtest enabled.  Use a general name so that
+	 * one could eventually do more with the code than just disable it.
+	 */
+	memtest = 1;
+	if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
+		memtest = tmpul;
+
+	/*
 	 * Don't allow MAXMEM or hw.physmem to extend the amount of memory
 	 * in the system.
 	 */
@@ -1412,6 +1420,8 @@ getmemsize(caddr_t kmdp, u_int64_t first
 				goto do_dump_avail;
 
 			page_bad = FALSE;
+			if (memtest == 0)
+				goto skip_memtest;
 
 			/*
 			 * map page into kernel: valid, read/write,non-cacheable
@@ -1449,6 +1459,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
 			 */
 			*(int *)ptr = tmp;
 
+skip_memtest:
 			/*
 			 * Adjust array of valid/good pages.
 			 */

Modified: stable/8/sys/i386/i386/machdep.c
==============================================================================
--- stable/8/sys/i386/i386/machdep.c	Tue Jan 17 21:55:20 2012	(r230281)
+++ stable/8/sys/i386/i386/machdep.c	Tue Jan 17 22:02:11 2012	(r230282)
@@ -2094,7 +2094,7 @@ static void
 getmemsize(int first)
 {
 	int has_smap, off, physmap_idx, pa_indx, da_indx;
-	u_long physmem_tunable;
+	u_long physmem_tunable, memtest, tmpul;
 	vm_paddr_t physmap[PHYSMAP_SIZE];
 	pt_entry_t *pte;
 	quad_t dcons_addr, dcons_size;
@@ -2301,6 +2301,14 @@ physmap_done:
 	if (has_smap && Maxmem > atop(physmap[physmap_idx + 1]))
 		Maxmem = atop(physmap[physmap_idx + 1]);
 
+	/*
+	 * By default keep the memtest enabled.  Use a general name so that
+	 * one could eventually do more with the code than just disable it.
+	 */
+	memtest = 1;
+	if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
+		memtest = tmpul;
+
 	if (atop(physmap[physmap_idx + 1]) != Maxmem &&
 	    (boothowto & RB_VERBOSE))
 		printf("Physical memory use set to %ldK\n", Maxmem * 4);
@@ -2364,6 +2372,8 @@ physmap_done:
 				goto do_dump_avail;
 
 			page_bad = FALSE;
+			if (memtest == 0)
+				goto skip_memtest;
 
 			/*
 			 * map page into kernel: valid, read/write,non-cacheable
@@ -2401,6 +2411,7 @@ physmap_done:
 			 */
 			*(int *)ptr = tmp;
 
+skip_memtest:
 			/*
 			 * Adjust array of valid/good pages.
 			 */

Modified: stable/8/sys/pc98/pc98/machdep.c
==============================================================================
--- stable/8/sys/pc98/pc98/machdep.c	Tue Jan 17 21:55:20 2012	(r230281)
+++ stable/8/sys/pc98/pc98/machdep.c	Tue Jan 17 22:02:11 2012	(r230282)
@@ -1823,7 +1823,7 @@ static void
 getmemsize(int first)
 {
 	int off, physmap_idx, pa_indx, da_indx;
-	u_long physmem_tunable;
+	u_long physmem_tunable, memtest, tmpul;
 	vm_paddr_t physmap[PHYSMAP_SIZE];
 	pt_entry_t *pte;
 	quad_t dcons_addr, dcons_size;
@@ -1883,6 +1883,14 @@ getmemsize(int first)
 	if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable))
 		Maxmem = atop(physmem_tunable);
 
+	/*
+	 * By default keep the memtest enabled.  Use a general name so that
+	 * one could eventually do more with the code than just disable it.
+	 */
+	memtest = 1;
+	if (TUNABLE_ULONG_FETCH("hw.memtest.tests", &tmpul))
+		memtest = tmpul;
+
 	if (atop(physmap[physmap_idx + 1]) != Maxmem &&
 	    (boothowto & RB_VERBOSE))
 		printf("Physical memory use set to %ldK\n", Maxmem * 4);
@@ -1959,6 +1967,8 @@ getmemsize(int first)
 				goto do_dump_avail;
 
 			page_bad = FALSE;
+			if (memtest == 0)
+				goto skip_memtest;
 
 			/*
 			 * map page into kernel: valid, read/write,non-cacheable
@@ -1996,6 +2006,7 @@ getmemsize(int first)
 			 */
 			*(int *)ptr = tmp;
 
+skip_memtest:
 			/*
 			 * Adjust array of valid/good pages.
 			 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201172202.q0HM2Bo5009300>