mbox series

[v2,bpf-next,0/6] bench: fast in-kernel triggering benchmarks

Message ID 20240326162151.3981687-1-andrii@kernel.org (mailing list archive)
Headers show
Series bench: fast in-kernel triggering benchmarks | expand

Message

Andrii Nakryiko March 26, 2024, 4:21 p.m. UTC
Remove "legacy" triggering benchmarks which rely on syscalls (and thus syscall
overhead is a noticeable part of benchmark, unfortunately). Replace them with
faster versions that rely on triggering BPF programs in-kernel through another
simple "driver" BPF program. See patch #2 with comparison results.

raw_tp/tp/fmodret benchmarks required adding a simple kfunc in kernel to be
able to trigger a simple tracepoint from BPF program (plus it is also allowed
to be replaced by fmod_ret programs). This limits raw_tp/tp/fmodret benchmarks
to new kernels only, but it keeps bench tool itself very portable and most of
other benchmarks will still work on wide variety of kernels without the need
to worry about building and deploying custom kernel module. See patches #5
and #6 for details.

v1->v2:
  - move new TP closer to BPF test run code;
  - rename/move kfunc and register it for fmod_rets (Alexei);
  - limit --trig-batch-iters param to [1, 1000] (Alexei).

Andrii Nakryiko (6):
  selftests/bpf: rename and clean up userspace-triggered benchmarks
  selftests/bpf: add batched, mostly in-kernel BPF triggering benchmarks
  selftests/bpf: remove syscall-driven benchs, keep syscall-count only
  selftests/bpf: lazy-load trigger bench BPF programs
  bpf: add bpf_modify_return_test_tp() kfunc triggering tracepoint
  selftests/bpf: add batched tp/raw_tp/fmodret tests

 include/trace/events/bpf_test_run.h           |  17 +
 kernel/bpf/helpers.c                          |   1 +
 net/bpf/test_run.c                            |   8 +
 tools/testing/selftests/bpf/bench.c           |  33 +-
 .../selftests/bpf/benchs/bench_trigger.c      | 391 +++++++++---------
 .../selftests/bpf/benchs/run_bench_trigger.sh |  22 +-
 .../selftests/bpf/benchs/run_bench_uprobes.sh |   2 +-
 .../selftests/bpf/progs/trigger_bench.c       |  68 ++-
 8 files changed, 314 insertions(+), 228 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 27, 2024, 10:10 p.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Tue, 26 Mar 2024 09:21:45 -0700 you wrote:
> Remove "legacy" triggering benchmarks which rely on syscalls (and thus syscall
> overhead is a noticeable part of benchmark, unfortunately). Replace them with
> faster versions that rely on triggering BPF programs in-kernel through another
> simple "driver" BPF program. See patch #2 with comparison results.
> 
> raw_tp/tp/fmodret benchmarks required adding a simple kfunc in kernel to be
> able to trigger a simple tracepoint from BPF program (plus it is also allowed
> to be replaced by fmod_ret programs). This limits raw_tp/tp/fmodret benchmarks
> to new kernels only, but it keeps bench tool itself very portable and most of
> other benchmarks will still work on wide variety of kernels without the need
> to worry about building and deploying custom kernel module. See patches #5
> and #6 for details.
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next,1/6] selftests/bpf: rename and clean up userspace-triggered benchmarks
    https://git.kernel.org/bpf/bpf-next/c/8f54386ea7ec
  - [v2,bpf-next,2/6] selftests/bpf: add batched, mostly in-kernel BPF triggering benchmarks
    https://git.kernel.org/bpf/bpf-next/c/e6c97e34ad7e
  - [v2,bpf-next,3/6] selftests/bpf: remove syscall-driven benchs, keep syscall-count only
    https://git.kernel.org/bpf/bpf-next/c/850860ee6712
  - [v2,bpf-next,4/6] selftests/bpf: lazy-load trigger bench BPF programs
    https://git.kernel.org/bpf/bpf-next/c/f328a70ab28b
  - [v2,bpf-next,5/6] bpf: add bpf_modify_return_test_tp() kfunc triggering tracepoint
    https://git.kernel.org/bpf/bpf-next/c/c55e25089eba
  - [v2,bpf-next,6/6] selftests/bpf: add batched tp/raw_tp/fmodret tests
    https://git.kernel.org/bpf/bpf-next/c/b1d5f62f825d

You are awesome, thank you!