Skip to content

selftests/bpf: libarena: Add initial data structures

Emil Tsalapatis bpf sashiko-reviews 5 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. v4 Latest3 patches 1 replyApplied 3/3
  2. v33 patches 1 replySuperseded
  3. v23 patches 4 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v1 posting 2/22 patches5 repliesSuperseded
v1 posting 1/22 patches0 repliesSuperseded

Patches in v4 All 3 applied

#Subject and filesSizeRepliesApplied
1/3selftests/bpf: libarena: Add rbtree data structuretools/testing/selftests/bpf/libarena/include/libarena/rbtree.h tools/testing/selftests/bpf/libarena/selftests/test_rbtree.bpf.c tools/testing/selftests/bpf/libarena/src/rbtree.bpf.c+2098 -01 replyApplied
2/3selftests/bpf: libarena: Add spmc queue data structuretools/testing/selftests/bpf/libarena/include/libarena/spmc.h tools/testing/selftests/bpf/libarena/selftests/test_spmc.bpf.c tools/testing/selftests/bpf/libarena/src/spmc.bpf.c+455 -00 repliesApplied
3/3selftests/bpf: libarena: parallel test harness and spmc parallel selftesttools/testing/selftests/bpf/libarena/include/libarena/userspace.h tools/testing/selftests/bpf/libarena/selftests/test_parallel_spmc.bpf.c tools/testing/selftests/bpf/prog_tests/libarena.c+866 -00 repliesApplied

Reviews trailers per patch

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

Read the v4 thread

Cover letter [PATCH bpf-next v4 0/3] selftests/bpf: libarena: Add initial data structures

Add two new data structures to libarena. These data structures initially resided in the sched-ext repo (https://github.com/sched-ext/scx) and have been adapted to the internal libarena build system. The data structures are:

- Red black tree: Fundamental tree data structure that can also serve as a base for more domain-specific data structures.

- Lev-Chase deque: Queue data structure that allows efficient work stealing, useful in scheduling scenarios.

The data structures are accompanied by selftests that are automatically discovered by the existing libarena test_progs selftest and incorporated in the CI.

CHANGELOG
=========

v3 -> v4 (https://lore.kernel.org/bpf/[email protected]/)
- Turn off load_acquire/store_relesase - dependent selftests for s390 (CI)
- Various style/non-functional nits (AI)

v2 -> v3 (https://lore.kernel.org/bpf/[email protected]/)

- Add workaround to handle LLVM 21 and GCC 15 assignment-to-memset promotions that are causing verification failures for arena programs (CI)
- Incorporate Sashiko feedback for cleanup edge cases (Sashiko)
- Simplify some of the ordering semantics in spmc

v1 -> v2 (https://lore.kernel.org/bpf/[email protected]/):

- Rename tests from st_ to test_ (Alexei)
- Removed the freelist caches from the rbtrees, previously used to defer freeing (Alexei)
- Moved the type and function definitions to use the __arena identifier
- Removed the typecasts during function return and directly return __arena pointers (Alexei)
- Renamed queues to spmc queues to abstract away the algorithm (Alexei)
- Adjusted the memory barriers in the spmc queue
- Added multithreaded testing harness for libarena programs (Alexei)
- Added parallel selftest for queues (Alexei)
- Split least upper bound and exact find operations back into separate functions to prevent RB_DUPLICATE-related bug (AI)

Emil Tsalapatis (3):
selftests/bpf: libarena: Add rbtree data structure selftests/bpf: libarena: Add spmc queue data structure selftests/bpf: libarena: parallel test harness and spmc parallel
selftest

 .../bpf/libarena/include/libarena/rbtree.h    |   83 ++
 .../bpf/libarena/include/libarena/spmc.h      |   27 +
 .../bpf/libarena/include/libarena/userspace.h |    6 +
 .../selftests/test_parallel_spmc.bpf.c        |  673 +++++++++++
 .../bpf/libarena/selftests/test_rbtree.bpf.c  |  968 +++++++++++++++
 .../bpf/libarena/selftests/test_spmc.bpf.c    |  194 +++
 .../selftests/bpf/libarena/src/rbtree.bpf.c   | 1047 +++++++++++++++++
 .../selftests/bpf/libarena/src/spmc.bpf.c     |  234 ++++
 .../selftests/bpf/prog_tests/libarena.c       |  187 +++
 9 files changed, 3419 insertions(+)
 create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/rbtree.h
 create mode 100644 tools/testing/selftests/bpf/libarena/include/libarena/spmc.h
 create mode 100644 tools/testing/selftests/bpf/libarena/selftests/test_parallel_spmc.bpf.c
 create mode 100644 tools/testing/selftests/bpf/libarena/selftests/test_rbtree.bpf.c
 create mode 100644 tools/testing/selftests/bpf/libarena/selftests/test_spmc.bpf.c
 create mode 100644 tools/testing/selftests/bpf/libarena/src/rbtree.bpf.c
 create mode 100644 tools/testing/selftests/bpf/libarena/src/spmc.bpf.c
Signature · 1 line
2.54.0