amd64/186061: FreeBSD 10 crashes as KVM guest on GNU/Linux on AMD family 10h CPUs

Alan Cox alc at rice.edu
Sat Feb 15 18:20:01 UTC 2014


The following reply was made to PR amd64/186061; it has been noted by GNATS.

From: Alan Cox <alc at rice.edu>
To: bug-followup at FreeBSD.org, simon.matter at invoca.ch
Cc:  
Subject: Re: amd64/186061: FreeBSD 10 crashes as KVM guest on GNU/Linux on
 AMD family 10h CPUs
Date: Sat, 15 Feb 2014 12:09:58 -0600

 This is a multi-part message in MIME format.
 --------------080509080501070706030501
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 Can you please verify that the attached patch addresses the problem for
 you?  Aside from addressing the crash, the objective of this patch is
 avoid enabling the workaround for perpetuity on all past Intel and
 future AMD/Intel cores on account of one broken AMD core.  The systems
 that I've seen for VM migration look at the reported processor feature
 sets and only migrate among machines with like feature sets.  So, if the
 feature set includes at least one feature that is not supported by AMD
 Family 10h or earlier AMD cores, then we shouldn't need to enable the
 workaround.
 
 
 --------------080509080501070706030501
 Content-Type: text/plain; charset=ISO-8859-15;
  name="PR186061v2.patch"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
  filename="PR186061v2.patch"
 
 Index: amd64/amd64/pmap.c
 ===================================================================
 --- amd64/amd64/pmap.c	(revision 261162)
 +++ amd64/amd64/pmap.c	(working copy)
 @@ -1008,12 +1008,18 @@ pmap_init(void)
  	}
  
  	/*
 -	 * If the kernel is running in a virtual machine on an AMD Family 10h
 -	 * processor, then it must assume that MCA is enabled by the virtual
 -	 * machine monitor.
 +	 * If the kernel is running on a virtual machine, then it must assume
 +	 * that MCA is enabled by the hypervisor.  Moreover, the kernel must
 +	 * be prepared for the hypervisor changing the vendor and family that
 +	 * are reported by CPUID.  Consequently, the workaround for AMD Family
 +	 * 10h Erratum 383 is enabled if the processor's feature set does not
 +	 * include at least one feature that is only supported by older Intel
 +	 * or newer AMD processors.
  	 */
 -	if (vm_guest == VM_GUEST_VM && cpu_vendor_id == CPU_VENDOR_AMD &&
 -	    CPUID_TO_FAMILY(cpu_id) == 0x10)
 +	if (vm_guest == VM_GUEST_VM && (cpu_feature & CPUID_SS) == 0 &&
 +	    (cpu_feature2 & (CPUID2_SSSE3 | CPUID2_SSE41 | CPUID2_AESNI |
 +	    CPUID2_AVX | CPUID2_XSAVE)) == 0 && (amd_feature2 & (AMDID2_XOP |
 +	    AMDID2_FMA4)) == 0)
  		workaround_erratum383 = 1;
  
  	/*
 Index: i386/i386/pmap.c
 ===================================================================
 --- i386/i386/pmap.c	(revision 261162)
 +++ i386/i386/pmap.c	(working copy)
 @@ -752,12 +752,18 @@ pmap_init(void)
  	pv_entry_high_water = 9 * (pv_entry_max / 10);
  
  	/*
 -	 * If the kernel is running in a virtual machine on an AMD Family 10h
 -	 * processor, then it must assume that MCA is enabled by the virtual
 -	 * machine monitor.
 +	 * If the kernel is running on a virtual machine, then it must assume
 +	 * that MCA is enabled by the hypervisor.  Moreover, the kernel must
 +	 * be prepared for the hypervisor changing the vendor and family that
 +	 * are reported by CPUID.  Consequently, the workaround for AMD Family
 +	 * 10h Erratum 383 is enabled if the processor's feature set does not
 +	 * include at least one feature that is only supported by older Intel
 +	 * or newer AMD processors.
  	 */
 -	if (vm_guest == VM_GUEST_VM && cpu_vendor_id == CPU_VENDOR_AMD &&
 -	    CPUID_TO_FAMILY(cpu_id) == 0x10)
 +	if (vm_guest == VM_GUEST_VM && (cpu_feature & CPUID_SS) == 0 &&
 +	    (cpu_feature2 & (CPUID2_SSSE3 | CPUID2_SSE41 | CPUID2_AESNI |
 +	    CPUID2_AVX | CPUID2_XSAVE)) == 0 && (amd_feature2 & (AMDID2_XOP |
 +	    AMDID2_FMA4)) == 0)
  		workaround_erratum383 = 1;
  
  	/*
 
 --------------080509080501070706030501--


More information about the freebsd-amd64 mailing list