Extend map event_pipe to BPF ring buffer maps using libbpf's ring buffer
manager. Output records in plain or JSON format, reject CPU/index
selectors for ring buffers, and document the shared consumer position.

Changes in v2:
- Add actual -p invocations and pinned map selection, which the v1
  selftest commit message described without implementing those cases.
- Check the complete pretty-printed document, test plain/JSON/pretty
  output through pinned paths, and test pretty output for an empty stream.
- Clean up pins and their unique directories on success and failure.

Validation:
- All 17 ringbuf subtests passed, including the existing perf event array
  regression, in the integration run described below.
- The event_pipe implementation is unchanged from v1.

v1: https://lore.kernel.org/r/[email protected]
Request: https://github.com/libbpf/bpftool/issues/54

Integration validation: the flags, ring-buffer and batch v2 series plus
recursive dump v3 built together with LLVM 20. All 69 focused BPF subtests
passed in an x86-64 KVM guest running Linux 7.3.0-rc1, with no skips or
failures. The bpftool-map man page also built successfully. This is a
focused run, not the full BPF selftest suite.


Tianyi Chen (2):
  bpftool: Read ring buffer maps with event_pipe
  selftests/bpf: Cover bpftool ring buffer event_pipe

 .../bpf/bpftool/Documentation/bpftool-map.rst |  15 +-
 tools/bpf/bpftool/bash-completion/bpftool     |   4 +-
 tools/bpf/bpftool/map_perf_ring.c             |  87 +++-
 .../bpf/prog_tests/bpftool_ringbuf.c          | 425 ++++++++++++++++++
 .../selftests/bpf/progs/bpftool_ringbuf.c     |  47 ++
 5 files changed, 554 insertions(+), 24 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_ringbuf.c
 create mode 100644 tools/testing/selftests/bpf/progs/bpftool_ringbuf.c

-- 
2.55.0


Reply via email to