From 11f5710d96afcd569a7c8e00395b714bbea3ce5d Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Fri, 25 Aug 2023 09:41:50 -0700 Subject: [PATCH] perf test shell record_bpf_filter: Skip 6.2 kernel The BPF sample filtering requires two kernel changes below: * bpf_cast_to_kernel_ctx() kfunc (added in v6.2) * setting perf_sample_data->sample_flags (finished in v6.3) The perf tools can check bpf_cast_to_kernel_ctx() easily so it can refuse BPF filters on those old kernels (v6.1 and earlier). But checking sample_flags appears to be difficult so current code won't work on v6.2 kernel. That's unfortunate but I don't know what's the correct way to handle it. For now, let's skip v6.2 kernels explicitly (if failed) in the test. Fixes: 9575ecdd198a50e9 ("perf test: Add perf record sample filtering test") Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Namhyung Kim Cc: Adrian Hunter Cc: Ian Rogers Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: bpf@vger.kernel.org Link: https://lore.kernel.org/r/20230825164152.165610-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/shell/record_bpf_filter.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/tests/shell/record_bpf_filter.sh b/tools/perf/tests/shell/record_bpf_filter.sh index e76ea86..31c5939 100755 --- a/tools/perf/tests/shell/record_bpf_filter.sh +++ b/tools/perf/tests/shell/record_bpf_filter.sh @@ -49,6 +49,12 @@ test_bpf_filter_basic() { fi if perf script -i "${perfdata}" -F ip | grep 'ffffffff[0-9a-f]*' then + if uname -r | grep -q ^6.2 + then + echo "Basic bpf-filter test [Skipped unsupported kernel]" + err=2 + return + fi echo "Basic bpf-filter test [Failed invalid output]" err=1 return -- 2.7.4