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>
Cc: Xen-devel <xen-devel@lists.xen.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH] x86/build: Use new .nops directive when available
Date: Tue, 28 Aug 2018 18:58:15 +0100	[thread overview]
Message-ID: <320f3c20-54c7-80d6-52f7-9ecb5a6d9e13@citrix.com> (raw)
In-Reply-To: <5B76C36C02000078001DF6B6@prv1-mh.provo.novell.com>

On 17/08/18 13:45, Jan Beulich wrote:
>>>> On 15.08.18 at 19:57, <andrew.cooper3@citrix.com> wrote:
>> --- a/xen/arch/x86/Rules.mk
>> +++ b/xen/arch/x86/Rules.mk
>> @@ -29,6 +29,10 @@ $(call as-option-add,CFLAGS,CC,"invpcid 
>> (%rax)$$(comma)%rax",-DHAVE_AS_INVPCID)
>>  $(call as-option-add,CFLAGS,CC,\
>>      ".if ((1 > 0) < 0); .error \"\";.endif",,-DHAVE_AS_NEGATIVE_TRUE)
>>  
>> +# Check to see whether the assmbler supports the .nop directive.
>> +$(call as-option-add,CFLAGS,CC,\
>> +    ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOP_DIRECTIVE)
> Can this please be HAVE_AS_NOPS_DIRECTIVE?

Ok.

>
>> --- a/xen/arch/x86/alternative.c
>> +++ b/xen/arch/x86/alternative.c
>> @@ -84,6 +84,19 @@ static const unsigned char * const p6_nops[ASM_NOP_MAX+1] 
>> init_or_livepatch_cons
>>  
>>  static const unsigned char * const *ideal_nops init_or_livepatch_data = p6_nops;
>>  
>> +#ifdef HAVE_AS_NOP_DIRECTIVE
>> +
>> +/* Nops in .init.rodata to compare against the runtime ideal nops. */
>> +asm ( ".pushsection .init.rodata, \"a\", @progbits\n\t"
>> +      "toolchain_nops: .nops " __stringify(ASM_NOP_MAX) "\n\t"
>> +      ".popsection\n\t");
> Any particular reason not to put them in .init.text?

Because its data, not executable code.

>
>> @@ -27,6 +26,14 @@ extern void add_nops(void *insns, unsigned int len);
>>  extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
>>  extern void alternative_instructions(void);
>>  
>> +asm ( ".macro mknops nr_bytes\n\t"
>> +#ifdef HAVE_AS_NOP_DIRECTIVE
>> +      ".nops \\nr_bytes, " __stringify(ASM_NOP_MAX) "\n\t"
>> +#else
>> +      ".skip \\nr_bytes, 0x90\n\t"
>> +#endif
>> +      ".endm\n\t" );
> Did you take a look at "x86/alternatives: allow using assembler macros
> in favor of C ones" yet? Perhaps this redundant macro definition could
> be avoided that way? I'm not going to exclude though that some more
> work might be needed to get there.

No - not looked at that yet.  That does look like we can get a large net
cleanup, and can avoid using always_inline to work around the same problem.

>
> Anyway, I'm in principle fine with the change, irrespective of the other
> discussion we've had, so with the name change and possibly the other
> two remarks taken care of
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks,

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2018-08-28 17:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-15 17:57 [PATCH] x86/build: Use new .nops directive when available Andrew Cooper
2018-08-16  9:55 ` Roger Pau Monné
2018-08-16 10:18   ` Jan Beulich
2018-08-16 11:57     ` Roger Pau Monné
2018-08-16 12:39       ` Jan Beulich
2018-08-16 10:42   ` Andrew Cooper
2018-08-16 11:34     ` Jan Beulich
2018-08-16 11:48       ` Andrew Cooper
2018-08-16 12:43         ` Jan Beulich
2018-08-16 14:31     ` Roger Pau Monné
2018-08-16 15:56       ` Andrew Cooper
2018-08-16 16:36         ` Roger Pau Monné
2018-08-17 12:45 ` Jan Beulich
2018-08-28 17:58   ` Andrew Cooper [this message]
2018-08-29  6:31     ` 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=320f3c20-54c7-80d6-52f7-9ecb5a6d9e13@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.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).