xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>, Shuai Ruan <shuai.ruan@linux.intel.com>
Subject: Re: [PATCH v2 2/2] x86/xstate: also use alternative asm on xsave side
Date: Wed, 3 Feb 2016 13:26:28 +0000	[thread overview]
Message-ID: <56B20004.40303@citrix.com> (raw)
In-Reply-To: <56B2032902000078000CE03C@prv-mh.provo.novell.com>

On 03/02/16 12:39, Jan Beulich wrote:
> From: Shuai Ruan <shuai.ruan@linux.intel.com>
>
> 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 <shuai.ruan@linux.intel.com>
>
> Fix XSAVES opcode. Extend the other respective XSAVEOPT conditional to
> cover XSAVES as well. Re-wrap comment being adjusted.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- 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 <andrew.cooper3@citrix.com>

  reply	other threads:[~2016-02-03 13:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 12:32 [PATCH v2 0/2] x86: also use alternative asm on xsave side Jan Beulich
2016-02-03 12:39 ` [PATCH v2 1/2] x86: support 2- and 3-way alternatives Jan Beulich
2016-02-03 13:15   ` Andrew Cooper
2016-02-03 13:24     ` Jan Beulich
2016-02-03 12:39 ` [PATCH v2 2/2] x86/xstate: also use alternative asm on xsave side Jan Beulich
2016-02-03 13:26   ` Andrew Cooper [this message]
2016-02-03 13:34     ` Jan Beulich
2016-02-03 13:50       ` Andrew Cooper
2016-02-04  5:27   ` 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=56B20004.40303@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir@xen.org \
    --cc=shuai.ruan@linux.intel.com \
    --cc=xen-devel@lists.xenproject.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).