Add generic benchmark runner framework which simplifies writing various performance benchmarks in a consistent fashion. This framework will be used in follow up patches to test performance of perf buffer and ring buffer as well. Patch #1 extracts parse_num_list to be re-used between test_progs and bench. Patch #2 adds generic runner implementation and atomic counter benchmarks to validate benchmark runner's behavior. Patch #3 implements test_overhead benchmark as part of bench runner. It also add fmod_ret BPF program type to a set of benchmarks. Patch #4 tests faster alternatives to set_task_comm() approach, tested in test_overhead, in search for minimal-overhead way to trigger BPF program execution from user-space on demand. v2->v3: - added --prod-affinity and --cons-affinity (Yonghong); - removed ringbuf-related options leftovers (Yonghong); - added more benchmarking results for test_overhead performance discrepancies; v1->v2: - moved benchmarks into benchs/ subdir (John); - added benchmark "suite" scripts (John); - few small clean ups, change defaults, etc. Andrii Nakryiko (4): selftests/bpf: extract parse_num_list into generic testing_helpers.c selftests/bpf: add benchmark runner infrastructure selftest/bpf: fmod_ret prog and implement test_overhead as part of bench selftest/bpf: add BPF triggering benchmark tools/testing/selftests/bpf/.gitignore | 1 + tools/testing/selftests/bpf/Makefile | 20 +- tools/testing/selftests/bpf/bench.c | 449 ++++++++++++++++++ tools/testing/selftests/bpf/bench.h | 81 ++++ .../selftests/bpf/benchs/bench_count.c | 91 ++++ .../selftests/bpf/benchs/bench_rename.c | 195 ++++++++ .../selftests/bpf/benchs/bench_trigger.c | 167 +++++++ .../selftests/bpf/benchs/run_bench_rename.sh | 9 + .../selftests/bpf/benchs/run_bench_trigger.sh | 9 + .../selftests/bpf/prog_tests/test_overhead.c | 14 +- .../selftests/bpf/progs/test_overhead.c | 6 + .../selftests/bpf/progs/trigger_bench.c | 47 ++ tools/testing/selftests/bpf/test_progs.c | 67 +-- tools/testing/selftests/bpf/test_progs.h | 1 + tools/testing/selftests/bpf/testing_helpers.c | 66 +++ tools/testing/selftests/bpf/testing_helpers.h | 5 + 16 files changed, 1162 insertions(+), 66 deletions(-) create mode 100644 tools/testing/selftests/bpf/bench.c create mode 100644 tools/testing/selftests/bpf/bench.h create mode 100644 tools/testing/selftests/bpf/benchs/bench_count.c create mode 100644 tools/testing/selftests/bpf/benchs/bench_rename.c create mode 100644 tools/testing/selftests/bpf/benchs/bench_trigger.c create mode 100755 tools/testing/selftests/bpf/benchs/run_bench_rename.sh create mode 100755 tools/testing/selftests/bpf/benchs/run_bench_trigger.sh create mode 100644 tools/testing/selftests/bpf/progs/trigger_bench.c create mode 100644 tools/testing/selftests/bpf/testing_helpers.c create mode 100644 tools/testing/selftests/bpf/testing_helpers.h -- 2.24.1