From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/6] x86/cpuid: Move all xstate leaf handling into guest_cpuid()
Date: Mon, 16 Jan 2017 17:07:54 +0000 [thread overview]
Message-ID: <fbd0e56d-146d-99e4-6faa-e0e17c1d4bf6@citrix.com> (raw)
In-Reply-To: <587D09D602000078001309E3@prv-mh.provo.novell.com>
On 16/01/17 16:58, Jan Beulich wrote:
>>>> On 16.01.17 at 12:40, <andrew.cooper3@citrix.com> wrote:
>> @@ -1007,10 +864,13 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
>> break;
>>
>> case XSTATE_CPUID:
>> - if ( subleaf > ARRAY_SIZE(p->xstate.raw) )
>> + if ( !p->basic.xsave || subleaf >= ARRAY_SIZE(p->xstate.raw) )
>> return;
>>
>> - /* Fallthrough. */
>> + BUG_ON(subleaf >= ARRAY_SIZE(p->xstate.raw));
> Kind of pointless considering the if() right above? With this removed
> (or the reason for it clarified)
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
It was for consistency with the other raw[] accesses, but given this
subleaf calculation, I can drop it.
>
>> @@ -1067,6 +927,31 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,
>> break;
>> }
>> break;
>> +
>> + case XSTATE_CPUID:
>> + switch ( subleaf )
>> + {
>> + case 1:
>> + if ( p->xstate.xsaves )
>> + {
>> + /*
>> + * TODO: Figure out what to do for XSS state. VT-x manages
>> + * host vs guest MSR_XSS automatically, so as soon as we start
>> + * supporting any XSS states, the wrong XSS will be in
>> + * context.
>> + */
>> + BUILD_BUG_ON(XSTATE_XSAVES_ONLY != 0);
> Yeah, I guess we won't have many options other than switching
> XSS around for the CPUID invocation.
The other option is to have a function which takes xcr0|xss and performs
some calculations with xstate_{offsets[],sizes[],align}, which might
plausibly be faster than switching MSR_XSS. Either way, this isn't a
problem I want to solve until I have a real piece of hardware using XSS
states to develop against.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-01-16 17:07 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-16 11:40 [PATCH 0/6] Further CPUID improvements Andrew Cooper
2017-01-16 11:40 ` [PATCH 1/6] x86/xstate: Fix array overrun on hardware with LWP Andrew Cooper
2017-01-16 16:26 ` Jan Beulich
2017-01-16 11:40 ` [PATCH 2/6] x86/cpuid: Introduce recalculate_xstate() Andrew Cooper
2017-01-16 16:45 ` Jan Beulich
2017-01-16 17:02 ` Andrew Cooper
2017-01-16 17:09 ` Jan Beulich
2017-01-17 11:27 ` [PATCH v2 " Andrew Cooper
2017-01-17 12:52 ` Jan Beulich
2017-01-17 15:15 ` Andrew Cooper
2017-01-17 15:28 ` Jan Beulich
2017-01-17 15:30 ` Andrew Cooper
2017-01-16 11:40 ` [PATCH 3/6] x86/cpuid: Move all xstate leaf handling into guest_cpuid() Andrew Cooper
2017-01-16 16:58 ` Jan Beulich
2017-01-16 17:07 ` Andrew Cooper [this message]
2017-01-16 11:40 ` [PATCH 4/6] tools/libxc: Remove xsave calculations from libxc Andrew Cooper
2017-01-16 11:44 ` Wei Liu
2017-01-16 11:40 ` [PATCH 5/6] x86/cpuid: Don't offer HVM hypervisor leaves to PV guests Andrew Cooper
2017-01-16 17:02 ` Jan Beulich
2017-01-17 11:01 ` Andrew Cooper
2017-01-16 11:40 ` [PATCH 6/6] x86/cpuid: Offer ITSC to domains which are automatically non-migrateable Andrew Cooper
2017-01-16 17:07 ` Jan Beulich
2017-01-16 17:26 ` Andrew Cooper
2017-01-17 9:00 ` Jan Beulich
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=fbd0e56d-146d-99e4-6faa-e0e17c1d4bf6@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).