[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6dde4d2e-b249-4fb8-a8f6-359cb7c8b0fe@linux.ibm.com>
Date: Mon, 19 May 2025 12:29:41 +0530
From: Hari Bathini <hbathini@...ux.ibm.com>
To: Luis Gerhorst <luis.gerhorst@....de>, Alexei Starovoitov
<ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau
<martin.lau@...ux.dev>,
Eduard Zingerman <eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>, Stanislav Fomichev <sdf@...ichev.me>,
Hao Luo <haoluo@...gle.com>, Jiri Olsa <jolsa@...nel.org>,
Puranjay Mohan <puranjay@...nel.org>,
Xu Kuohai <xukuohai@...weicloud.com>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>,
Madhavan Srinivasan <maddy@...ux.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>, Mykola Lysenko <mykolal@...com>,
Shuah Khan <shuah@...nel.org>,
Henriette Herzog <henriette.herzog@....de>,
Saket Kumar Bhaskar <skb99@...ux.ibm.com>,
Cupertino Miranda <cupertino.miranda@...cle.com>,
Jiayuan Chen <mrpre@....com>, Matan Shachnai <m.shachnai@...il.com>,
Dimitar Kanaliev <dimitar.kanaliev@...eground.com>,
Shung-Hsi Yu <shung-hsi.yu@...e.com>, Daniel Xu <dxu@...uu.xyz>,
bpf@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-kselftest@...r.kernel.org
Cc: Maximilian Ott <ott@...fau.de>, Milan Stephan <milan.stephan@....de>
Subject: Re: [PATCH bpf-next v2 06/11] bpf, arm64, powerpc: Change nospec to
include v1 barrier
On 18/05/25 4:11 pm, Hari Bathini wrote:
>
>
> On 21/04/25 2:47 pm, Luis Gerhorst wrote:
>> This changes the semantics of BPF_NOSPEC (previously a v4-only barrier)
>> to always emit a speculation barrier that works against both Spectre v1
>> AND v4. If mitigation is not needed on an architecture, the backend
>> should set bpf_jit_bypass_spec_v4/v1().
>>
>> As of now, this commit only has the user-visible implication that unpriv
>> BPF's performance on PowerPC is reduced. This is the case because we
>> have to emit additional v1 barrier instructions for BPF_NOSPEC now.
>>
>> This commit is required for a future commit to allow us to rely on
>> BPF_NOSPEC for Spectre v1 mitigation. As of this commit, the feature
>> that nospec acts as a v1 barrier is unused.
>>
>> Commit f5e81d111750 ("bpf: Introduce BPF nospec instruction for
>> mitigating Spectre v4") noted that mitigation instructions for v1 and v4
>> might be different on some archs. While this would potentially offer
>> improved performance on PowerPC, it was dismissed after the following
>> considerations:
>>
>> * Only having one barrier simplifies the verifier and allows us to
>> easily rely on v4-induced barriers for reducing the complexity of
>> v1-induced speculative path verification.
>
> Fair enough.
>
>>
>> * For the architectures that implemented BPF_NOSPEC, only PowerPC has
>> distinct instructions for v1 and v4. Even there, some insns may be
>> shared between the barriers for v1 and v4 (e.g., 'ori 31,31,0' and
>> 'sync'). If this is still found to impact performance in an
>> unacceptable way, BPF_NOSPEC can be split into BPF_NOSPEC_V1 and
>> BPF_NOSPEC_V4 later. As an optimization, we can already skip v1/v4
>> insns from being emitted for PowerPC with this setup if
>> bypass_spec_v1/v4 is set.
>>
>
> Agreed.
>
> Acked-by: Hari Bathini <hbathini@...ux.ibm.com>
Applies to v3 too :)
Let me send for v3..
- Hari
Powered by blists - more mailing lists