linux-stable/tools/testing/selftests/bpf/benchs
Andrii Nakryiko ff943683f8 selftests/bpf: fix uprobe offset calculation in selftests
Fix how selftests determine relative offset of a function that is
uprobed. Previously, there was an assumption that uprobed function is
always in the first executable region, which is not always the case
(libbpf CI hits this case now). So get_base_addr() approach in isolation
doesn't work anymore. So teach get_uprobe_offset() to determine correct
memory mapping and calculate uprobe offset correctly.

While at it, I merged together two implementations of
get_uprobe_offset() helper, moving powerpc64-specific logic inside (had
to add extra {} block to avoid unused variable error for insn).

Also ensured that uprobed functions are never inlined, but are still
static (and thus local to each selftest), by using a no-op asm volatile
block internally. I didn't want to keep them global __weak, because some
tests use uprobe's ref counter offset (to test USDT-like logic) which is
not compatible with non-refcounted uprobe. So it's nicer to have each
test uprobe target local to the file and guaranteed to not be inlined or
skipped by the compiler (which can happen with static functions,
especially if compiling selftests with -O2).

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20220126193058.3390292-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2022-01-26 20:04:01 -08:00
..
bench_bloom_filter_map.c selftests/bpf: Fix a tautological-constant-out-of-range-compare compiler warning 2021-11-12 14:11:46 -08:00
bench_bpf_loop.c selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00
bench_count.c selftests/bpf: Fix checkpatch error on empty function parameter 2021-12-11 17:40:23 -08:00
bench_rename.c selftests/bpf: Fix checkpatch error on empty function parameter 2021-12-11 17:40:23 -08:00
bench_ringbufs.c selftests/bpf: use preferred setter/getter APIs instead of deprecated ones 2022-01-25 17:59:07 -08:00
bench_strncmp.c selftests/bpf: Add benchmark for bpf_strncmp() helper 2021-12-11 17:40:23 -08:00
bench_trigger.c selftests/bpf: fix uprobe offset calculation in selftests 2022-01-26 20:04:01 -08:00
run_bench_bloom_filter_map.sh
run_bench_bpf_loop.sh selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00
run_bench_rename.sh
run_bench_ringbufs.sh
run_bench_strncmp.sh selftests/bpf: Add benchmark for bpf_strncmp() helper 2021-12-11 17:40:23 -08:00
run_bench_trigger.sh
run_common.sh selftest/bpf/benchs: Add bpf_loop benchmark 2021-11-30 10:56:28 -08:00