From patchwork Mon Sep 17 15:37:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Bader X-Patchwork-Id: 184471 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id A26212C0086 for ; Tue, 18 Sep 2012 01:37:41 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TDdM9-0007yy-JC; Mon, 17 Sep 2012 15:35:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1TDdM7-0007yf-Np for kernel-team@lists.ubuntu.com; Mon, 17 Sep 2012 15:35:27 +0000 Received: from p5b2e1d5e.dip.t-dialin.net ([91.46.29.94] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1TDdO3-0001sz-G4 for kernel-team@lists.ubuntu.com; Mon, 17 Sep 2012 15:37:27 +0000 From: Stefan Bader To: kernel-team@lists.ubuntu.com Subject: [Quantal] Revert/drop EC2 workaround for XSAVe Date: Mon, 17 Sep 2012 17:37:26 +0200 Message-Id: <1347896246-10780-1-git-send-email-stefan.bader@canonical.com> X-Mailer: git-send-email 1.7.9.5 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com When submitting this to upstream, the following discussion turned up that newer kernels would not forcfully set the bit in CR4 to test for the XSAVE feature but rely on the cpuid bits passed by the HV. And testing done by Amazon said they will be fine with that. (There was a patch mentioned that would mask off the cpuid bits from guest but I have not linked that to a specific Xen version. But the hopes is that EC2 does at least use a version that will do that. And even if they do, they said they don't need it and we get rid of yet another deviation). Probably we want to drop that in Precise, too. It could allow guest to use xsave if the HV allows. For Lucid we would need it still or backport the change in Xen code that replaces the test for xsave capabilities. -Stefan From 289da65880d0001ecb3a771039642872ae146b18 Mon Sep 17 00:00:00 2001 From: Stefan Bader Date: Mon, 17 Sep 2012 17:27:46 +0200 Subject: [PATCH] Revert "UBUNTU: SAUCE: Mask CR4 writes on older Xen hypervisors" This reverts commit d0ffa571dbcf13787baa52a31bc7b7025749d4b4 as it seems unnecessary. Signed-off-by: Stefan Bader --- arch/x86/xen/enlighten.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 108d943..ff962d4 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -196,18 +196,6 @@ void xen_vcpu_restore(void) } } -/* - * Older (with no clear statement about what old means) Xen hypervisors - * will crash a PV guest that tries to store OSXSAVE into CR4. - * To prevent this, we force the feature bits related to this off in the - * xen cpuid call. This inline function serves as a centralized test - * on whether the quirk should be done. - */ -static inline needs_xsave_quirk(unsigned version) -{ - return (xen_pv_domain() && ((version >> 16) < 4)) ? 1 : 0; -} - static void __init xen_banner(void) { unsigned version = HYPERVISOR_xen_version(XENVER_version, NULL); @@ -219,8 +207,6 @@ static void __init xen_banner(void) printk(KERN_INFO "Xen version: %d.%d%s%s\n", version >> 16, version & 0xffff, extra.extraversion, xen_feature(XENFEAT_mmu_pt_update_preserve_ad) ? " (preserve-AD)" : ""); - if (needs_xsave_quirk(version)) - printk(KERN_INFO "Forcing xsave off due to Xen version.\n"); } #define CPUID_THERM_POWER_LEAF 6 @@ -351,7 +337,6 @@ static bool __init xen_check_mwait(void) } static void __init xen_init_cpuid_mask(void) { - unsigned version = HYPERVISOR_xen_version(XENVER_version, NULL); unsigned int ax, bx, cx, dx; unsigned int xsave_mask; @@ -374,7 +359,7 @@ static void __init xen_init_cpuid_mask(void) (1 << (X86_FEATURE_OSXSAVE % 32)); /* Xen will set CR4.OSXSAVE if supported and not disabled by force */ - if (((cx & xsave_mask) != xsave_mask) || needs_xsave_quirk(version)) + if ((cx & xsave_mask) != xsave_mask) cpuid_leaf1_ecx_mask &= ~xsave_mask; /* disable XSAVE & OSXSAVE */ if (xen_check_mwait()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT % 32));