Date: Tue, 2 Mar 2010 16:29:08 +0000 (UTC) From: Alan Cox <alc@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r204584 - in stable/8/sys: amd64/amd64 i386/i386 kern sys Message-ID: <201003021629.o22GT8eH080671@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: alc Date: Tue Mar 2 16:29:08 2010 New Revision: 204584 URL: http://svn.freebsd.org/changeset/base/204584 Log: MFC r204420 When running as a guest operating system, the FreeBSD kernel must assume that the virtual machine monitor has enabled machine check exceptions. Unfortunately, on AMD Family 10h processors the machine check hardware has a bug (Erratum 383) that can result in a false machine check exception when a superpage promotion occurs. Thus, I am disabling superpage promotion when the FreeBSD kernel is running as a guest operating system on an AMD Family 10h processor. Modified: stable/8/sys/amd64/amd64/pmap.c stable/8/sys/i386/i386/pmap.c stable/8/sys/kern/subr_param.c stable/8/sys/sys/systm.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/ (props changed) Modified: stable/8/sys/amd64/amd64/pmap.c ============================================================================== --- stable/8/sys/amd64/amd64/pmap.c Tue Mar 2 16:25:07 2010 (r204583) +++ stable/8/sys/amd64/amd64/pmap.c Tue Mar 2 16:29:08 2010 (r204584) @@ -654,6 +654,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); Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Tue Mar 2 16:25:07 2010 (r204583) +++ stable/8/sys/i386/i386/pmap.c Tue Mar 2 16:29:08 2010 (r204584) @@ -678,6 +678,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); Modified: stable/8/sys/kern/subr_param.c ============================================================================== --- stable/8/sys/kern/subr_param.c Tue Mar 2 16:25:07 2010 (r204583) +++ stable/8/sys/kern/subr_param.c Tue Mar 2 16:29:08 2010 (r204584) @@ -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; @@ -137,6 +133,10 @@ SYSCTL_PROC(_kern, OID_AUTO, vm_guest, C */ struct buf *swbuf; +/* + * The elements of this array are ordered based upon the values of the + * corresponding enum VM_GUEST members. + */ static const char *const vm_guest_sysctl_names[] = { "none", "generic", Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Tue Mar 2 16:25:07 2010 (r204583) +++ stable/8/sys/sys/systm.h Tue Mar 2 16:29:08 2010 (r204584) @@ -65,6 +65,9 @@ extern int bootverbose; /* nonzero to p extern int maxusers; /* system tune hint */ extern int ngroups_max; /* max # of supplemental groups */ +extern int vm_guest; /* Running as virtual machine guest? */ + +enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN }; #ifdef INVARIANTS /* The option is always available */ #define KASSERT(exp,msg) do { \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201003021629.o22GT8eH080671>