mbox series

[bpf-next,v1,0/2] Arena Queued Spin Lock

Message ID 20250117223754.1020174-1-memxor@gmail.com (mailing list archive)
Headers show
Series Arena Queued Spin Lock | expand

Message

Kumar Kartikeya Dwivedi Jan. 17, 2025, 10:37 p.m. UTC
Hello,

This set provides an implementation of queued spin lock for arena.
There is no support for resiliency and recovering from deadlocks yet.

These are split out from the rqspinlock patch set as independent pieces.

The maximum number of supported CPUs is 1024, but this can be increased
in the future if necessary.

The API supports returning an error, so resiliency support can be added
in the future.

I don't return ETIMEDOUT when cond_break fires. First we don't clean up
the queue properly when it fires, so the lock and arena is already
corrupt if a deadlock condition is triggered. Second, it's not trivial
to bubble up the error from xchg_tail and other helpers (like
smp_cond_load_*). It is better to instead implement resilient spin lock
support if we want to support proper unwinding in case of deadlock
errors.

Kumar Kartikeya Dwivedi (2):
  selftests/bpf: Introduce qspinlock for BPF arena
  selftests/bpf: Add tests for qspinlock in BPF arena

 .../selftests/bpf/bpf_arena_qspinlock.h       | 441 ++++++++++++++++++
 tools/testing/selftests/bpf/bpf_atomic.h      | 121 +++++
 .../bpf/prog_tests/arena_spin_lock.c          |  68 +++
 .../selftests/bpf/progs/arena_spin_lock.c     |  49 ++
 4 files changed, 679 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/bpf_arena_qspinlock.h
 create mode 100644 tools/testing/selftests/bpf/bpf_atomic.h
 create mode 100644 tools/testing/selftests/bpf/prog_tests/arena_spin_lock.c
 create mode 100644 tools/testing/selftests/bpf/progs/arena_spin_lock.c


base-commit: 01f3ce5328c405179b2c69ea047c423dad2bfa6d