WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [Patch] Allowing PV-OPS kernel to detect whether XSAVE i

To: Haitao Shan <maillists.shan@xxxxxxxxx>
Subject: Re: [Xen-devel] [Patch] Allowing PV-OPS kernel to detect whether XSAVE is supported
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Tue, 9 Nov 2010 10:43:14 +0000
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <Keir.Fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 09 Nov 2010 02:43:48 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <AANLkTi=dR3b7N5xUa2E=gLnVFdVWYX=S0fXN-g8OaJtP@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: Citrix Systems, Inc.
References: <AANLkTi=dR3b7N5xUa2E=gLnVFdVWYX=S0fXN-g8OaJtP@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2010-11-09 at 06:22 +0000, Haitao Shan wrote:
> Hi, Jeremy,
> 
> This patch allows pv-ops kernel to detect whether XSAVE is supported
> (before masking it unconditionally through xen_cpuid).
> Can you please have review? Thanks!
> 
> Signed-off-by: Shan Haitao <haitao.shan@xxxxxxxxx>
> 
> Shan Haitao 
> 

> diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
> index fd3803e..03bfaf7 100644
> --- a/arch/x86/xen/enlighten.c
> +++ b/arch/x86/xen/enlighten.c
> @@ -252,6 +252,13 @@ static __init void xen_init_cpuid_mask(void)
>                           (1 << X86_FEATURE_MCA)  |  /* disable MCA */
>                           (1 << X86_FEATURE_APIC) |  /* disable local APIC */
>                           (1 << X86_FEATURE_ACPI));  /* disable ACPI */
> +       ax = 1;
> +       xen_cpuid(&ax, &bx, &cx, &dx);
> +
> +       /* Xen will set CR4.OSXSAVE if supported and not disabled by force */

For how long has the hypervisor had this behaviour? IIRC older
hypervisors did not correctly expose/mask the *XSAVE CPUID flags and
would causes PV guests to crash when they used *XSAVE features which
weren't actually available.

In other words have you confirmed that this patch does not break the
kernel running on older hypervisors such as Xen 4.0?


> +       if ( cx & (1 << (X86_FEATURE_XSAVE % 32)) &&
> +               cx & (1 << (X86_FEATURE_OSXSAVE % 32)) )
> +               return;
>  
>         cpuid_leaf1_ecx_mask &= ~(1 << (X86_FEATURE_XSAVE % 32)); /* disable 
> XSAVE */
>  } 


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel