xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xen.org>,
	Shuai Ruan <shuai.ruan@linux.intel.com>
Subject: Re: [PATCH] xen/x86: Record xsave features in c->x86_capabilities
Date: Mon, 21 Sep 2015 14:51:51 +0100	[thread overview]
Message-ID: <56000B77.4080903@citrix.com> (raw)
In-Reply-To: <56001C7302000078000A3FD4@prv-mh.provo.novell.com>

On 21/09/15 14:04, Jan Beulich wrote:
>>>> On 17.09.15 at 13:40, <andrew.cooper3@citrix.com> wrote:
>> Jan: I have opted for adding leaf 8 rather than reusing leaf 2, due to the
>> uncertainty with how this information is exposed in libxl.  This patch
>> introduces no change with how the information is represented in userspace.
> Mind explaining this "uncertainty"? I'd like to avoid extending the array
> for no real reason...

libxl exports "hw_caps" as uint32_t caps[8] in its API.

I am uncertain what reusing word 2, or extending the length of the array 
means WRT to the API/ABI guarantees of libxl.

For hw_caps itself, the data is essentially useless as there is no 
defined layout,  Furthermore, some of the leaves are 
arbitrary/synthetic.  One option might be to just drop it from libxl 
entirely, but this will need to be decided by the toolstack maintainers.

For my cpuid levelling series, there is a new set exported which has an 
ABI guarantee of which words map to which cpuid feature leaves, and a 
strict rule of no synthetic values.

>
>> @@ -325,20 +321,15 @@ void xstate_init(bool_t bsp)
>>   
>>       /* Check extended XSAVE features. */
>>       cpuid_count(XSTATE_CPUID, 1, &eax, &ebx, &ecx, &edx);
>> -    if ( bsp )
>> -    {
>> -        cpu_has_xsaveopt = !!(eax & XSTATE_FEATURE_XSAVEOPT);
>> -        cpu_has_xsavec = !!(eax & XSTATE_FEATURE_XSAVEC);
>> -        /* XXX cpu_has_xgetbv1 = !!(eax & XSTATE_FEATURE_XGETBV1); */
>> -        /* XXX cpu_has_xsaves = !!(eax & XSTATE_FEATURE_XSAVES); */
>> -    }
>> -    else
>> -    {
>> -        BUG_ON(!cpu_has_xsaveopt != !(eax & XSTATE_FEATURE_XSAVEOPT));
>> -        BUG_ON(!cpu_has_xsavec != !(eax & XSTATE_FEATURE_XSAVEC));
>> -        /* XXX BUG_ON(!cpu_has_xgetbv1 != !(eax & XSTATE_FEATURE_XGETBV1)); */
>> -        /* XXX BUG_ON(!cpu_has_xsaves != !(eax & XSTATE_FEATURE_XSAVES)); */
>> -    }
>> +
>> +    /* Mask out features not currently understood by Xen. */
>> +    eax &= (cpufeat_mask(X86_FEATURE_XSAVEOPT) |
>> +            cpufeat_mask(X86_FEATURE_XSAVEC));
>> +
>> +    c->x86_capability[X86_FEATURE_XSAVEOPT / 32] = eax;
>> +
>> +    if ( !bsp )
>> +        BUG_ON(eax != boot_cpu_data.x86_capability[X86_FEATURE_XSAVEOPT / 32]);
>>   }
> The !bsp conditional seems pretty pointless. And with the revised
> model it looks like it could be relaxed (BUG only when bits the BSP
> has set aren't set on the AP).

I would be very wary about allowing a situation where certain amounts of 
heterogeneity would be permitted.  Even moreso with the xsaves 
extensions, any non-homogeneity in the system will result in data 
corruption.

I think it is better to keep this as strictly that the BSP must match 
all APs.  As soon as we encounter a system where this is not the case, 
far more areas will also need modifying.

~Andrew

  reply	other threads:[~2015-09-21 13:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 11:40 [PATCH] xen/x86: Record xsave features in c->x86_capabilities Andrew Cooper
2015-09-21 13:04 ` Jan Beulich
2015-09-21 13:51   ` Andrew Cooper [this message]
2015-09-21 14:00     ` Jan Beulich
2015-09-21 14:09       ` Andrew Cooper
2015-09-21 14:18         ` 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=56000B77.4080903@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=shuai.ruan@linux.intel.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).