linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Peter Zijlstra <peterz@infradead.org>, Borislav Petkov <bp@alien8.de>
Cc: Nathan Chancellor <nathan@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, "Moreira, Joao" <joao.moreira@intel.com>
Subject: Re: [PATCH] x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block
Date: Thu, 6 Oct 2022 10:56:47 -0700	[thread overview]
Message-ID: <CAKwvOdm-eyK5UEtARz5KW2D38GJkXJbUtbpRUCK5RKcHUAVzrw@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdk09OCeOrmHJBzRhp4XQykH_tkBGi9DY870C=suBzz9YQ@mail.gmail.com>

On Tue, Oct 4, 2022 at 2:27 PM Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> On Thu, Aug 18, 2022 at 12:45 AM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Wed, Aug 17, 2022 at 03:08:01PM -0700, Nick Desaulniers wrote:
> > > On Wed, Aug 17, 2022 at 11:56 AM Nathan Chancellor <nathan@kernel.org> wrote:
> > > >
> > > > LLVM 16 will have support for this flag so move it out of the GCC-only
> > > > block to allow LLVM builds to take advantage of it.
> > > >
> > > > Link: https://github.com/ClangBuiltLinux/linux/issues/1665
> > > > Link: https://github.com/llvm/llvm-project/commit/6f867f9102838ebe314c1f3661fdf95700386e5a
> > > > Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> > >
> > > Thanks for the patch, I also boot tested this (in virtual guests for
> > > both 64b and 32b).
> > >
> > > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> > > Tested-by: Nick Desaulniers <ndesaulniers@google.com>
> > >
> > > Peter, is there anything else special about these prefixes needed to
> > > make use of them?
> >
> > The thing to do is boot with (warning, *very* verbose):
> >
> >         "spectre_v2=retpoline,lfence debug-alternative"
>
> ah, debug-alternative also needs loglevel=8. Was wondering why I
> wasn't getting anything new in the output...
>
> No kidding on the verbosity. For a defconfig, booting in QEMU and
> redirecting stdout to a file produced a 95257 line file.
>
> $ grep "SMP alternatives: retpoline" /tmp/log.txt | wc -l
> 18623
> $ du -h /tmp/log.txt
> 11M /tmp/log.txt
> $ grep "SMP alternatives: retpoline" /tmp/log.txt | tr -s ' '
> ...
> [ 56.736261] SMP alternatives: retpoline at:
> pm_check_save_msr+0x30/0x80 (ffffffffaa34b320) len: 6 to:
> __x86_indirect_thunk_r11+0x0/0x20
> $ grep "SMP alternatives: retpoline" /tmp/log.txt | tr -s ' ' | cut -d
> ' ' -f 10 | sort -u
> 5
> 6
> # Curious about the 5, looks like there's only 2 cases:
> $ grep "SMP alternatives: retpoline" /tmp/log.txt | grep 'len: 5'
> [    0.147261] SMP alternatives: retpoline at: ret_from_fork+0x1d/0x30
> (ffffffffa9601dbd) len: 5 to: __x86_indirect_thunk_rbx+0x0/0x20
> [    2.274261] SMP alternatives: retpoline at: __efi_call+0x23/0x30
> (ffffffffa9671663) len: 5 to: __x86_indirect_thunk_rdi+0x0/0x20

For the typical len 6 case:
[    0.710345] SMP alternatives: ffffffffa2b6d1f2: orig: 2e e8 88 5f 09 ff
[    0.711345] SMP alternatives: ffffffffa2b6d1f2: repl: 0f ae e8 41 ff d3
[    0.712345] SMP alternatives: retpoline at: setup_arch+0x4b0/0x58c
(ffffffffa2b6d2ef) len: 6 to: __x86_indirect_thunk_r11+0x0/0x20

2e is the cs prefix, so it looks like this is working.

https://github.com/llvm/llvm-project/issues/58201
:^)

> Is there anything else I can do to help verify Nathan and Joao's
> patches?  If not, would you mind Ack'ing this so the x86 maintainers
> can pick it up?

I see it's already been Acked, so NVM. This is good to go.

> Noting that Joao's patch was applied in my tests.
> https://reviews.llvm.org/D134915
> I plan to land Joao's patch imminently.

Merging.
-- 
Thanks,
~Nick Desaulniers

  reply	other threads:[~2022-10-06 17:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-17 18:54 [PATCH] x86/build: Move '-mindirect-branch-cs-prefix' out of GCC-only block Nathan Chancellor
2022-08-17 22:08 ` Nick Desaulniers
2022-08-18  7:45   ` Peter Zijlstra
2022-08-18  8:00     ` Peter Zijlstra
2022-09-30 18:10     ` Nick Desaulniers
2022-10-04 21:27     ` Nick Desaulniers
2022-10-06 17:56       ` Nick Desaulniers [this message]
2022-08-18  7:49 ` Peter Zijlstra

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=CAKwvOdm-eyK5UEtARz5KW2D38GJkXJbUtbpRUCK5RKcHUAVzrw@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=joao.moreira@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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).