All of lore.kernel.org
 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] x86: properly macroize the two XRSTOR flavors
Date: Fri, 27 Nov 2015 13:49:52 +0000	[thread overview]
Message-ID: <56585F80.6050709@citrix.com> (raw)
In-Reply-To: <5658527602000078000B9AAE@prv-mh.provo.novell.com>

On 27/11/15 11:54, Jan Beulich wrote:
> All they differ by is the REX64 prefix. Create a single macro covering
> both, at once allowing to get rid of the disconnect between the current
> partial macro and its two use sites.
>
> No change in generated code.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>
> --- a/xen/arch/x86/xstate.c
> +++ b/xen/arch/x86/xstate.c
> @@ -334,16 +334,6 @@ void xsave(struct vcpu *v, uint64_t mask
>          ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET] = word_size;
>  }
>  
> -#define XRSTOR_FIXUP   ".section .fixup,\"ax\"           \n"    \
> -                       "2: mov %[size],%%ecx             \n"    \
> -                       "   xor %[lmask_out],%[lmask_out] \n"    \
> -                       "   rep stosb                     \n"    \
> -                       "   lea %[mem],%[ptr]             \n"    \
> -                       "   mov %[lmask_in],%[lmask_out]  \n"    \
> -                       "   jmp 1b                        \n"    \
> -                       ".previous                        \n"    \
> -                       _ASM_EXTABLE(1b, 2b)
> -
>  void xrstor(struct vcpu *v, uint64_t mask)
>  {
>      uint32_t hmask = mask >> 32;
> @@ -372,29 +362,33 @@ void xrstor(struct vcpu *v, uint64_t mas
>       */
>      switch ( __builtin_expect(ptr->fpu_sse.x[FPU_WORD_SIZE_OFFSET], 8) )
>      {
> +#define XRSTOR(pfx) \
> +        alternative_io("1: .byte " pfx "0x0f,0xae,0x2f\n" \
> +                       "   .section .fixup,\"ax\"\n" \
> +                       "2: mov %[size],%%ecx\n" \
> +                       "   xor %[lmask_out],%[lmask_out]\n" \
> +                       "   rep stosb\n" \
> +                       "   lea %[mem],%[ptr]\n" \
> +                       "   mov %[lmask_in],%[lmask_out]\n" \
> +                       "   jmp 1b\n" \
> +                       "   .previous\n" \
> +                       _ASM_EXTABLE(1b, 2b), \
> +                       ".byte " pfx "0x0f,0xc7,0x1f\n", \
> +                       X86_FEATURE_XSAVES, \
> +                       ASM_OUTPUT2([ptr] "+&D" (ptr), [lmask_out] "+&a" (lmask)), \
> +                       [mem] "m" (*ptr), [lmask_in] "g" (lmask), \
> +                       [hmask] "d" (hmask), [size] "m" (xsave_cntxt_size) \
> +                       : "ecx")

Please align the \'s on the RHS.  It makes the resulting blob rather
easier to read, especially given the \n's in the text.

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

  reply	other threads:[~2015-11-27 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-27 11:54 [PATCH] x86: properly macroize the two XRSTOR flavors Jan Beulich
2015-11-27 13:49 ` Andrew Cooper [this message]
2015-11-27 17:06   ` Jan Beulich

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=56585F80.6050709@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.