summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgavin <gavin@FreeBSD.org>2011-12-31 13:24:53 +0000
committergavin <gavin@FreeBSD.org>2011-12-31 13:24:53 +0000
commit596f1a19e7c884be2c86e55f6c0053453c04acc7 (patch)
tree4f17b0ac7c625d0acb40828c9f7d3db8cf21a6cc
parent21c9c8f9bc530abe04f437b584b590b8ad325671 (diff)
downloadFreeBSD-src-596f1a19e7c884be2c86e55f6c0053453c04acc7.zip
FreeBSD-src-596f1a19e7c884be2c86e55f6c0053453c04acc7.tar.gz
Default to not performing the early-boot memory tests when we detect we
are booting inside a VM. There are three reasons to disable this: o It causes the VM host to believe that all the tested pages or RAM are in use. This in turn may force the host to page out pages of RAM belonging to other VMs, or otherwise cause problems with fair resource sharing on the VM cluster. o It adds significant time to the boot process (around 1 second/Gig in testing) o It is unnecessary - the host should have already verified that the memory is functional etc. Note that this simply changes the default when in a VM - it can still be overridden using the hw.memtest.tests tunable. MFC after: 4 weeks
-rw-r--r--sys/amd64/amd64/machdep.c7
-rw-r--r--sys/i386/i386/machdep.c7
2 files changed, 10 insertions, 4 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index fab3111..e9d160f 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1401,10 +1401,13 @@ getmemsize(caddr_t kmdp, u_int64_t first)
Maxmem = atop(physmem_tunable);
/*
- * By default keep the memtest enabled. Use a general name so that
+ * By default enable the memory test on real hardware, and disable
+ * it if we appear to be running in a VM. This avoids touching all
+ * pages unnecessarily, which doesn't matter on real hardware but is
+ * bad for shared VM hosts. Use a general name so that
* one could eventually do more with the code than just disable it.
*/
- memtest = 1;
+ memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
/*
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index c7352d9..e481e22 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2369,10 +2369,13 @@ physmap_done:
Maxmem = atop(physmap[physmap_idx + 1]);
/*
- * By default keep the memtest enabled. Use a general name so that
+ * By default enable the memory test on real hardware, and disable
+ * it if we appear to be running in a VM. This avoids touching all
+ * pages unnecessarily, which doesn't matter on real hardware but is
+ * bad for shared VM hosts. Use a general name so that
* one could eventually do more with the code than just disable it.
*/
- memtest = 1;
+ memtest = (vm_guest > VM_GUEST_NO) ? 0 : 1;
TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest);
if (atop(physmap[physmap_idx + 1]) != Maxmem &&
OpenPOWER on IntegriCloud