diff mbox

x86/xstate: undo bogus adjustment to xsave()

Message ID 56E132B402000078000DB110@prv-mh.provo.novell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jan Beulich March 10, 2016, 7:39 a.m. UTC
This reverts an unintended change in commit 879b44b041 ("x86/fpu: add
a per-domain field to set the width of FIP/FDP"), which I had done
intermediately while fixing the build issue: After having reverted that
adjustment I must have forgotten to "git add" the adjustment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86/xstate: undo bogus adjustment to xsave()

This reverts an unintended change in commit 879b44b041 ("x86/fpu: add
a per-domain field to set the width of FIP/FDP"), which I had done
intermediately while fixing the build issue: After having reverted that
adjustment I must have forgotten to "git add" the adjustment.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -292,7 +292,7 @@ void xsave(struct vcpu *v, uint64_t mask)
 
         XSAVE("0x48,");
 
-        if ( !(ptr->xsave_hdr.xstate_bv & XSTATE_FP) ||
+        if ( !(mask & ptr->xsave_hdr.xstate_bv & XSTATE_FP) ||
              /*
               * AMD CPUs don't save/restore FDP/FIP/FOP unless an exception
               * is pending.

Comments

Andrew Cooper March 10, 2016, 12:04 p.m. UTC | #1
On 10/03/16 07:39, Jan Beulich wrote:
> This reverts an unintended change in commit 879b44b041 ("x86/fpu: add
> a per-domain field to set the width of FIP/FDP"), which I had done
> intermediately while fixing the build issue: After having reverted that
> adjustment I must have forgotten to "git add" the adjustment.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
David Vrabel March 10, 2016, 12:27 p.m. UTC | #2
On 10/03/16 07:39, Jan Beulich wrote:
> This reverts an unintended change in commit 879b44b041 ("x86/fpu: add
> a per-domain field to set the width of FIP/FDP"), which I had done
> intermediately while fixing the build issue: After having reverted that
> adjustment I must have forgotten to "git add" the adjustment.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

It think you also need to only clobber fip/fdp in memory if mask &
XSTATE_FP.

But, quite frankly, this logic too complicated and clearly too fragile
and you should just take the simplification I posted.

David

> 
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -292,7 +292,7 @@ void xsave(struct vcpu *v, uint64_t mask)
>  
>          XSAVE("0x48,");
>  
> -        if ( !(ptr->xsave_hdr.xstate_bv & XSTATE_FP) ||
> +        if ( !(mask & ptr->xsave_hdr.xstate_bv & XSTATE_FP) ||
>               /*
>                * AMD CPUs don't save/restore FDP/FIP/FOP unless an exception
>                * is pending.
> 
> 
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
>
Jan Beulich March 10, 2016, 1:16 p.m. UTC | #3
>>> On 10.03.16 at 13:27, <david.vrabel@citrix.com> wrote:
> On 10/03/16 07:39, Jan Beulich wrote:
>> This reverts an unintended change in commit 879b44b041 ("x86/fpu: add
>> a per-domain field to set the width of FIP/FDP"), which I had done
>> intermediately while fixing the build issue: After having reverted that
>> adjustment I must have forgotten to "git add" the adjustment.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> It think you also need to only clobber fip/fdp in memory if mask &
> XSTATE_FP.
> 
> But, quite frankly, this logic too complicated and clearly too fragile
> and you should just take the simplification I posted.

By all means I intend to once we've got confirmation from Intel.
I even did the re-basing already in preparation for that to happen.

Jan
diff mbox

Patch

--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -292,7 +292,7 @@  void xsave(struct vcpu *v, uint64_t mask)
 
         XSAVE("0x48,");
 
-        if ( !(ptr->xsave_hdr.xstate_bv & XSTATE_FP) ||
+        if ( !(mask & ptr->xsave_hdr.xstate_bv & XSTATE_FP) ||
              /*
               * AMD CPUs don't save/restore FDP/FIP/FOP unless an exception
               * is pending.