Skip to content

RFC bpf: Fast-Path approach for BPF program

Siddharth Chintamaneni bpf oe-kbuild-all 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 RFC Latest4 patches 14 repliesIn review

Changes in v2 from the cover letter

- 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.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4bpf: Introduce new structs and struct fieldsinclude/linux/bpf.h kernel/bpf/core.c+54 -10 replies
2/4bpf: Generating a stubbed version of BPF program for terminationinclude/linux/bpf_verifier.h include/linux/filter.h kernel/bpf/core.c +2 more+276 -63 replies
3/4bpf: Runtime part of fast-path termination approachinclude/linux/bpf.h include/linux/filter.h kernel/bpf/core.c +2 more+267 -110 replies
4/4selftests/bpf: Adds selftests to check termination of long running nested bpf loopstools/testing/selftests/bpf/prog_tests/bpf_termination.c tools/testing/selftests/bpf/progs/bpf_termination.c+77 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [RFC bpf-next v2 0/4] bpf: Fast-Path approach for BPF program

This is RFC v2 of

	https://lore.kernel.org/bpf/[email protected]/

Change since v1:
- 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.

TODO:
- Termination support for tailcall programs.
- Fix issue caused by warning in runtime termination handler due to
https://elixir.bootlin.com/linux/v6.15.1/source/kernel/smp.c#L815
- Free memory for patch progs related fields.
- Include selftests covering more cases such as BPF program nesting.

 include/linux/bpf.h                           |  19 +-
 include/linux/bpf_verifier.h                  |   4 +
 include/linux/filter.h                        |  43 ++-
 kernel/bpf/core.c                             |  64 +++++
 kernel/bpf/syscall.c                          | 225 ++++++++++++++++
 kernel/bpf/trampoline.c                       |   5 +
 kernel/bpf/verifier.c                         | 245 +++++++++++++++++-
 .../bpf/prog_tests/bpf_termination.c          |  39 +++
 .../selftests/bpf/progs/bpf_termination.c     |  38 +++
 9 files changed, 674 insertions(+), 8 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