All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf 0/2] bpf: Shorten pack_mutex critical sections
@ 2026-11-03 14:28 Puranjay Mohan
  2026-11-03 14:28 ` [PATCH bpf 1/2] bpf: Don't allocate and free prog pack memory with pack_mutex held Puranjay Mohan
  2026-11-03 14:28 ` [PATCH bpf 2/2] bpf: Invalidate freed prog pack memory without holding pack_mutex Puranjay Mohan
  0 siblings, 2 replies; 6+ messages in thread
From: Puranjay Mohan @ 2026-11-03 14:28 UTC (permalink / raw)
  To: bpf
  Cc: Puranjay Mohan, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman,
	Kumar Kartikeya Dwivedi, Song Liu, Yonghong Song, Mykyta Yatsenko

Patch 2 moves bpf_arch_text_invalidate() out of pack_mutex, as
suggested on v1 [1].

That makes the frees fast enough to hit a deadlock that was already
there: the pack_mutex owner frees an empty pack and waits in
flush_work() for vmalloc purge work, which cannot run while
bpf_prog_free_deferred() items waiting for pack_mutex fill the
system_percpu_wq pool. Patch 1 allocates and frees pack memory without
pack_mutex. Seen on arm64; x86 and powerpc take the same path.

Changes since v1:
- Invalidate before taking pack_mutex on all archs, instead of dropping
  and retaking it on arm64
- New patch 1 for the deadlock

[1] https://lore.kernel.org/bpf/20261024031046.625578-1-alexei.starovoitov@gmail.com/

Puranjay Mohan (2):
  bpf: Don't allocate and free prog pack memory with pack_mutex held
  bpf: Invalidate freed prog pack memory without holding pack_mutex

 kernel/bpf/core.c | 58 +++++++++++++++++++++++++++++++----------------
 1 file changed, 39 insertions(+), 19 deletions(-)


base-commit: 9abe2c42ecab6c86b54838d2d645ca2e10204606
-- 
2.53.0-Meta


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

end of thread, other threads:[~2026-11-05 18:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03 14:28 [PATCH bpf 0/2] bpf: Shorten pack_mutex critical sections Puranjay Mohan
2026-11-03 14:28 ` [PATCH bpf 1/2] bpf: Don't allocate and free prog pack memory with pack_mutex held Puranjay Mohan
2026-11-03 15:20   ` bot+bpf-ci
2026-11-03 16:47   ` Alexei Starovoitov
2026-11-05 18:27     ` Emil Tsalapatis
2026-11-03 14:28 ` [PATCH bpf 2/2] bpf: Invalidate freed prog pack memory without holding pack_mutex Puranjay Mohan

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.