xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Shuai Ruan <shuai.ruan@linux.intel.com>
Subject: [PATCH] x86/XSTATE: clarify XRSTOR() macro
Date: Wed, 08 Jun 2016 06:50:56 -0600	[thread overview]
Message-ID: <575830D002000078000F309E@prv-mh.provo.novell.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

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 \




[-- Attachment #2: x86-XSAVES-clarify.patch --]
[-- Type: text/plain, Size: 931 bytes --]

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 \

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2016-06-08 12:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 12:50 Jan Beulich [this message]
2016-06-09 12:03 ` Andrew Cooper
2016-06-12  1:26 ` Shuai Ruan

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=575830D002000078000F309E@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=shuai.ruan@linux.intel.com \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [PATCH] x86/XSTATE: clarify XRSTOR() macro' \
    /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

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).