diff options
author | bz <bz@FreeBSD.org> | 2011-07-30 13:33:05 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2011-07-30 13:33:05 +0000 |
commit | 632886e187f7c724771cd4b4466d84230884ef60 (patch) | |
tree | c521c8297086642bc7d44fc59a0ae93642781762 | |
parent | 0a42bdeef711863b01cc5efca5a8665af3e93f4c (diff) | |
download | FreeBSD-src-632886e187f7c724771cd4b4466d84230884ef60.zip FreeBSD-src-632886e187f7c724771cd4b4466d84230884ef60.tar.gz |
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.
Requested by: many
Discussed on: arch (a while a go)
Obtained from: Sandvine Incorporated
Reviewed by: sbruno
Approved by: re (kib)
MFC after: 2 weeks
-rw-r--r-- | sys/amd64/amd64/machdep.c | 13 | ||||
-rw-r--r-- | sys/i386/i386/machdep.c | 13 | ||||
-rw-r--r-- | sys/pc98/pc98/machdep.c | 13 |
3 files changed, 36 insertions, 3 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index f90ad03..00aa472 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -1309,7 +1309,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; @@ -1372,6 +1372,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. */ @@ -1433,6 +1441,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 @@ -1470,6 +1480,7 @@ getmemsize(caddr_t kmdp, u_int64_t first) */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 91050c4..73e7551 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -2132,7 +2132,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; @@ -2339,6 +2339,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); @@ -2402,6 +2410,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 @@ -2439,6 +2449,7 @@ physmap_done: */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 8bcb618..22131a6 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -1855,7 +1855,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; @@ -1915,6 +1915,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); @@ -1991,6 +1999,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 @@ -2028,6 +2038,7 @@ getmemsize(int first) */ *(int *)ptr = tmp; +skip_memtest: /* * Adjust array of valid/good pages. */ |