[xen stable-4.8] x86: correctly set nonlazy_xstate_used when loading full state

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.8] x86: correctly set nonlazy_xstate_used when loading full state

patchbot
commit f5ef10dd01934c53e26e81757e256f571f99a236
Author:     Jan Beulich <[hidden email]>
AuthorDate: Mon Jul 30 12:03:28 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Mon Jul 30 12:03:28 2018 +0200

    x86: correctly set nonlazy_xstate_used when loading full state
   
    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 <[hidden email]>
    Reviewed-by: Wei Liu <[hidden email]>
    Acked-by: Andrew Cooper <[hidden email]>
    master commit: f46bf0e101ca63118b9db2616e8f51e972d7f563
    master date: 2018-07-09 10:51:02 +0200
---
 xen/arch/x86/domctl.c  | 3 +--
 xen/arch/x86/hvm/hvm.c | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index ad5d20bc5a..391cc1b41f 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1201,8 +1201,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);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3686faba74..ee56ffcb6e 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1411,8 +1411,7 @@ static int hvm_load_cpu_xsave_states(struct domain *d, hvm_domain_context_t *h)
 
     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));
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.8

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog