Re: [PATCH perf-tools-next v5 4/4] perf tests: Add shell test for kernel symbol beautifier
| Newsgroups | org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The test script `trace_ksym_beautifier.sh` intends to verify BTF type routing for function pointers using the `timer:hrtimer_start` tracepoint, but this tracepoint's `function` field is of type `void *`, which bypasses the BTF function pointer routing logic. The test only passes due to a hardcoded fallback for arguments named 'function'. -- --- Patch [4]: [PATCH perf-tools-next v5 4/4] perf tests: Add shell test for kernel symbol beautifier --- commit e969790d116081081634b0e3ece5c71834b3fe8f Author: Aaron Tomlin <[email protected]> perf tests: Add shell test for kernel symbol beautifier This commit introduces a shell test script to verify that perf trace properly symbolizes kernel virtual addresses and function pointers. It checks both the default kallsyms beautifier and BTF type routing. > diff --git a/tools/perf/tests/shell/trace_ksym_beautifier.sh b/tools/perf/tests/shell/trace_ksym_beautifier.sh > new file mode 100755 > index 0000000000000..45c803338d4ca > --- /dev/null > +++ b/tools/perf/tests/shell/trace_ksym_beautifier.sh [ ... ] > +test_ksym_btf() { > + echo "Testing perf trace kernel symbol beautifier (BTF)" > + if [ ! -f /sys/kernel/btf/vmlinux ]; then > + echo "Skipping BTF test due to missing vmlinux BTF" > + return > + fi > + > + output="$(perf trace -e timer:hrtimer_start --force-btf --max-events=1 -- sleep 0.01 2>&1)" [Severity: Medium] Does this test actually verify BTF type routing? For the timer:hrtimer_start tracepoint, the function field is declared as a void pointer in both BTF and tracefs. This means btf_is_func_ptr() will evaluate to false, and trace__btf_scnprintf() will return 0. The output is successfully symbolized here only because builtin-trace.c contains a hardcoded fallback array, syscall_arg_fmts__by_name, that maps any field named function to SCA_KSYM. Could a different tracepoint be used here that has an actual function pointer type in BTF, to ensure the BTF type routing logic is being properly exercised instead of the hardcoded fallback? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4