Add support for BPF monitors
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest15 patches 65 repliesIn review
- v1 RFC20 patches 21 repliesSuperseded
Patches in v2 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/15 | sched: Add task enqueue/dequeue trace pointsinclude/ kernel/ kernel/ | +21 | 10 replies | |
| 2/15 | tools/rv: Skip empty pid error in selftest if command failedtools/ | +3 | 0 replies | |
| 3/15 | Refactor da_trace() functions to get strings internallyinclude/ | +22 | 0 replies | |
| 4/15 | Cast result of model_get_*_name()include/ | +2 | 4 replies | |
| 5/15 | tools/rv: Move argument parsing from in_kernel to utilstools/ tools/ tools/ | +149 | 0 replies | |
| 6/15 | tools/build: Add a feature test for bpftool-btftools/ tools/ | +7 | 0 replies | |
| 7/15 | tools/rv: Implement BPF monitor discovery and listingtools/ tools/ tools/ +3 more | +270 | 0 replies | |
| 8/15 | tools/rv: Implement BPF monitor loading and tracingtools/ tools/ tools/ +2 more | +667 | 0 replies | |
| 9/15 | tools/rv: Copy stripped bpf_atomic.h from libarenatools/ | +105 | 6 replies | |
| 10/15 | tools/rv: Add BPF monitorsinclude/ tools/ tools/ +9 more | +655 | 45 replies | |
| 11/15 | tools/rv: Define CONFIG_X86_64 statically for BPF monitorstools/ | +10 | 0 replies | |
| 12/15 | tools/rv: Add reactors support to BPF monitorsinclude/ tools/ tools/ +5 more | +157 | 0 replies | |
| 13/15 | verification/rvgen: Add support for BPF monitorstools/ tools/ tools/ +2 more | +80 | 0 replies | |
| 14/15 | tools/rv: Add selftest for rv bpf monitorstools/ tools/ | +65 | 0 replies | |
| 15/15 | verification/rvgen: Add selftest for rvgen -btools/ tools/ tools/ +2 more | +189 | 0 replies |
Reviews trailers per patch
1 of 15 patches has a Reviewed-by or Acked-by.
| Patch | K Prateek Nayak |
|---|---|
| 1/15 | R-b |
| 2/15 | |
| 3/15 | |
| 4/15 | |
| 5/15 | |
| 6/15 | |
| 7/15 | |
| 8/15 | |
| 9/15 | |
| 10/15 | |
| 11/15 | |
| 12/15 | |
| 13/15 | |
| 14/15 | |
| 15/15 |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v2 00/15] rv: Add support for BPF monitors
Extend the rv userspace tool to load BPF monitors, those can be found in specific locations (e.g. /usr/share/rv/bpf_monitors/) and are plain object files including BTF data.
This type of BPF monitors can be generated from rvgen using the -b flag just like in-kernel monitors and, after manual adaptation, can be built and run transparently by the rv userspace tool.
Only DA monitors are supported (as they are the only class the rv tool currenly supports) and the tool aims to work in the same way for both in-kernel and BPF monitors.
The da_monitor header is adapted to be included directly in BPF programs and share as much logic as possible.
BPF monitors are implemented purely in BPF and as such require the rv userspace tool for any operation:
* listing: find properly formatted objects in specific locations
* running: load trace handlers for events
* tracing: read event/errors from the ring buffer
* reactors: link a react() function over the object
Selftests (make -C tools/verification/rv check) are present to validate and demonstrate the usage, which is mostly equivalent to the standard rv tool usage.
Patch 1 adds tracepoints required in a later monitor example. Patch 2 improves the rv tool selftest reporting.
Patches 3-4 prepare the kernel headers for BPF support. Patch 5 adds a feature check for tools/build.
Patch 6-8 prepare and add support for BPF monitors in the rv tool. Patch 9-11 prepare and include BPF monitors examples.
Patch 12 adds support for BPF reactors.
Patch 13 adds support for generating BPF monitors in rvgen. Patch 14-15 adds BPF selftests (make check) for the rv and rvgen tools.
Changes since RFC [1]:
* Drop struct_ops integration to favour a BPF-only implementation.
* Implement BPF reactors with a dynamic linker.
* Don't pin programs and maps.
* Improve handler performance when not tracing.
[1] - https://lore.kernel.org/lkml/[email protected]
To: [email protected]
To: [email protected]
Cc: Steven Rostedt <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Nam Cao <[email protected]>
Cc: Wen Yang <[email protected]>
Cc: Tobias Schaffner <[email protected]>
Cc: Viktor Malik <[email protected]>
Gabriele Monaco (14):
tools/rv: Skip empty pid error in selftest if command failed
rv: Refactor da_trace() functions to get strings internally
rv: Cast result of model_get_*_name()
tools/rv: Move argument parsing from in_kernel to utils tools/build: Add a feature test for bpftool-btf tools/rv: Implement BPF monitor discovery and listing tools/rv: Implement BPF monitor loading and tracing tools/rv: Copy stripped bpf_atomic.h from libarena tools/rv: Add BPF monitors
tools/rv: Define CONFIG_X86_64 statically for BPF monitors tools/rv: Add reactors support to BPF monitors verification/rvgen: Add support for BPF monitors tools/rv: Add selftest for rv bpf monitors verification/rvgen: Add selftest for rvgen -b
Nam Cao (1):
sched: Add task enqueue/dequeue trace points
include/rv/automata.h | 4 +- include/rv/da_monitor.h | 61 +- include/trace/events/sched.h | 8 + kernel/sched/core.c | 12 +- kernel/sched/sched.h | 2 + tools/build/Makefile.feature | 1 + tools/build/feature/Makefile | 7 +- tools/verification/models/nohz.dot | 16 + tools/verification/models/tqueue.dot | 15 + tools/verification/rv/Makefile | 54 +- tools/verification/rv/Makefile.config | 49 + tools/verification/rv/Makefile.rv | 10 + tools/verification/rv/bpf_monitors/.gitignore | 2 + .../verification/rv/bpf_monitors/bpf_atomic.h | 105 ++ .../rv/bpf_monitors/da_monitor_bpf.h | 374 +++++++ tools/verification/rv/bpf_monitors/nohz.c | 42 + tools/verification/rv/bpf_monitors/nohz.h | 49 + tools/verification/rv/bpf_monitors/tqueue.c | 30 + tools/verification/rv/bpf_monitors/tqueue.h | 47 + tools/verification/rv/bpf_reactors/.gitignore | 2 + tools/verification/rv/bpf_reactors/panic.c | 15 + tools/verification/rv/bpf_reactors/printk.c | 13 + tools/verification/rv/include/bpf_monitor.h | 22 + tools/verification/rv/include/utils.h | 19 +- tools/verification/rv/src/Build | 5 + tools/verification/rv/src/bpf_monitor.c | 982 ++++++++++++++++++ tools/verification/rv/src/in_kernel.c | 176 +--- tools/verification/rv/src/rv.c | 5 + tools/verification/rv/src/utils.c | 98 +- tools/verification/rv/tests/rv_list.t | 6 +- tools/verification/rv/tests/rv_mon.t | 61 +- tools/verification/rvgen/__main__.py | 15 +- tools/verification/rvgen/rvgen/dot2c.py | 15 +- tools/verification/rvgen/rvgen/dot2k.py | 22 +- tools/verification/rvgen/rvgen/generator.py | 26 +- .../rvgen/rvgen/templates/dot2k/main_bpf.c | 21 + .../tests/golden/da_bpf_cpu/da_bpf_cpu.c | 35 + .../tests/golden/da_bpf_cpu/da_bpf_cpu.h | 47 + .../tests/golden/da_bpf_obj/da_bpf_obj.c | 49 + .../tests/golden/da_bpf_obj/da_bpf_obj.h | 47 + .../verification/rvgen/tests/rvgen_monitor.t | 11 + tools/verification/tests/engine.sh | 5 +- 42 files changed, 2392 insertions(+), 193 deletions(-) create mode 100644 tools/verification/models/nohz.dot create mode 100644 tools/verification/models/tqueue.dot create mode 100644 tools/verification/rv/bpf_monitors/.gitignore create mode 100644 tools/verification/rv/bpf_monitors/bpf_atomic.h create mode 100644 tools/verification/rv/bpf_monitors/da_monitor_bpf.h create mode 100644 tools/verification/rv/bpf_monitors/nohz.c create mode 100644 tools/verification/rv/bpf_monitors/nohz.h create mode 100644 tools/verification/rv/bpf_monitors/tqueue.c create mode 100644 tools/verification/rv/bpf_monitors/tqueue.h create mode 100644 tools/verification/rv/bpf_reactors/.gitignore create mode 100644 tools/verification/rv/bpf_reactors/panic.c create mode 100644 tools/verification/rv/bpf_reactors/printk.c create mode 100644 tools/verification/rv/include/bpf_monitor.h create mode 100644 tools/verification/rv/src/bpf_monitor.c create mode 100644 tools/verification/rvgen/rvgen/templates/dot2k/main_bpf.c create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_cpu/da_bpf_cpu.c create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_cpu/da_bpf_cpu.h create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_obj/da_bpf_obj.c create mode 100644 tools/verification/rvgen/tests/golden/da_bpf_obj/da_bpf_obj.h
base-commit: 238650ef6c7c7cca08e032527329424c9fbd70e5
Signature · 1 line
2.55.0