bpf: Fast-Path approach for BPF program termination
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest4 patches 5 repliesIn review
v2 -> v3 from the cover letter
- Cloning of BPF programs has been removed.
- Created call sites table to maintain helper/ kfunc call instruction offsets.
- Termination is triggered inside the softlockup detector not affecting any fast path operations.
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/4 | bpf: Introduce new structs and struct fields for fast path terminationinclude/ kernel/ | +79 | 2 replies | |
| 2/4 | bpf: Creating call sites table to stub instructions during runtimearch/ include/ kernel/ +1 more | +137 | 0 replies | |
| 3/4 | bpf: runtime part of fast-path termination approacharch/ include/ include/ +2 more | +182 | 2 replies | |
| 4/4 | selftests/bpf: Adds selftests to check termination of long running nested bpf loopstools/ tools/ | +86 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/4] bpf: Fast-Path approach for BPF program termination
This is RFC v3 of
https://lore.kernel.org/all/[email protected]/
The termination handler call from the softlockup detector is mainly for the demonstration of the entire workflow and also serves as a potential use case for discussion. However, the runtime mechanism is modular enough to be ported to different scenarios such as deadlocks, page faults, userspace BPF management tools, and stack overflows.
The main changes that we bring in this version are: We have avoided the memory overhead caused by program cloning in previous versions. During normal program execution, none of the termination logic causes any additional overhead.
Change log:
v2 -> v3:
- Cloning of BPF programs has been removed.
- Created call sites table to maintain helper/ kfunc call instruction offsets.
- Termination is triggered inside the softlockup detector not affecting any fast path operations.
v1 -> v2:
- Patch generation has been moved after verification and before JIT.
- Now patch generation handles both helpers and kfuncs.
- Sanity check on original prog and patch prog after JIT.
- Runtime termination handler is now global termination mechanism using text_poke.
- Termination is triggered by watchdog timer.
arch/x86/net/bpf_jit_comp.c | 141 ++++++++++++++++++ include/linux/bpf.h | 77 ++++++---- include/linux/bpf_verifier.h | 1 + include/linux/filter.h | 6 + kernel/bpf/core.c | 67 +++++++++ kernel/bpf/verifier.c | 135 +++++++++++++++-- kernel/watchdog.c | 8 + .../bpf/prog_tests/bpf_termination.c | 39 +++++ .../selftests/bpf/progs/bpf_termination.c | 47 ++++++ 9 files changed, 482 insertions(+), 39 deletions(-) create mode 100644 tools/testing/selftests/bpf/prog_tests/bpf_termination.c create mode 100644 tools/testing/selftests/bpf/progs/bpf_termination.c
Signature · 1 line
2.43.0