From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Jan Beulich" Subject: [PATCH] x86/XSTATE: clarify XRSTOR() macro Date: Wed, 08 Jun 2016 06:50:56 -0600 Message-ID: <575830D002000078000F309E@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__PartD3E5D1A0.2__=" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bAcwp-0007A1-8B for xen-devel@lists.xenproject.org; Wed, 08 Jun 2016 12:51:03 +0000 List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: xen-devel Cc: Andrew Cooper , Shuai Ruan List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__PartD3E5D1A0.2__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 --- 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 |=3D ptr->xsave_hdr.xstate_bv | \ - XSTATE_COMPACTION_ENABLED; \ + { \ + ASSERT(!ptr->xsave_hdr.xcomp_bv); \ + ptr->xsave_hdr.xcomp_bv =3D ptr->xsave_hdr.xstate_bv | \ + XSTATE_COMPACTION_ENABLED; \ + } \ _xrstor(pfx "0x0f,0xc7,0x1f"); /* xrstors */ \ } \ else \ --=__PartD3E5D1A0.2__= Content-Type: text/plain; name="x86-XSAVES-clarify.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-XSAVES-clarify.patch" x86/XSTATE: clarify XRSTOR() macro=0A=0AMake obvious that xcomp_bv is = expected to be clear when we get here=0Awith XSTATE_COMPACTION_ENABLED not = set.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/arch/x86/xstate.c=0A+++ b/xen/arch/x86/xstate.c=0A@@ -387,8 +387,11 = @@ void xrstor(struct vcpu *v, uint64_t mas=0A { \=0A = if ( unlikely(!(ptr->xsave_hdr.xcomp_bv & \=0A = XSTATE_COMPACTION_ENABLED)) ) \=0A- ptr->xsave_hdr.xcomp_bv = |=3D ptr->xsave_hdr.xstate_bv | \=0A- = XSTATE_COMPACTION_ENABLED; \=0A+ { \=0A+ = ASSERT(!ptr->xsave_hdr.xcomp_bv); \=0A+ ptr->xsave_hdr.xcomp= _bv =3D ptr->xsave_hdr.xstate_bv | \=0A+ = XSTATE_COMPACTION_ENABLED; \=0A+ } \=0A = _xrstor(pfx "0x0f,0xc7,0x1f"); /* xrstors */ \=0A } \=0A = else \=0A --=__PartD3E5D1A0.2__= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwOi8vbGlzdHMueGVuLm9y Zy94ZW4tZGV2ZWwK --=__PartD3E5D1A0.2__=--