From: Dave Hansen <dave.hansen@intel.com>
To: Viktor Malik <vmalik@redhat.com>, bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
John Fastabend <john.fastabend@gmail.com>,
Thomas Gleixner <tglx@kernel.org>, Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Valentin Schneider <vschneid@redhat.com>,
Tomas Glozar <tglozar@redhat.com>
Subject: Re: [PATCH bpf-next 1/2] bpf: Track CPUs that have executed a BPF program
Date: Fri, 4 Dec 2026 08:27:02 -0800 [thread overview]
Message-ID: <0cb5c81d-d168-4b91-92fc-6aa5f8b27ff9@intel.com> (raw)
In-Reply-To: <5cf89312e3fea4409dc1fc9da6aa37b1e7a7f3b5.1796391323.git.vmalik@redhat.com>
On 12/4/26 05:44, Viktor Malik wrote:
> +static __always_inline void bpf_prog_mark_ran(void)
> +{
> + bool *ran;
> +
> + if (!static_branch_unlikely(&bpf_pred_flush_enabled))
> + return;
> +
> + ran = raw_cpu_ptr(&bpf_prog_ran);
> + if (!READ_ONCE(*ran))
> + WRITE_ONCE(*ran, true);
> +}
This is bizarrely complex.
I obviously know why code might want to avoid dirtying a cacheline,
especially when it might be shared. But this is per-cpu data. It's
fundamentally not in other CPU caches.
What's wrong with?
if (static_branch_unlikely(&bpf_pred_flush_enabled))
this_cpu_write(bpf_prog_ran, true);
> DEFINE_STATIC_KEY_FALSE(bpf_pred_flush_enabled);
> +EXPORT_SYMBOL(bpf_pred_flush_enabled);
> +
> +/*
> + * Set on a CPU once it has executed a JITed BPF program since the last
> + * predictor flush; see bpf_prog_mark_ran() and bpf_arch_pred_flush().
> + */
> +DEFINE_PER_CPU(bool, bpf_prog_ran);
> +EXPORT_PER_CPU_SYMBOL(bpf_prog_ran);
What are the exports for? Any reason they're generic exports and not
GPL-only?
next prev parent reply other threads:[~2026-12-04 16:27 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 13:44 [PATCH bpf-next 0/2] bpf, x86: Restrict BPF JIT IBPB flush to CPUs that ran BPF Viktor Malik
2026-12-04 13:44 ` [PATCH bpf-next 1/2] bpf: Track CPUs that have executed a BPF program Viktor Malik
2026-12-04 14:03 ` sashiko-bot
2026-12-04 15:22 ` Viktor Malik
2026-12-04 14:51 ` Valentin Schneider
2026-12-04 16:27 ` Dave Hansen [this message]
2026-12-04 16:45 ` Viktor Malik
2026-12-05 9:55 ` kernel test robot
2026-12-04 13:44 ` [PATCH bpf-next 2/2] x86/bugs: Restrict BPF JIT IBPB flush to CPUs that ran BPF Viktor Malik
2026-12-04 14:17 ` sashiko-bot
2026-12-04 15:33 ` Viktor Malik
2026-12-04 14:51 ` Valentin Schneider
2026-12-04 15:01 ` [PATCH bpf-next 0/2] bpf, x86: " Valentin Schneider
2026-12-04 16:37 ` Dave Hansen
2026-12-04 17:46 ` Valentin Schneider
2026-12-04 19:42 ` Alexei Starovoitov
-- strict thread matches above, loose matches on Subject: below --
2026-12-05 9:55 [PATCH bpf-next 1/2] bpf: Track CPUs that have executed a BPF program kernel test robot
2026-12-05 9:55 kernel test robot
2026-12-05 9:55 kernel test robot
2026-12-05 9:55 kernel test robot
2026-12-05 13:07 kernel test robot
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=0cb5c81d-d168-4b91-92fc-6aa5f8b27ff9@intel.com \
--to=dave.hansen@intel.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bp@alien8.de \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dave.hansen@linux.intel.com \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=hpa@zytor.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jpoimboe@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=song@kernel.org \
--cc=tglozar@redhat.com \
--cc=tglx@kernel.org \
--cc=vmalik@redhat.com \
--cc=vschneid@redhat.com \
--cc=x86@kernel.org \
--cc=yonghong.song@linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.