[PATCH 0/4] bpf: Fast-Path approach for BPF program termination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is RFC v3 of
	https://lore.kernel.org/all/20250614064056.237005-1-sidchintamaneni@xxxxxxxxx/

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

-- 
2.43.0





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux