All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: correctly set nonlazy_xstate_used when loading full state
@ 2018-06-26  7:47 Jan Beulich
  2018-06-26  7:57 ` Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jan Beulich @ 2018-06-26  7:47 UTC (permalink / raw)
  To: xen-devel; +Cc: Andrew Cooper

In this case, just like xcr0_accum, nonlazy_xstate_used should always be
set to the intended new value, rather than possibly leaving the flag set
from a prior state load.

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

--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1187,8 +1187,7 @@ long arch_do_domctl(
                 vcpu_pause(v);
                 v->arch.xcr0 = _xcr0;
                 v->arch.xcr0_accum = _xcr0_accum;
-                if ( _xcr0_accum & XSTATE_NONLAZY )
-                    v->arch.nonlazy_xstate_used = 1;
+                v->arch.nonlazy_xstate_used = _xcr0_accum & XSTATE_NONLAZY;
                 compress_xsave_states(v, _xsave_area,
                                       evc->size - PV_XSAVE_HDR_SIZE);
                 vcpu_unpause(v);
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1324,8 +1324,7 @@ static int hvm_load_cpu_xsave_states(str
 
     v->arch.xcr0 = ctxt->xcr0;
     v->arch.xcr0_accum = ctxt->xcr0_accum;
-    if ( ctxt->xcr0_accum & XSTATE_NONLAZY )
-        v->arch.nonlazy_xstate_used = 1;
+    v->arch.nonlazy_xstate_used = ctxt->xcr0_accum & XSTATE_NONLAZY;
     compress_xsave_states(v, &ctxt->save_area,
                           size - offsetof(struct hvm_hw_cpu_xsave, save_area));
 




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: correctly set nonlazy_xstate_used when loading full state
  2018-06-26  7:47 [PATCH] x86: correctly set nonlazy_xstate_used when loading full state Jan Beulich
@ 2018-06-26  7:57 ` Wei Liu
  2018-06-26  8:11   ` Jan Beulich
  2018-07-06 10:26 ` Ping: " Jan Beulich
  2018-07-06 12:39 ` Andrew Cooper
  2 siblings, 1 reply; 6+ messages in thread
From: Wei Liu @ 2018-06-26  7:57 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Wei Liu, Andrew Cooper

On Tue, Jun 26, 2018 at 01:47:12AM -0600, Jan Beulich wrote:
> In this case, just like xcr0_accum, nonlazy_xstate_used should always be
> set to the intended new value, rather than possibly leaving the flag set
> from a prior state load.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Why? Looking at the code it is in fact used as a boolean.

Also you seem to have missed hvm/svm/svm.c and xstate.c?

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: correctly set nonlazy_xstate_used when loading full state
  2018-06-26  7:57 ` Wei Liu
@ 2018-06-26  8:11   ` Jan Beulich
  2018-06-26 11:23     ` Wei Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2018-06-26  8:11 UTC (permalink / raw)
  To: Wei Liu; +Cc: Andrew Cooper, xen-devel

>>> On 26.06.18 at 09:57, <wei.liu2@citrix.com> wrote:
> On Tue, Jun 26, 2018 at 01:47:12AM -0600, Jan Beulich wrote:
>> In this case, just like xcr0_accum, nonlazy_xstate_used should always be
>> set to the intended new value, rather than possibly leaving the flag set
>> from a prior state load.
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Why? Looking at the code it is in fact used as a boolean.

Its boolean nature is irrelevant. The question is whether fully new state
is loaded (in which case the flag should be set according to this state,
without regard to the prior value of the flag) vs ...

> Also you seem to have missed hvm/svm/svm.c and xstate.c?

... existing state being updated.

Jan



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: correctly set nonlazy_xstate_used when loading full state
  2018-06-26  8:11   ` Jan Beulich
@ 2018-06-26 11:23     ` Wei Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2018-06-26 11:23 UTC (permalink / raw)
  To: Jan Beulich; +Cc: Andrew Cooper, Wei Liu, xen-devel

On Tue, Jun 26, 2018 at 02:11:32AM -0600, Jan Beulich wrote:
> >>> On 26.06.18 at 09:57, <wei.liu2@citrix.com> wrote:
> > On Tue, Jun 26, 2018 at 01:47:12AM -0600, Jan Beulich wrote:
> >> In this case, just like xcr0_accum, nonlazy_xstate_used should always be
> >> set to the intended new value, rather than possibly leaving the flag set
> >> from a prior state load.
> >> 
> >> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> > 
> > Why? Looking at the code it is in fact used as a boolean.
> 
> Its boolean nature is irrelevant. The question is whether fully new state
> is loaded (in which case the flag should be set according to this state,
> without regard to the prior value of the flag) vs ...

I see. I misunderstood your intent.

Reviewed-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Ping: [PATCH] x86: correctly set nonlazy_xstate_used when loading full state
  2018-06-26  7:47 [PATCH] x86: correctly set nonlazy_xstate_used when loading full state Jan Beulich
  2018-06-26  7:57 ` Wei Liu
@ 2018-07-06 10:26 ` Jan Beulich
  2018-07-06 12:39 ` Andrew Cooper
  2 siblings, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2018-07-06 10:26 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: xen-devel

Ping?

>>> On 26.06.18 at 09:47, <JBeulich@suse.com> wrote:
> In this case, just like xcr0_accum, nonlazy_xstate_used should always be
> set to the intended new value, rather than possibly leaving the flag set
> from a prior state load.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -1187,8 +1187,7 @@ long arch_do_domctl(
>                  vcpu_pause(v);
>                  v->arch.xcr0 = _xcr0;
>                  v->arch.xcr0_accum = _xcr0_accum;
> -                if ( _xcr0_accum & XSTATE_NONLAZY )
> -                    v->arch.nonlazy_xstate_used = 1;
> +                v->arch.nonlazy_xstate_used = _xcr0_accum & XSTATE_NONLAZY;
>                  compress_xsave_states(v, _xsave_area,
>                                        evc->size - PV_XSAVE_HDR_SIZE);
>                  vcpu_unpause(v);
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -1324,8 +1324,7 @@ static int hvm_load_cpu_xsave_states(str
>  
>      v->arch.xcr0 = ctxt->xcr0;
>      v->arch.xcr0_accum = ctxt->xcr0_accum;
> -    if ( ctxt->xcr0_accum & XSTATE_NONLAZY )
> -        v->arch.nonlazy_xstate_used = 1;
> +    v->arch.nonlazy_xstate_used = ctxt->xcr0_accum & XSTATE_NONLAZY;
>      compress_xsave_states(v, &ctxt->save_area,
>                            size - offsetof(struct hvm_hw_cpu_xsave, save_area));
>  




_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] x86: correctly set nonlazy_xstate_used when loading full state
  2018-06-26  7:47 [PATCH] x86: correctly set nonlazy_xstate_used when loading full state Jan Beulich
  2018-06-26  7:57 ` Wei Liu
  2018-07-06 10:26 ` Ping: " Jan Beulich
@ 2018-07-06 12:39 ` Andrew Cooper
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Cooper @ 2018-07-06 12:39 UTC (permalink / raw)
  To: Jan Beulich, xen-devel

On 26/06/18 08:47, Jan Beulich wrote:
> In this case, just like xcr0_accum, nonlazy_xstate_used should always be
> set to the intended new value, rather than possibly leaving the flag set
> from a prior state load.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-06 12:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26  7:47 [PATCH] x86: correctly set nonlazy_xstate_used when loading full state Jan Beulich
2018-06-26  7:57 ` Wei Liu
2018-06-26  8:11   ` Jan Beulich
2018-06-26 11:23     ` Wei Liu
2018-07-06 10:26 ` Ping: " Jan Beulich
2018-07-06 12:39 ` Andrew Cooper

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.