From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
x86@kernel.org, andrew.cooper3@citrix.com,
linux-kernel@vger.kernel.org, ndesaulniers@google.com,
bpf@vger.kernel.org, daniel@iogearbox.net
Subject: Re: [PATCH v2 14/14] bpf,x86: Respect X86_FEATURE_RETPOLINE*
Date: Thu, 21 Oct 2021 10:53:58 +0200 [thread overview]
Message-ID: <YXEqpuKa5UiRNEfc@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20211021001808.3ng6qeggi5lfwx7k@treble>
On Wed, Oct 20, 2021 at 05:18:08PM -0700, Josh Poimboeuf wrote:
> On Wed, Oct 20, 2021 at 05:07:53PM -0700, Alexei Starovoitov wrote:
> > On Wed, Oct 20, 2021 at 12:44:56PM +0200, Peter Zijlstra wrote:
> > > +
> > > + if (cpu_feature_enabled(X86_FEATURE_RETPOLINE_AMD)) {
> > > + EMIT_LFENCE();
> > > + EMIT2(0xFF, 0xE0 + reg);
> > > + } else if (cpu_feature_enabled(X86_FEATURE_RETPOLINE)) {
> > > + emit_jump(&prog, reg_thunk[reg], ip);
> > > + } else
> >
> > One more question.
> > What's a deal with AMD? I thought the retpoline is effective on it as well.
> > lfence is an optimization or retpoline turned out to be not enough
> > in some cases?
>
> Yes, it's basically an optimization. AMD recommends it presumably
> because it's quite a bit faster than a retpoline.
>
> According to AMD it shrinks the speculative execution window enough so
> that Spectre v2 isn't a threat.
Right, also note that we've been using alternatives to patch the thunk
to lfence;jmp for AMD pretty much forever.
Inlining it is better tho; just a shame clang seems to insist on r11,
which means we cannot fit it in the thunk call site for them :/
prev parent reply other threads:[~2021-10-21 8:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211020104442.021802560@infradead.org>
[not found] ` <20211020105843.345016338@infradead.org>
[not found] ` <YW/4/7MjUf3hWfjz@hirez.programming.kicks-ass.net>
2021-10-21 0:05 ` [PATCH v2 14/14] bpf,x86: Respect X86_FEATURE_RETPOLINE* Alexei Starovoitov
2021-10-21 8:47 ` Peter Zijlstra
2021-10-21 18:03 ` Alexei Starovoitov
2021-10-21 22:37 ` Peter Zijlstra
2021-10-21 23:24 ` Alexei Starovoitov
2021-10-21 23:38 ` Josh Poimboeuf
2021-10-21 23:42 ` Alexei Starovoitov
2021-10-22 11:31 ` Peter Zijlstra
2021-10-22 15:22 ` Alexei Starovoitov
2021-10-25 13:44 ` Maciej Fijalkowski
2021-10-25 12:42 ` Peter Zijlstra
2021-10-21 23:51 ` Zvi Effron
2021-10-22 8:33 ` Peter Zijlstra
2021-10-22 21:06 ` Zvi Effron
2021-10-21 0:07 ` Alexei Starovoitov
2021-10-21 0:18 ` Josh Poimboeuf
2021-10-21 8:53 ` Peter Zijlstra [this message]
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=YXEqpuKa5UiRNEfc@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=alexei.starovoitov@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--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