Strange problem with 8-stable, VMWare vSphere 4 & AMD CPUs (unexpected shutdowns)

Alan Cox alc at cs.rice.edu
Tue Feb 23 17:30:06 UTC 2010


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

-------------- next part --------------
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 {						\


More information about the freebsd-stable mailing list