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 Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH v3 7/7] x86/build: Use new .nops directive when available
Date: Thu, 8 Mar 2018 16:48:08 +0000	[thread overview]
Message-ID: <2c720709-c0a0-bfcf-2cfc-2b72976844e3@citrix.com> (raw)
In-Reply-To: <5AA16AA502000078001AFE4A@prv-mh.provo.novell.com>

On 08/03/18 15:53, Jan Beulich wrote:
>>>> On 07.03.18 at 16:51, <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)
> The construct is right, but the comment still has the old directive name.
>
>> --- a/xen/arch/x86/alternative.c
>> +++ b/xen/arch/x86/alternative.c
>> @@ -207,7 +207,8 @@ void init_or_livepatch apply_alternatives(struct alt_instr *start,
>>              base->priv = 1;
>>  
>>              /* Nothing useful to do? */
>> -            if ( a->pad_len <= 1 )
>> +            if ( (TOOLCHAIN_P6_NOPS && ideal_nops == p6_nops) ||
>> +                 a->pad_len <= 1 )
>>                  continue;
> I'm sorry, but no - we can't assume all gas versions going forward
> will continue to produce the NOPs we want. They may change at
> any time, and we may change our mind at any time. If anything
> you'd need to actively check that what their .nops produces
> matches what our table has.

Hmm perhaps, but the chances of either of these actually happening are
extremely low.

> Additionally such skipping on the vast majority of hardware is
> prone to leave bugs undiscovered for quite some time.

Such as?  This statement isn't exactly helpful, and

> Anyway - I continue to fail to see the value of this patch with the
> immediately preceding one already doing all we need.

The purpose, as explained before, is to avoid patching whenever possible.

"Whenever possible" is every time we fail a feature check, and the
toolchain puts out the correct nops (which, for a capable toolchain, is
overwhelmingly likely given our 64bit-ness), and has a direct effect on
our boot time safety.

> An alternative might be to have a Kconfig option to suppress the
> NOP optimization altogether, and rely on what the tool chain
> produces.

How and why would a user wish to change this option?  I don't think
anyone would find it useful.

~Andrew

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

  reply	other threads:[~2018-03-08 16:48 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-07 15:51 [PATCH v3 0/7] x86/alternatives: Support for automatic padding calculations Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 1/7] x86/alt: Drop unused alternative infrastructure Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 2/7] x86/alt: Clean up struct alt_instr and its users Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 3/7] x86/alt: Clean up the assembly used to generate alternatives Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 4/7] x86/asm: Remove opencoded uses of altinstruction_entry Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 5/7] x86/alt: Support for automatic padding calculations Andrew Cooper
2018-03-08 15:42   ` Jan Beulich
2018-03-08 16:23     ` Andrew Cooper
2018-03-08 16:49       ` Jan Beulich
2018-03-08 16:52         ` Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 6/7] x86/alt: Drop explicit padding of origin sites Andrew Cooper
2018-03-07 15:51 ` [PATCH v3 7/7] x86/build: Use new .nops directive when available Andrew Cooper
2018-03-08 15:53   ` Jan Beulich
2018-03-08 16:48     ` Andrew Cooper [this message]
2018-03-08 16:56       ` 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=2c720709-c0a0-bfcf-2cfc-2b72976844e3@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).