From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Haitao Shan <maillists.shan@gmail.com>
Cc: xen-devel@lists.xensource.com, Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: [Patch] Allowing PV-OPS kernel to detect whether XSAVE is supported
Date: Tue, 09 Nov 2010 11:55:39 -0800 [thread overview]
Message-ID: <4CD9A73B.2070909@goop.org> (raw)
In-Reply-To: <AANLkTi=dR3b7N5xUa2E=gLnVFdVWYX=S0fXN-g8OaJtP@mail.gmail.com>
On 11/08/2010 10:22 PM, 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@intel.com>
>
> Shan Haitao
>
For future reference:
Please post patches inline if possible.
If you must use an attachment to prevent your mail system from
corrupting the patch, please include a complete description of the patch
(what is it trying to do, how does it do it, what is the outcome?) with
signed-off-bys in the the patch itself.
> 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 */ + 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 */
I cleaned this up a bit (fixed formatting to Linux style, reversed the
sense of the if() and masked OSXSAVE as well, even though it won't make
a difference). But I'm still a bit concerned about the back-compat
issues around this.
What happens if the guest OS does not support XSAVE (older versions of
Linux)? Could usermode code see OSXSAVE set in the cpuid feature flags
and attempt to use XSAVE, even if XSAVE isn't set? In other words, can
usermode ever normally see OSXSAVE set, but XSAVE clear?
We can't mask OSXSAVE to usermode because they can run the naked CPUID
instruction, so I guess the only way to cause it to be cleared would be
to clear CR4.OSXSAVE? But that seems like a very expensive thing to do
on a vcpu context switch.
How much testing of real usermode code have you done with this? How
many combinations of XSAVE support in Xen, Linux and usermode have you
tried?
J
next prev parent reply other threads:[~2010-11-09 19:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-09 6:22 [Patch] Allowing PV-OPS kernel to detect whether XSAVE is supported Haitao Shan
2010-11-09 10:43 ` Ian Campbell
2010-11-09 10:51 ` Jan Beulich
2010-11-09 10:54 ` Ian Campbell
2010-11-09 11:26 ` Jan Beulich
2010-11-09 15:12 ` Haitao Shan
2010-11-09 19:55 ` Jeremy Fitzhardinge [this message]
2010-11-10 0:15 ` Haitao Shan
2010-11-10 0:18 ` Haitao Shan
2010-11-10 0:41 ` Jeremy Fitzhardinge
2010-11-10 1:45 ` Haitao Shan
2010-11-10 2:15 ` Jeremy Fitzhardinge
2010-11-19 18:17 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CD9A73B.2070909@goop.org \
--to=jeremy@goop.org \
--cc=keir.fraser@eu.citrix.com \
--cc=maillists.shan@gmail.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.