From: "Jan Beulich" <JBeulich@suse.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCHv2 2/3] x86/fpu: Add a per-domain field to set the width of FIP/FDP
Date: Tue, 23 Feb 2016 09:39:06 -0700 [thread overview]
Message-ID: <56CC993A02000078000D5550@prv-mh.provo.novell.com> (raw)
In-Reply-To: <56CC885A.7080206@citrix.com>
>>> On 23.02.16 at 17:27, <david.vrabel@citrix.com> wrote:
> On 23/02/16 15:24, Jan Beulich wrote:
>>>>> On 23.02.16 at 12:05, <david.vrabel@citrix.com> wrote:
>>> @@ -292,17 +296,17 @@ void xsave(struct vcpu *v, uint64_t mask)
>>> asm volatile ( "fnstenv %0" : "=m" (fpu_env) );
>>> ptr->fpu_sse.fip.sel = fpu_env.fcs;
>>> ptr->fpu_sse.fdp.sel = fpu_env.fds;
>>> - word_size = 4;
>>> + fip_width = 4;
>>> }
>>> + else
>>> + fip_width = 8;
>>> }
>>> else
>>> {
>>> XSAVE("");
>>> - word_size = 4;
>>> }
>>> #undef XSAVE
>>> - if ( word_size >= 0 )
>>> - ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] = word_size;
>>> + ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] = fip_width;
>>> }
>>
>> There's actually a pre-existing bug here that I think should get
>> fixed at once: The 64-bit save path avoided to update
>> ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] when FPU state
>> didn't get saved (by setting word_size to -1), which continues to be
>> the case due to patch 1's changes. The 32-bit code path violated
>> this even before your change. I.e. the last else visible above
>> should get extended to return when !(mask & XSTATE_FP).
>
> XSTATE_FP is always set in the mask. (see fpu_xsave()).
fpu_xsave() sets the flag in XCR0, but not all values returned
from vcpu_xsave_mask() have that flag set (and hence the
"mask" parameter doesn't either).
Jan
next prev parent reply other threads:[~2016-02-23 16:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-23 11:05 [PATCHv2 0/3] x86: workaround inability to fully restore FPU state David Vrabel
2016-02-23 11:05 ` [PATCHv2 1/3] x86/fpu: improve check for XSAVE* not writing FIP/FDP fields David Vrabel
2016-02-23 11:18 ` Andrew Cooper
2016-02-23 11:54 ` David Vrabel
2016-02-23 14:07 ` Jan Beulich
2016-02-23 14:59 ` Jan Beulich
2016-02-23 17:42 ` David Vrabel
2016-02-24 7:51 ` Jan Beulich
2016-02-24 10:37 ` Tian, Kevin
2016-02-24 10:49 ` Jan Beulich
2016-03-18 18:23 ` Lai, Paul C
2016-02-23 11:05 ` [PATCHv2 2/3] x86/fpu: Add a per-domain field to set the width of FIP/FDP David Vrabel
2016-02-23 11:10 ` Andrew Cooper
2016-02-23 11:53 ` David Vrabel
2016-02-23 15:24 ` Jan Beulich
2016-02-23 16:27 ` David Vrabel
2016-02-23 16:39 ` Jan Beulich [this message]
2016-02-23 11:05 ` [PATCHv2 3/3] x86/hvm: add HVM_PARAM_X87_FIP_WIDTH David Vrabel
2016-02-23 11:20 ` Andrew Cooper
2016-02-24 11:51 ` Wei Liu
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=56CC993A02000078000D5550@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=david.vrabel@citrix.com \
--cc=xen-devel@lists.xenproject.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).