svn commit: r230283 - in stable/7/sys: amd64/amd64 i386/i386
pc98/pc98
Bjoern A. Zeeb
bz at FreeBSD.org
Tue Jan 17 22:02:31 UTC 2012
Author: bz
Date: Tue Jan 17 22:02:30 2012
New Revision: 230283
URL: http://svn.freebsd.org/changeset/base/230283
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/7/sys/amd64/amd64/machdep.c
stable/7/sys/i386/i386/machdep.c
stable/7/sys/pc98/pc98/machdep.c
Directory Properties:
stable/7/sys/ (props changed)
Modified: stable/7/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/7/sys/amd64/amd64/machdep.c Tue Jan 17 22:02:11 2012 (r230282)
+++ stable/7/sys/amd64/amd64/machdep.c Tue Jan 17 22:02:30 2012 (r230283)
@@ -956,7 +956,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
{
int i, off, 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;
@@ -1019,6 +1019,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.
*/
@@ -1080,6 +1088,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
@@ -1117,6 +1127,7 @@ getmemsize(caddr_t kmdp, u_int64_t first
*/
*(int *)ptr = tmp;
+skip_memtest:
/*
* Adjust array of valid/good pages.
*/
Modified: stable/7/sys/i386/i386/machdep.c
==============================================================================
--- stable/7/sys/i386/i386/machdep.c Tue Jan 17 22:02:11 2012 (r230282)
+++ stable/7/sys/i386/i386/machdep.c Tue Jan 17 22:02:30 2012 (r230283)
@@ -1809,7 +1809,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;
@@ -2005,6 +2005,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);
@@ -2067,6 +2075,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
@@ -2104,6 +2114,7 @@ physmap_done:
*/
*(int *)ptr = tmp;
+skip_memtest:
/*
* Adjust array of valid/good pages.
*/
Modified: stable/7/sys/pc98/pc98/machdep.c
==============================================================================
--- stable/7/sys/pc98/pc98/machdep.c Tue Jan 17 22:02:11 2012 (r230282)
+++ stable/7/sys/pc98/pc98/machdep.c Tue Jan 17 22:02:30 2012 (r230283)
@@ -1697,7 +1697,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;
@@ -1757,6 +1757,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);
@@ -1833,6 +1841,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
@@ -1870,6 +1880,7 @@ getmemsize(int first)
*/
*(int *)ptr = tmp;
+skip_memtest:
/*
* Adjust array of valid/good pages.
*/
More information about the svn-src-stable-7
mailing list