[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#592428: Fix 2.6.32 XEN guest on old buggy RHEL5/EC2 hypervisor (XSAVE)



 On 08/11/2010 08:17 AM, Ian Campbell wrote:
On Wed, 2010-08-11 at 07:55 -0700, Jeremy Fitzhardinge wrote:
It's not clear that xsave could ever be usable by PV guests, even in
principle, so its probably all completely over-engineered.  If setting
X86_CR4_OSXSAVE is problematic, then simply adding it to the list of
things we mask out of cpuid is probably the best fix.
Agreed and I think on that basis we should take the proposed patch into
the Debian kernel.


This should work:

From: Jeremy Fitzhardinge<jeremy.fitzhardinge@citrix.com>
Date: Wed, 11 Aug 2010 08:44:01 -0700
Subject: [PATCH] xen: just completely disable XSAVE

Some (old) versions of Xen just kill the domain if it tries to set any
unknown bits in CR4, so we can't reliably probe for OSXSAVE in
CR4.

Since Xen doesn't support XSAVE for guests at the moment, and no such
support is being worked on, there's no downside in just unconditionally
masking XSAVE support.

Signed-off-by: Jeremy Fitzhardinge<jeremy.fitzhardinge@citrix.com>

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 65d8d79..5292fa5 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -227,23 +227,7 @@ static __init void xen_init_cpuid_mask(void)
 			~((1<<  X86_FEATURE_APIC) |  /* disable local APIC */
 			  (1<<  X86_FEATURE_ACPI));  /* disable ACPI */

-	ax = 1;
-	cx = 0;
-	xen_cpuid(&ax,&bx,&cx,&dx);
-
-	/* cpuid claims we support xsave; try enabling it to see what happens */
-	if (cx&  (1<<  (X86_FEATURE_XSAVE % 32))) {
-		unsigned long cr4;
-
-		set_in_cr4(X86_CR4_OSXSAVE);
-		
-		cr4 = read_cr4();
-
-		if ((cr4&  X86_CR4_OSXSAVE) == 0)
-			cpuid_leaf1_ecx_mask&= ~(1<<  (X86_FEATURE_XSAVE % 32));
-
-		clear_in_cr4(X86_CR4_OSXSAVE);
-	}
+	cpuid_leaf1_ecx_mask&= ~(1<<  (X86_FEATURE_XSAVE % 32)); /* disable XSAVE */
 }

 static void xen_set_debugreg(int reg, unsigned long val)





Reply to: