From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2 2/2] x86/xstate: also use alternative asm on xsave side Date: Wed, 3 Feb 2016 13:26:28 +0000 Message-ID: <56B20004.40303@citrix.com> References: <56B2016102000078000CE005@prv-mh.provo.novell.com> <56B2032902000078000CE03C@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aQxS4-0003kc-KG for xen-devel@lists.xenproject.org; Wed, 03 Feb 2016 13:26:32 +0000 In-Reply-To: <56B2032902000078000CE03C@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Keir Fraser , Shuai Ruan List-Id: xen-devel@lists.xenproject.org On 03/02/16 12:39, Jan Beulich wrote: > From: Shuai Ruan > > This patch use alternavtive asm on the xsave side. > As xsaves use modified optimization like xsaveopt, xsaves > may not writing the FPU portion of the save image too. > So xsaves also need some extra tweaks. > > Signed-off-by: Shuai Ruan > > Fix XSAVES opcode. Extend the other respective XSAVEOPT conditional to > cover XSAVES as well. Re-wrap comment being adjusted. > > Signed-off-by: Jan Beulich > > --- a/xen/arch/x86/xstate.c > +++ b/xen/arch/x86/xstate.c > @@ -250,27 +250,29 @@ void xsave(struct vcpu *v, uint64_t mask > uint32_t hmask = mask >> 32; > uint32_t lmask = mask; > int word_size = mask & XSTATE_FP ? (cpu_has_fpu_sel ? 8 : 0) : -1; > +#define XSAVE(pfx) \ > + alternative_io_3(".byte " pfx "0x0f,0xae,0x27\n", \ > + ".byte " pfx "0x0f,0xae,0x37\n", \ > + X86_FEATURE_XSAVEOPT, \ > + ".byte " pfx "0x0f,0xc7,0x27\n", \ > + X86_FEATURE_XSAVEC, \ > + ".byte " pfx "0x0f,0xc7,0x2f\n", \ > + X86_FEATURE_XSAVES, \ Given that the options are a little out of order and using raw bytes, would you mind annotating the lines with the operations. e.g. + alternative_io_3(".byte " pfx "0x0f,0xae,0x27\n", /* xsave */ \ + ".byte " pfx "0x0f,0xae,0x37\n", /* xsaveopt */ \ + X86_FEATURE_XSAVEOPT, \ + ".byte " pfx "0x0f,0xc7,0x27\n", /* xsavec */ \ + X86_FEATURE_XSAVEC, \ + ".byte " pfx "0x0f,0xc7,0x2f\n", /* xsaves */ \ + X86_FEATURE_XSAVES, \ IMO, this is somewhat clearer to read. Otherwise, Reviewed-by: Andrew Cooper