Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jan 2012 13:52:05 +0000 (UTC)
From:      Gavin Atkinson <gavin@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r230266 - in stable/9/sys: amd64/amd64 i386/i386
Message-ID:  <201201171352.q0HDq5n2092953@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: gavin
Date: Tue Jan 17 13:52:04 2012
New Revision: 230266
URL: http://svn.freebsd.org/changeset/base/230266

Log:
  Merge r229085 from head:
  
    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.
  
  Early MFC requested by:	bz

Modified:
  stable/9/sys/amd64/amd64/machdep.c
  stable/9/sys/i386/i386/machdep.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/amd64/amd64/machdep.c
==============================================================================
--- stable/9/sys/amd64/amd64/machdep.c	Tue Jan 17 12:14:26 2012	(r230265)
+++ stable/9/sys/amd64/amd64/machdep.c	Tue Jan 17 13:52:04 2012	(r230266)
@@ -1372,10 +1372,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);
 
 	/*

Modified: stable/9/sys/i386/i386/machdep.c
==============================================================================
--- stable/9/sys/i386/i386/machdep.c	Tue Jan 17 12:14:26 2012	(r230265)
+++ stable/9/sys/i386/i386/machdep.c	Tue Jan 17 13:52:04 2012	(r230266)
@@ -2340,10 +2340,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 &&



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