Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Feb 2010 11:29:55 -0600
From:      Alan Cox <alc@cs.rice.edu>
To:        freebsd-stable@freebsd.org
Cc:        alc@freebsd.org, Andriy Gapon <avg@icyb.net.ua>, Jeremy Chadwick <freebsd@jdc.parodius.com>, Ivan Voras <ivoras@freebsd.org>
Subject:   Re: Strange problem with 8-stable, VMWare vSphere 4 & AMD CPUs  (unexpected shutdowns)
Message-ID:  <4B841093.2000402@cs.rice.edu>
In-Reply-To: <4B744EB2.3070108@cs.rice.edu>
References:  <hkujop$hsa$1@ger.gmane.org> <4B72D94A.8030509@icyb.net.ua>	<hkup1g$763$1@ger.gmane.org> <4B72E93C.80102@icyb.net.ua>	<9bbcef731002101003r203f5189xf139700a0d48afa0@mail.gmail.com>	<4B72F67F.4000209@icyb.net.ua>	<9bbcef731002101026k5007075cqf97fc80404ac3fa7@mail.gmail.com>	<4B72FC55.2090508@icyb.net.ua>	<9bbcef731002101038r1ac04141t505216816489376f@mail.gmail.com>	<20100210184623.GA78851@icarus.home.lan> <ca3526251002102037j21b11a7an572f397a9ae1eda0@mail.gmail.com> <4B741B7D.1030306@icyb.net.ua> <4B744EB2.3070108@cs.rice.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000801090609000506030801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Alan Cox wrote:
> The next public revision guide from AMD will contain an errata (383) 
> that documents the bug.  However, it doesn't really tell us anything 
> that we didn't already know.

Could someone on this list please test the attached patch in an amd64 
FreeBSD 8 guest running on vSphere 4 with an AMD Family 10h processor 
underneath?  Before testing the patch, remove the manual setting of 
vm.pmap.pg_ps_enabled="0" from /boot/loader.conf.  After booting the 
virtual machine, please run "sysctl vm.pmap.pg_ps_enabled" to verify 
that superpage promotion has been automatically disabled.

Thanks,
Alan


--------------000801090609000506030801
Content-Type: text/plain;
 name="vm_guest.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="vm_guest.patch"

Index: amd64/amd64/pmap.c
===================================================================
--- amd64/amd64/pmap.c	(revision 204175)
+++ amd64/amd64/pmap.c	(working copy)
@@ -686,6 +686,15 @@ pmap_init(void)
 	pv_entry_high_water = 9 * (pv_entry_max / 10);
 
 	/*
+	 * Disable large page mappings by default if the kernel is running in
+	 * a virtual machine on an AMD Family 10h processor.  This is a work-
+	 * around for Erratum 383.
+	 */
+	if (vm_guest == VM_GUEST_VM && cpu_vendor_id == CPU_VENDOR_AMD &&
+	    CPUID_TO_FAMILY(cpu_id) == 0x10)
+		pg_ps_enabled = 0;
+
+	/*
 	 * Are large page mappings enabled?
 	 */
 	TUNABLE_INT_FETCH("vm.pmap.pg_ps_enabled", &pg_ps_enabled);
Index: kern/subr_param.c
===================================================================
--- kern/subr_param.c	(revision 204175)
+++ kern/subr_param.c	(working copy)
@@ -74,10 +74,6 @@ __FBSDID("$FreeBSD$");
 #define	MAXFILES (maxproc * 2)
 #endif
 
-/* Values of enum VM_GUEST members are used as indices in 
- * vm_guest_sysctl_names */
-enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN };
-
 static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS);
 
 int	hz;
Index: sys/systm.h
===================================================================
--- sys/systm.h	(revision 204175)
+++ sys/systm.h	(working copy)
@@ -45,6 +45,10 @@
 #include <sys/queue.h>
 #include <sys/stdint.h>		/* for people using printf mainly */
 
+/* Values of enum VM_GUEST members are used as indices in 
+ * vm_guest_sysctl_names */
+enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN };
+
 extern int cold;		/* nonzero if we are doing a cold boot */
 extern int rebooting;		/* boot() has been called. */
 extern const char *panicstr;	/* panic message */
@@ -63,6 +67,7 @@ extern int bootverbose;		/* nonzero to print verbo
 
 extern int maxusers;		/* system tune hint */
 extern int ngroups_max;		/* max # of supplemental groups */
+extern int vm_guest;		/* Running as virtual machine guest? */
 
 #ifdef	INVARIANTS		/* The option is always available */
 #define	KASSERT(exp,msg) do {						\

--------------000801090609000506030801--



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