All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC bpf-next 0/3] bpf: Fix LRU NMI/tracepoint re-entry deadlock
@ 2026-05-28 18:13 Mykyta Yatsenko
  2026-05-28 18:13 ` [PATCH RFC bpf-next 1/3] bpf: Fix NMI/tracepoint re-entry deadlock on lru locks Mykyta Yatsenko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Mykyta Yatsenko @ 2026-05-28 18:13 UTC (permalink / raw)
  To: bpf, ast, andrii, daniel, kafai, kernel-team, eddyz87, memxor
  Cc: Mykyta Yatsenko, syzbot+c69a0a2c816716f1e0d5,
	syzbot+18b26edb69b2e19f3b33

This series fixes AA-deadlocks where NMI and tracepoint BPF programs
re-enter the per-CPU or global LRU lock already held on the same CPU
(syzbot c69a0a2c816716f1e0d5, 18b26edb69b2e19f3b33). Three prior
attempts have been nacked since 2024.

Patch 1 converts every LRU lock site (six of them) to rqspinlock_t
and adds explicit recovery for some failures so no node leaks:
per-CPU lockless free_llist for stolen-node recovery, plus a
pending_free flag honored by flush, shrink, and the steal path.
rqspinlock blocks like raw_spin_lock for normal contention and only
fails on deadlock or a timeout, so steady-state contention does
not degrade reliability.

Patch 2 refreshes Documentation/bpf/map_lru_hash_update.dot to show
the new rqspinlock failure exits and recovery routes.

Patch 3 replaces the original single-CPU NMI reproducer with a
parameterized stress harness across three map flavors (common LRU,
NO_COMMON_LRU per-CPU lists, per-CPU LRU map): perf-event NMI BPF on
every online CPU plus one pinned userspace hammer per CPU, both
mixing update and delete. Post-stress drain-and-refill asserts every
slot is re-allocatable - a stranded node from a failed push_free
recovery would surface as -ENOMEM that never clears.

Tested on a 4-CPU vng VM with PROVE_LOCKING: lru_lock_nmi (3
subtests) and the broader test_maps run pass with no lockdep splats.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
---
Mykyta Yatsenko (3):
      bpf: Fix NMI/tracepoint re-entry deadlock on lru locks
      Documentation/bpf: Refresh map_lru_hash_update.dot for rqspinlock
      selftests/bpf: Stress LRU rqspinlock recovery paths

 Documentation/bpf/map_lru_hash_update.dot          |  44 ++++-
 kernel/bpf/bpf_lru_list.c                          | 163 ++++++++++-------
 kernel/bpf/bpf_lru_list.h                          |  25 ++-
 .../selftests/bpf/prog_tests/lru_lock_nmi.c        | 202 +++++++++++++++++++++
 tools/testing/selftests/bpf/progs/lru_lock_nmi.c   |  33 ++++
 5 files changed, 394 insertions(+), 73 deletions(-)
---
base-commit: d34771f2f3db4ea0dd532cdd579002fc95dc483a
change-id: 20260519-lru_map_spin-8e20dabbf460

Best regards,
--  
Mykyta Yatsenko <yatsenko@meta.com>


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

end of thread, other threads:[~2026-05-28 19:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-28 18:13 [PATCH RFC bpf-next 0/3] bpf: Fix LRU NMI/tracepoint re-entry deadlock Mykyta Yatsenko
2026-05-28 18:13 ` [PATCH RFC bpf-next 1/3] bpf: Fix NMI/tracepoint re-entry deadlock on lru locks Mykyta Yatsenko
2026-05-28 18:57   ` sashiko-bot
2026-05-28 18:59   ` bot+bpf-ci
2026-05-28 18:13 ` [PATCH RFC bpf-next 2/3] Documentation/bpf: Refresh map_lru_hash_update.dot for rqspinlock Mykyta Yatsenko
2026-05-28 18:13 ` [PATCH RFC bpf-next 3/3] selftests/bpf: Stress LRU rqspinlock recovery paths Mykyta Yatsenko
2026-05-28 19:32   ` sashiko-bot

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.