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:50:06 +0000 Message-ID: <56B2058E.9050808@citrix.com> References: <56B2016102000078000CE005@prv-mh.provo.novell.com> <56B2032902000078000CE03C@prv-mh.provo.novell.com> <56B20004.40303@citrix.com> <56B20FF002000078000CE149@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.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aQxox-0004xj-BC for xen-devel@lists.xenproject.org; Wed, 03 Feb 2016 13:50:11 +0000 In-Reply-To: <56B20FF002000078000CE149@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 Cc: xen-devel , Keir Fraser , Shuai Ruan List-Id: xen-devel@lists.xenproject.org On 03/02/16 13:34, Jan Beulich wrote: >>>> On 03.02.16 at 14:26, wrote: >> On 03/02/16 12:39, Jan Beulich wrote: >>> --- 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. > Okay, since I had been considering this too, I've just done so. > >> Otherwise, >> >> Reviewed-by: Andrew Cooper > Thanks, Jan On further thoughts, it would be nice to annotate the XRSTOR() side as well. ~Andrew