BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next v2 0/2] bpf: Move IPIs out of pack_mutex and reduce IBPB flushes
@ 2026-12-03 14:09 Xu Kuohai
  2026-12-03 14:09 ` [PATCH bpf-next v2 1/2] bpf: Invalidate freed prog pack memory without holding pack_mutex Xu Kuohai
  2026-12-03 14:09 ` [PATCH bpf-next v2 2/2] bpf: Reduce branch predictor flush and move it out of pack_mutex Xu Kuohai
  0 siblings, 2 replies; 5+ messages in thread
From: Xu Kuohai @ 2026-12-03 14:09 UTC (permalink / raw)
  To: bpf, linux-kernel
  Cc: Alexei Starovoitov, Daniel Borkmann, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Puranjay Mohan, Pawan Gupta

From: Xu Kuohai <xukuohai@huawei.com>

BPF JIT memory is allocated through the BPF program pack allocator,
which uses a global pack_mutex to protect its packs. While holding this
lock, the allocator currently sends IPI to all CPUs on two paths: IBPB
flush on the x86 alloc path and CPU pipeline flush on the arm64 free
path. Because the caller can be preempted while waiting for the IPI
completion, the lock can be held for a long time, causing heavy lock
contention on busy systems.

This series moves both IPIs out of pack_mutex and tracks dirty state per
chunk instead of per pack to reduce IBPB flushes.

v2:
- Switch to Puranjay's patch to move bpf_arch_text_invalidate out of
  pack_mutex
- Switch to a new approach suggested by Alexei to move the IBPB flush
  out of pack_mutex

v1: https://lore.kernel.org/bpf/cover.1796223449.git.xukuohai@huawei.com/

Puranjay Mohan (1):
  bpf: Invalidate freed prog pack memory without holding pack_mutex

Xu Kuohai (1):
  bpf: Reduce branch predictor flush and move it out of pack_mutex

 kernel/bpf/core.c | 101 +++++++++++++++++++++++++---------------------
 1 file changed, 56 insertions(+), 45 deletions(-)

-- 
2.47.3


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-03 15:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 14:09 [PATCH bpf-next v2 0/2] bpf: Move IPIs out of pack_mutex and reduce IBPB flushes Xu Kuohai
2026-12-03 14:09 ` [PATCH bpf-next v2 1/2] bpf: Invalidate freed prog pack memory without holding pack_mutex Xu Kuohai
2026-12-03 14:09 ` [PATCH bpf-next v2 2/2] bpf: Reduce branch predictor flush and move it out of pack_mutex Xu Kuohai
2026-12-03 14:55   ` sashiko-bot
2026-12-03 15:15   ` bot+bpf-ci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox