aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
diff options
context:
space:
mode:
authorSong Liu <[email protected]>2023-04-12 21:04:21 +0000
committerDaniel Borkmann <[email protected]>2023-04-13 12:32:04 +0000
commitde6d014a09bf12a9a8959d60c0a1d4a41d394a89 (patch)
tree3c6c5aadb6209a77bc78dd07b27f1b676682fc82 /tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
parentselftests/bpf: Fix use of uninitialized op_name in log tests (diff)
downloadkernel-de6d014a09bf12a9a8959d60c0a1d4a41d394a89.tar.gz
kernel-de6d014a09bf12a9a8959d60c0a1d4a41d394a89.zip
selftests/bpf: Use read_perf_max_sample_freq() in perf_event_stackmap
Currently, perf_event sample period in perf_event_stackmap is set too low that the test fails randomly. Fix this by using the max sample frequency, from read_perf_max_sample_freq(). Move read_perf_max_sample_freq() to testing_helpers.c. Replace the CHECK() with if-printf, as CHECK is not available in testing_helpers.c. Fixes: 1da4864c2b20 ("selftests/bpf: Add callchain_stackid") Signed-off-by: Song Liu <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c')
-rw-r--r--tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c b/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
index 33144c9432ae..f4aad35afae1 100644
--- a/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
+++ b/tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
@@ -63,7 +63,8 @@ void test_perf_event_stackmap(void)
PERF_SAMPLE_BRANCH_NO_FLAGS |
PERF_SAMPLE_BRANCH_NO_CYCLES |
PERF_SAMPLE_BRANCH_CALL_STACK,
- .sample_period = 5000,
+ .freq = 1,
+ .sample_freq = read_perf_max_sample_freq(),
.size = sizeof(struct perf_event_attr),
};
struct perf_event_stackmap *skel;