Skip to content

Limited queueing in NMI for rqspinlock

Kumar Kartikeya Dwivedi bpf 2 versions Applied

Status from this message: This series was applied to bpf/bpf-next.git (master)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest6 patches 1 replyApplied 6/6
  2. v16 patches 1 replySuperseded

Patches in v2 All 6 applied

#Subject and filesSizeRepliesApplied
1/6rqspinlock: Enclose lock/unlock within lock entry acquisitionsinclude/asm-generic/rqspinlock.h kernel/bpf/rqspinlock.c+38 -370 repliesApplied
2/6rqspinlock: Perform AA checks immediatelykernel/bpf/rqspinlock.c+7 -180 repliesApplied
3/6rqspinlock: Use trylock fallback when per-CPU rqnode is busykernel/bpf/rqspinlock.c+1 -11 replyApplied
4/6rqspinlock: Disable spinning for trylock fallbackkernel/bpf/rqspinlock.c+8 -100 repliesApplied
5/6rqspinlock: Precede non-head waiter queueing with AA checkkernel/bpf/rqspinlock.c+13 -00 repliesApplied
6/6selftests/bpf: Add success stats to rqspinlock stress testtools/testing/selftests/bpf/test_kmods/bpf_test_rqspinlock.c+43 -120 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH bpf-next v2 0/6] Limited queueing in NMI for rqspinlock

Ritesh reported that he was frequently seeing timeouts in cases which should have been covered by the AA heuristics. This led to the discovery of multiple gaps in the current code that could lead to timeouts when AA heuristics could work to prevent them. More details and investigation is available in the original threads. [0][1]

This set restores the ability for NMI waiters to queue in the slow path, and reduces the cases where they would attempt to trylock. However, such queueing must not happen when interrupting waiters which the NMI itself depends upon for forward progress; in those cases the trylock fallback remains, but with a single attempt to avoid aimless attempts to acquire the lock.

It also closes a possible window in the lock fast path and the unlock path where NMIs landing between cmpxchg and entry creation, or entry deletion and unlock would miss the detection of an AA scenario and end up timing out.

This virtually eliminates all the cases where existing heuristics can prevent timeouts and quickly recover from a deadlock. More details are available in the commit logs for each patch.

[0]: https://lore.kernel.org/bpf/CAH6OuBTjG+N=+GGwcpOUbeDN563oz4iVcU3rbse68egp9wj9_A@mail.gmail.com
[1]: https://lore.kernel.org/bpf/[email protected]

Kumar Kartikeya Dwivedi (6):
rqspinlock: Enclose lock/unlock within lock entry acquisitions
rqspinlock: Perform AA checks immediately
rqspinlock: Use trylock fallback when per-CPU rqnode is busy
rqspinlock: Disable spinning for trylock fallback
rqspinlock: Precede non-head waiter queueing with AA check selftests/bpf: Add success stats to rqspinlock stress test

 include/asm-generic/rqspinlock.h              | 60 ++++++++--------
 kernel/bpf/rqspinlock.c                       | 69 +++++++++----------
 .../bpf/test_kmods/bpf_test_rqspinlock.c      | 55 +++++++++++----
 3 files changed, 108 insertions(+), 76 deletions(-)

base-commit: 688b745401ab16e2e1a3b504863f0a45fd345638

Signature · 1 line
2.51.0