diff mbox

x86/XSTATE: clarify XRSTOR() macro

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

Commit Message

Jan Beulich June 8, 2016, 12:50 p.m. UTC
Make obvious that xcomp_bv is expected to be clear when we get here
with XSTATE_COMPACTION_ENABLED not set.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
x86/XSTATE: clarify XRSTOR() macro

Make obvious that xcomp_bv is expected to be clear when we get here
with XSTATE_COMPACTION_ENABLED not set.

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

--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -387,8 +387,11 @@ void xrstor(struct vcpu *v, uint64_t mas
         { \
             if ( unlikely(!(ptr->xsave_hdr.xcomp_bv & \
                             XSTATE_COMPACTION_ENABLED)) ) \
-                ptr->xsave_hdr.xcomp_bv |= ptr->xsave_hdr.xstate_bv | \
-                                           XSTATE_COMPACTION_ENABLED; \
+            { \
+                ASSERT(!ptr->xsave_hdr.xcomp_bv); \
+                ptr->xsave_hdr.xcomp_bv = ptr->xsave_hdr.xstate_bv | \
+                                          XSTATE_COMPACTION_ENABLED; \
+            } \
             _xrstor(pfx "0x0f,0xc7,0x1f"); /* xrstors */ \
         } \
         else \

Comments

Andrew Cooper June 9, 2016, 12:03 p.m. UTC | #1
On 08/06/16 13:50, Jan Beulich wrote:
> Make obvious that xcomp_bv is expected to be clear when we get here
> with XSTATE_COMPACTION_ENABLED not set.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by Andrew Cooper <andrew.cooper3@citrix.com>
Shuai Ruan June 12, 2016, 1:26 a.m. UTC | #2
On Wed, Jun 08, 2016 at 06:50:56AM -0600, Jan Beulich wrote:
> Make obvious that xcomp_bv is expected to be clear when we get here
> with XSTATE_COMPACTION_ENABLED not set.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Shuai Ruan <shuai.ruan@linux.intel.com>
diff mbox

Patch

--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -387,8 +387,11 @@  void xrstor(struct vcpu *v, uint64_t mas
         { \
             if ( unlikely(!(ptr->xsave_hdr.xcomp_bv & \
                             XSTATE_COMPACTION_ENABLED)) ) \
-                ptr->xsave_hdr.xcomp_bv |= ptr->xsave_hdr.xstate_bv | \
-                                           XSTATE_COMPACTION_ENABLED; \
+            { \
+                ASSERT(!ptr->xsave_hdr.xcomp_bv); \
+                ptr->xsave_hdr.xcomp_bv = ptr->xsave_hdr.xstate_bv | \
+                                          XSTATE_COMPACTION_ENABLED; \
+            } \
             _xrstor(pfx "0x0f,0xc7,0x1f"); /* xrstors */ \
         } \
         else \