samples/bpf: Remove obsolete tracing-related tests
Subsystems (5)
cover samples/bpf: Remove obsolete tracing-related tests
The BPF tracing infrastructure has undergone significant evolution, leading to the introduction of more robust and efficient APIs. However, some of the existing tests in the samples/bpf directory have not kept pace with these developments. These outdated tests not only create confusion among users but also increase maintenance overhead.
For starter, this patchset focuses on cleaning up outdated 'tracing' related tests within the BPF testing framework. The goal is to modernize and streamline selftests by removing obsolete tests and migrating necessaries to more appropriate locations.
Daniel T. Lee (3):
selftests/bpf: migrate tracepoint overhead test to prog_tests selftests/bpf: add rename tracepoint bench test samples/bpf: remove obsolete tracing related tests
samples/bpf/Makefile | 12 - samples/bpf/test_overhead_kprobe.bpf.c | 41 ---- samples/bpf/test_overhead_raw_tp.bpf.c | 17 -- samples/bpf/test_overhead_tp.bpf.c | 23 -- samples/bpf/test_overhead_user.c | 225 ------------------ samples/bpf/test_override_return.sh | 16 -- samples/bpf/test_probe_write_user.bpf.c | 52 ---- samples/bpf/test_probe_write_user_user.c | 108 --------- samples/bpf/tracex7.bpf.c | 15 -- samples/bpf/tracex7_user.c | 56 ----- tools/testing/selftests/bpf/bench.c | 2 + .../selftests/bpf/benchs/bench_rename.c | 16 ++ .../selftests/bpf/benchs/run_bench_rename.sh | 2 +- .../selftests/bpf/prog_tests/test_overhead.c | 14 +- .../selftests/bpf/progs/test_overhead.c | 11 +- 15 files changed, 39 insertions(+), 571 deletions(-) delete mode 100644 samples/bpf/test_overhead_kprobe.bpf.c delete mode 100644 samples/bpf/test_overhead_raw_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_user.c delete mode 100755 samples/bpf/test_override_return.sh delete mode 100644 samples/bpf/test_probe_write_user.bpf.c delete mode 100644 samples/bpf/test_probe_write_user_user.c delete mode 100644 samples/bpf/tracex7.bpf.c delete mode 100644 samples/bpf/tracex7_user.c
Signature · 1 line
2.43.0
PATCH 1/3 selftests/bpf: migrate tracepoint overhead test to prog_tests
As part of the cleanup of outdated test cases in sample/bpf, this commit migrates test for tracepoint overhead to selftest prog_tests.
The test_overhead in selftest/bpf focus on the 'raw_tracepoint' only, and do not cover tracepoint-specific tests. To support this, this commit utilize 'vmlinux.h', and additional test program for tracepoint has been added.
--- .../selftests/bpf/prog_tests/test_overhead.c | 14 +++++++++++++- tools/testing/selftests/bpf/progs/test_overhead.c | 11 +++++++---- 2 files changed, 20 insertions(+), 5 deletions(-)
tools/testing/selftests/bpf/prog_tests/test_overhead.c +13 -1
@@ -61,9 +61,10 @@ void test_test_overhead(void)const char *raw_tp_name ="prog3" ;const char *fentry_name ="prog4" ;const char *fexit_name ="prog5" ; +const char *tp_name ="prog6" ;const char *kprobe_func ="__set_task_comm" ;struct bpf_program *kprobe_prog, *kretprobe_prog, *raw_tp_prog; -struct bpf_program *fentry_prog, *fexit_prog; +struct bpf_program *fentry_prog, *fexit_prog, *tp_prog;struct bpf_object *obj;struct bpf_link *link;int err, duration =0 ;
@@ -96,6 +97,10 @@ void test_test_overhead(void)if (CHECK (!fexit_prog,"find_probe" ,"prog '%s' not found\n" , fexit_name)) goto cleanup; + tp_prog =bpf_object__find_program_by_name (obj, tp_name); +if (CHECK (!tp_prog,"find_probe" , +"prog '%s' not found\n" , tp_name)) + goto cleanup; err =bpf_object__load (obj);if (CHECK (err,"obj_load" ,"err %d\n" , err)) goto cleanup;
@@ -142,6 +147,13 @@ void test_test_overhead(void)test_run ("fexit" );bpf_link__destroy (link); +/* attach tp */ + link =bpf_program__attach_tracepoint (tp_prog,"task" ,"task_rename" ); +if (!ASSERT_OK_PTR (link,"attach_tp" )) + goto cleanup; +test_run ("tp" ); +bpf_link__destroy (link); + cleanup:prctl (PR_SET_NAME , comm,0L ,0L ,0L );bpf_object__close (obj);
tools/testing/selftests/bpf/progs/test_overhead.c +7 -4
@@ -1,9 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ -#include <stdbool.h> -#include <stddef.h> -#include <linux/bpf.h> -#include <linux/ptrace.h> +#include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h>
@@ -39,4 +36,10 @@ int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)return 0 ; } +SEC("tracepoint/task/task_rename") +int prog6 (struct trace_event_raw_task_rename *ctx) +{ +return 0 ; +} + char _license[] SEC("license") = "GPL";
Signature · 1 line
2.43.0
Re: [bpf-next 1/3] selftests/bpf: migrate tracepoint overhead test to prog_tests
Quoted 9 lines · Daniel T. Lee
As part of the cleanup of outdated test cases in sample/bpf, this commit migrates test for tracepoint overhead to selftest
prog_tests.The
test_overheadin selftest/bpf focus on the 'raw_tracepoint' only, and do not cover tracepoint-specific tests. To support this, this commit utilize 'vmlinux.h', and additional test program for tracepoint has been added.Signed-off-by Daniel T. Lee <[email protected]>
sure, let's have it complete
jirka
Quoted 75 lines
--- .../selftests/bpf/prog_tests/test_overhead.c | 14 +++++++++++++- tools/testing/selftests/bpf/progs/test_overhead.c | 11 +++++++---- 2 files changed, 20 insertions(+), 5 deletions(-)tools/testing/selftests/bpf/prog_tests/test_overhead.c +13
-1@@ -61,9 +61,10 @@ void test_test_overhead(void)const char *raw_tp_name ="prog3" ;const char *fentry_name ="prog4" ;const char *fexit_name ="prog5" ; +const char *tp_name ="prog6" ;const char *kprobe_func ="__set_task_comm" ;struct bpf_program *kprobe_prog, *kretprobe_prog, *raw_tp_prog; -struct bpf_program *fentry_prog, *fexit_prog; +struct bpf_program *fentry_prog, *fexit_prog, *tp_prog;struct bpf_object *obj;struct bpf_link *link;int err, duration =0 ;@@ -96,6 +97,10 @@ void test_test_overhead(void)if (CHECK (!fexit_prog,"find_probe" ,"prog '%s' not found\n" , fexit_name)) goto cleanup; + tp_prog =bpf_object__find_program_by_name (obj, tp_name); +if (CHECK (!tp_prog,"find_probe" , +"prog '%s' not found\n" , tp_name)) + goto cleanup; err =bpf_object__load (obj);if (CHECK (err,"obj_load" ,"err %d\n" , err)) goto cleanup;@@ -142,6 +147,13 @@ void test_test_overhead(void)test_run ("fexit" );bpf_link__destroy (link); +/* attach tp */ + link =bpf_program__attach_tracepoint (tp_prog,"task" ,"task_rename" ); +if (!ASSERT_OK_PTR (link,"attach_tp" )) + goto cleanup; +test_run ("tp" ); +bpf_link__destroy (link); + cleanup:prctl (PR_SET_NAME , comm,0L ,0L ,0L );bpf_object__close (obj);tools/testing/selftests/bpf/progs/test_overhead.c +7
-4@@ -1,9 +1,6 @@// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2019 Facebook */ -#include <stdbool.h> -#include <stddef.h> -#include <linux/bpf.h> -#include <linux/ptrace.h> +#include "vmlinux.h" #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> @@ -39,4 +36,10 @@ int BPF_PROG(prog5, struct task_struct *tsk, const char *buf, bool exec)return 0 ; } +SEC("tracepoint/task/task_rename") +int prog6 (struct trace_event_raw_task_rename *ctx) +{ +return 0 ; +} + char _license[] SEC("license") = "GPL";Signature · 1 line
2.43.0
PATCH 2/3 selftests/bpf: add rename tracepoint bench test
In reply to Daniel T. LeeIn addition to migrating the tracepoint overhead test from sample/bpf to selftest/bpf, this commit extends benchmarking test with rename task.
Since previous commit migrated tracepoint based on rename task, this commit updates the benchmarking program to utilize the newly added 'rename-tp'.
--- tools/testing/selftests/bpf/bench.c | 2 ++ .../testing/selftests/bpf/benchs/bench_rename.c | 16 ++++++++++++++++ .../selftests/bpf/benchs/run_bench_rename.sh | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/bench.c +2 -0
@@ -495,6 +495,7 @@ extern const struct bench bench_rename_kretprobe;extern const struct bench bench_rename_rawtp;extern const struct bench bench_rename_fentry;extern const struct bench bench_rename_fexit; +extern const struct bench bench_rename_tp;/* pure counting benchmarks to establish theoretical lmits */ extern const struct bench bench_trig_usermode_count;
@@ -552,6 +553,7 @@ static const struct bench *benchs[] = { &bench_rename_rawtp, &bench_rename_fentry, &bench_rename_fexit, + &bench_rename_tp,/* pure counting benchmarks for establishing theoretical limits */ &bench_trig_usermode_count, &bench_trig_kernel_count,
tools/testing/selftests/bpf/benchs/bench_rename.c +16 -0
@@ -106,6 +106,12 @@ static void setup_fexit(void)attach_bpf (ctx.skel->progs.prog5); } +static void setup_tp (void ) +{ +setup_ctx (); +attach_bpf (ctx.skel->progs.prog6); +} +const struct bench bench_rename_base = { .name ="rename-base" , .validate = validate,
@@ -136,6 +142,16 @@ const struct bench bench_rename_kretprobe = { .report_final = hits_drops_report_final, }; +const struct bench bench_rename_tp = { + .name ="rename-tp" , + .validate = validate, + .setup = setup_tp, + .producer_thread = producer, + .measure = measure, + .report_progress = hits_drops_report_progress, + .report_final = hits_drops_report_final, +}; +const struct bench bench_rename_rawtp = { .name ="rename-rawtp" , .validate = validate,
tools/testing/selftests/bpf/benchs/run_bench_rename.sh +1 -1
@@ -2,7 +2,7 @@ set -eufo pipefail -for i in base kprobe kretprobe rawtp fentry fexit +for i in base kprobe kretprobe rawtp fentry fexit tp do summary=$(sudo ./bench -w2 -d5 -a rename-$i | tail -n1 | cut -d'(' -f1 | cut -d' ' -f3-) printf "%-10s: %s\n" $i "$summary"
Signature · 1 line
2.43.0
Re: [bpf-next 2/3] selftests/bpf: add rename tracepoint bench test
Quoted 9 lines · Daniel T. Lee
In addition to migrating the tracepoint overhead test from sample/bpf to selftest/bpf, this commit extends benchmarking test with rename task.
Since previous commit migrated tracepoint based on rename task, this commit updates the benchmarking program to utilize the newly added 'rename-tp'.
Signed-off-by Daniel T. Lee <[email protected]>
jirka
Quoted 76 lines
--- tools/testing/selftests/bpf/bench.c | 2 ++ .../testing/selftests/bpf/benchs/bench_rename.c | 16 ++++++++++++++++ .../selftests/bpf/benchs/run_bench_rename.sh | 2 +- 3 files changed, 19 insertions(+), 1 deletion(-)tools/testing/selftests/bpf/bench.c +2
-0@@ -495,6 +495,7 @@ extern const struct bench bench_rename_kretprobe;extern const struct bench bench_rename_rawtp;extern const struct bench bench_rename_fentry;extern const struct bench bench_rename_fexit; +extern const struct bench bench_rename_tp;/* pure counting benchmarks to establish theoretical lmits */ extern const struct bench bench_trig_usermode_count;@@ -552,6 +553,7 @@ static const struct bench *benchs[] = { &bench_rename_rawtp, &bench_rename_fentry, &bench_rename_fexit, + &bench_rename_tp,/* pure counting benchmarks for establishing theoretical limits */ &bench_trig_usermode_count, &bench_trig_kernel_count,tools/testing/selftests/bpf/benchs/bench_rename.c +16
-0@@ -106,6 +106,12 @@ static void setup_fexit(void)attach_bpf (ctx.skel->progs.prog5); } +static void setup_tp (void ) +{ +setup_ctx (); +attach_bpf (ctx.skel->progs.prog6); +} +const struct bench bench_rename_base = { .name ="rename-base" , .validate = validate,@@ -136,6 +142,16 @@ const struct bench bench_rename_kretprobe = { .report_final = hits_drops_report_final, }; +const struct bench bench_rename_tp = { + .name ="rename-tp" , + .validate = validate, + .setup = setup_tp, + .producer_thread = producer, + .measure = measure, + .report_progress = hits_drops_report_progress, + .report_final = hits_drops_report_final, +}; +const struct bench bench_rename_rawtp = { .name ="rename-rawtp" , .validate = validate,tools/testing/selftests/bpf/benchs/run_bench_rename.sh +1
-1@@ -2,7 +2,7 @@ set -eufo pipefail -for i in base kprobe kretprobe rawtp fentry fexit +for i in base kprobe kretprobe rawtp fentry fexit tp do summary=$(sudo ./bench -w2 -d5 -a rename-$i | tail -n1 | cut -d'(' -f1 | cut -d' ' -f3-) printf "%-10s: %s\n" $i "$summary"Signature · 1 line
2.43.0
PATCH 3/3 samples/bpf: remove obsolete tracing related tests
In reply to Daniel T. LeeThe samples/bpf has become outdated and often does not follow up with the latest. This commit removes obsolete tracing-related tests.
Specifically, 'test_overhead' is migrated from previous two commits, and 'test_override_return', 'test_probe_write_user' tests are obsolete since they have been replaced by kprobe_multi_override and probe_user from selftests/bpf respectively.
This cleanup will help to streamline the testing framework by removing redundant tests.
--- samples/bpf/Makefile | 12 -- samples/bpf/test_overhead_kprobe.bpf.c | 41 ----- samples/bpf/test_overhead_raw_tp.bpf.c | 17 -- samples/bpf/test_overhead_tp.bpf.c | 23 --- samples/bpf/test_overhead_user.c | 225 ----------------------- samples/bpf/test_override_return.sh | 16 -- samples/bpf/test_probe_write_user.bpf.c | 52 ------ samples/bpf/test_probe_write_user_user.c | 108 ----------- samples/bpf/tracex7.bpf.c | 15 -- samples/bpf/tracex7_user.c | 56 ------ 10 files changed, 565 deletions(-) delete mode 100644 samples/bpf/test_overhead_kprobe.bpf.c delete mode 100644 samples/bpf/test_overhead_raw_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_user.c delete mode 100755 samples/bpf/test_override_return.sh delete mode 100644 samples/bpf/test_probe_write_user.bpf.c delete mode 100644 samples/bpf/test_probe_write_user_user.c delete mode 100644 samples/bpf/tracex7.bpf.c delete mode 100644 samples/bpf/tracex7_user.c
samples/bpf/Makefile +0 -12
@@ -18,14 +18,11 @@ tprogs-y += tracex3 tprogs-y += tracex4 tprogs-y += tracex5 tprogs-y += tracex6 -tprogs-y += tracex7 -tprogs-y += test_probe_write_user tprogs-y += trace_output tprogs-y += lathist tprogs-y += offwaketime tprogs-y += spintest tprogs-y += map_perf_test -tprogs-y += test_overhead tprogs-y += test_cgrp2_array_pin tprogs-y += test_cgrp2_attach tprogs-y += test_cgrp2_sock
@@ -68,14 +65,11 @@ tracex3-objs := tracex3_user.o tracex4-objs := tracex4_user.o tracex5-objs := tracex5_user.o $(TRACE_HELPERS) tracex6-objs := tracex6_user.o -tracex7-objs := tracex7_user.o -test_probe_write_user-objs := test_probe_write_user_user.o trace_output-objs := trace_output_user.o lathist-objs := lathist_user.o offwaketime-objs := offwaketime_user.o $(TRACE_HELPERS) spintest-objs := spintest_user.o $(TRACE_HELPERS) map_perf_test-objs := map_perf_test_user.o -test_overhead-objs := test_overhead_user.o test_cgrp2_array_pin-objs := test_cgrp2_array_pin.o test_cgrp2_attach-objs := test_cgrp2_attach.o test_cgrp2_sock-objs := test_cgrp2_sock.o
@@ -110,9 +104,7 @@ always-y += tracex3.bpf.o always-y += tracex4.bpf.o always-y += tracex5.bpf.o always-y += tracex6.bpf.o -always-y += tracex7.bpf.o always-y += sock_flags.bpf.o -always-y += test_probe_write_user.bpf.o always-y += trace_output.bpf.o always-y += tcbpf1_kern.o always-y += tc_l2_redirect_kern.o
@@ -120,9 +112,6 @@ always-y += lathist_kern.o always-y += offwaketime.bpf.o always-y += spintest.bpf.o always-y += map_perf_test.bpf.o -always-y += test_overhead_tp.bpf.o -always-y += test_overhead_raw_tp.bpf.o -always-y += test_overhead_kprobe.bpf.o always-y += parse_varlen.o parse_simple.o parse_ldabs.o always-y += test_cgrp2_tc.bpf.o always-y += test_current_task_under_cgroup.bpf.o
@@ -194,7 +183,6 @@ TPROGLDLIBS_xdp_router_ipv4 += -lm -pthread TPROGLDLIBS_tracex4 += -lrt TPROGLDLIBS_trace_output += -lrt TPROGLDLIBS_map_perf_test += -lrt -TPROGLDLIBS_test_overhead += -lrt # Allows pointing LLC/CLANG to a LLVM backend with bpf support, redefine on cmdline: # make M=samples/bpf LLC=~/git/llvm-project/llvm/build/bin/llc CLANG=~/git/llvm-project/llvm/build/bin/clang
samples/bpf/test_overhead_kprobe.bpf.c deleted +0 -41
41 lines not on this page · raw message
samples/bpf/test_overhead_raw_tp.bpf.c deleted +0 -17
@@ -1,17 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* Copyright (c) 2018 Facebook */ -#include "vmlinux.h" -#include <bpf/bpf_helpers.h> - -SEC("raw_tracepoint/task_rename") -int prog (struct bpf_raw_tracepoint_args *ctx) -{ -return 0 ; -} - -SEC("raw_tracepoint/fib_table_lookup") -int prog2 (struct bpf_raw_tracepoint_args *ctx) -{ -return 0 ; -} -char _license[] SEC("license") = "GPL";
samples/bpf/test_overhead_tp.bpf.c deleted +0 -23
@@ -1,23 +0,0 @@ -/* Copyright (c) 2016 Facebook -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of version 2 of the GNU General Public -* License as published by the Free Software Foundation. -*/ -#include "vmlinux.h" -#include <bpf/bpf_helpers.h> - -/* from /sys/kernel/tracing/events/task/task_rename/format */ -SEC("tracepoint/task/task_rename") -int prog (struct trace_event_raw_task_rename *ctx) -{ -return 0 ; -} - -/* from /sys/kernel/tracing/events/fib/fib_table_lookup/format */ -SEC("tracepoint/fib/fib_table_lookup") -int prog2 (struct trace_event_raw_fib_table_lookup *ctx) -{ -return 0 ; -} -char _license[] SEC("license") = "GPL";
samples/bpf/test_overhead_user.c deleted +0 -225
225 lines not on this page · raw message
samples/bpf/test_override_return.sh deleted +0 -16
@@ -1,16 +0,0 @@ -#!/bin/bash - -rm -r tmpmnt -rm -f testfile.img -dd if=/dev/zero of=testfile.img bs=1M seek=1000 count=1 -DEVICE=$(losetup --show -f testfile.img) -mkfs.btrfs -f $DEVICE -mkdir tmpmnt -./tracex7 $DEVICE -if [ $? -eq 0 ] -then - echo "SUCCESS!" -else - echo "FAILED!" -fi -losetup -d $DEVICE
samples/bpf/test_probe_write_user.bpf.c deleted +0 -52
52 lines not on this page · raw message
samples/bpf/test_probe_write_user_user.c deleted +0 -108
108 lines not on this page · raw message
samples/bpf/tracex7.bpf.c deleted +0 -15
@@ -1,15 +0,0 @@ -#include "vmlinux.h" -#include <linux/version.h> -#include <bpf/bpf_helpers.h> - -SEC("kprobe/open_ctree") -int bpf_prog1 (struct pt_regs *ctx) -{ -unsigned long rc =-12 ; - -bpf_override_return (ctx, rc); -return 0 ; -} - -char _license[] SEC("license") = "GPL"; -u32 _version SEC("version") = LINUX_VERSION_CODE;
samples/bpf/tracex7_user.c deleted +0 -56
56 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 12 lines · Daniel T. Lee
The BPF tracing infrastructure has undergone significant evolution, leading to the introduction of more robust and efficient APIs. However, some of the existing tests in the
samples/bpfdirectory have not kept pace with these developments. These outdated tests not only create confusion among users but also increase maintenance overhead.For starter, this patchset focuses on cleaning up outdated 'tracing' related tests within the BPF testing framework. The goal is to modernize and streamline selftests by removing obsolete tests and migrating necessaries to more appropriate locations.
Quoted 5 lines
Daniel T. Lee (3):
selftests/bpf: migrate tracepoint overhead test toprog_testsselftests/bpf: add rename tracepoint bench testsamples/bpf: remove obsolete tracing related tests
We already have tracepoint-specific benchmark (see benchs/bench_trigger.c), try ./bench trig-tp (it will pretty recent kernel due to reliance on bpf_modify_return_test_tp() kfunc).
So maybe instead of adding code to selftests, let's just remove it from both samples/bpf and prog_tests' test_overhead? Either way test_overhead isn't very representative anymore, given big chunk of its overhead is in write() syscall?
Quoted 29 lines
samples/bpf/Makefile | 12 - samples/bpf/test_overhead_kprobe.bpf.c | 41 ---- samples/bpf/test_overhead_raw_tp.bpf.c | 17 -- samples/bpf/test_overhead_tp.bpf.c | 23 -- samples/bpf/test_overhead_user.c | 225 ------------------ samples/bpf/test_override_return.sh | 16 -- samples/bpf/test_probe_write_user.bpf.c | 52 ---- samples/bpf/test_probe_write_user_user.c | 108 --------- samples/bpf/tracex7.bpf.c | 15 -- samples/bpf/tracex7_user.c | 56 ----- tools/testing/selftests/bpf/bench.c | 2 + .../selftests/bpf/benchs/bench_rename.c | 16 ++ .../selftests/bpf/benchs/run_bench_rename.sh | 2 +- .../selftests/bpf/prog_tests/test_overhead.c | 14 +- .../selftests/bpf/progs/test_overhead.c | 11 +- 15 files changed, 39 insertions(+), 571 deletions(-) delete mode 100644 samples/bpf/test_overhead_kprobe.bpf.c delete mode 100644 samples/bpf/test_overhead_raw_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_user.c delete mode 100755 samples/bpf/test_override_return.sh delete mode 100644 samples/bpf/test_probe_write_user.bpf.c delete mode 100644 samples/bpf/test_probe_write_user_user.c delete mode 100644 samples/bpf/tracex7.bpf.c delete mode 100644 samples/bpf/tracex7_user.c--
2.43.0
Quoted 20 lines · Andrii Nakryiko
Quoted 12 lines · Daniel T. Lee
The BPF tracing infrastructure has undergone significant evolution, leading to the introduction of more robust and efficient APIs. However, some of the existing tests in the
samples/bpfdirectory have not kept pace with these developments. These outdated tests not only create confusion among users but also increase maintenance overhead.For starter, this patchset focuses on cleaning up outdated 'tracing' related tests within the BPF testing framework. The goal is to modernize and streamline selftests by removing obsolete tests and migrating necessaries to more appropriate locations.
Quoted 5 lines
Daniel T. Lee (3):
selftests/bpf: migrate tracepoint overhead test toprog_testsselftests/bpf: add rename tracepoint bench testsamples/bpf: remove obsolete tracing related tests
Quoted 9 lines
We already have tracepoint-specific benchmark (see
benchs/bench_trigger.c), try./bench trig-tp(it will pretty recent kernel due to reliance onbpf_modify_return_test_tp()kfunc).So maybe instead of adding code to selftests, let's just remove it from both
samples/bpfandprog_tests'test_overhead? Either waytest_overheadisn't very representative anymore, given big chunk of its overhead is inwrite()syscall?
Thanks for the insight!
I'll just drop these two and resend them.
Quoted 29 lines
Quoted 29 lines
samples/bpf/Makefile | 12 - samples/bpf/test_overhead_kprobe.bpf.c | 41 ---- samples/bpf/test_overhead_raw_tp.bpf.c | 17 -- samples/bpf/test_overhead_tp.bpf.c | 23 -- samples/bpf/test_overhead_user.c | 225 ------------------ samples/bpf/test_override_return.sh | 16 -- samples/bpf/test_probe_write_user.bpf.c | 52 ---- samples/bpf/test_probe_write_user_user.c | 108 --------- samples/bpf/tracex7.bpf.c | 15 -- samples/bpf/tracex7_user.c | 56 ----- tools/testing/selftests/bpf/bench.c | 2 + .../selftests/bpf/benchs/bench_rename.c | 16 ++ .../selftests/bpf/benchs/run_bench_rename.sh | 2 +- .../selftests/bpf/prog_tests/test_overhead.c | 14 +- .../selftests/bpf/progs/test_overhead.c | 11 +- 15 files changed, 39 insertions(+), 571 deletions(-) delete mode 100644 samples/bpf/test_overhead_kprobe.bpf.c delete mode 100644 samples/bpf/test_overhead_raw_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_tp.bpf.c delete mode 100644 samples/bpf/test_overhead_user.c delete mode 100755 samples/bpf/test_override_return.sh delete mode 100644 samples/bpf/test_probe_write_user.bpf.c delete mode 100644 samples/bpf/test_probe_write_user_user.c delete mode 100644 samples/bpf/tracex7.bpf.c delete mode 100644 samples/bpf/tracex7_user.c--
2.43.0
Signature · 2 lines
Best, Daniel T. Lee