Re: [PATCH perf-tools-next v4 4/4] perf tests: Add shell test for kernel symbol beautifier

[email protected]
Newsgroups org.kernel.vger.linux-perf-users
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The test script erroneously fails on uniprocessor (UP) kernels due to a missing SMP-only tracepoint.
- [Medium] The test script can hang the test suite indefinitely on quiescent systems due to unbounded system-wide waits.
--

--- Patch [4]: [PATCH perf-tools-next v4 4/4] perf tests: Add shell test for kernel symbol beautifier ---
commit c9c4a1b0dcd918dc4702b41032200c74d4363a15
Author: Aaron Tomlin <[email protected]>

perf tests: Add shell test for kernel symbol beautifier

This commit adds a dedicated shell test script to verify that perf trace
properly symbolises kernel virtual addresses and function pointers using
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..c030b03e2b662
> --- /dev/null
> +++ b/tools/perf/tests/shell/trace_ksym_beautifier.sh
> @@ -0,0 +1,43 @@
[ ... ]
> +test_ksym_kallsyms() {
> +  echo "Testing perf trace kernel symbol beautifier (default kallsyms)"
> +  output="$(perf trace -e kmem:kmalloc --max-events=1 2>&1)"

[Severity: Medium]
Could this wait indefinitely on a completely quiescent system?

Because it waits system-wide for the kmem:kmalloc event without a timeout or
a deterministic workload to trigger it, it might stall the test suite if the
event takes too long to fire.

> +  if ! echo "$output" | grep -q -E "call_site: [a-zA-Z_][a-zA-Z0-9_]*" || echo "$output" | grep -q -E "call_site: 0x[0-9a-fA-F]+"
> +  then
> +    printf "Default kallsyms function symbolization failed, output:\n%s\n" "$output"
> +    err=1
> +  fi
> +}
> +
> +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 csd:csd_function_entry --force-btf --max-events=1 2>&1)"

[Severity: Medium]
Will this test fail erroneously on uniprocessor (UP) kernels?

The csd:csd_function_entry tracepoint is defined in kernel/smp.c, which is
only available when CONFIG_SMP is enabled. On a UP kernel, perf trace will
fail with an unknown tracepoint error, which the script would parse as a
symbolization failure.

[Severity: Medium]
Additionally, can this cause an indefinite hang on idle SMP systems?

The csd:csd_function_entry event relies on SMP cross-calls (IPIs). On an idle
or isolated test VM, this event might not occur organically for extended
periods, potentially causing perf trace to block forever without a timeout or
a triggering workload.

> +  if ! echo "$output" | grep -q -E "func: [a-zA-Z_][a-zA-Z0-9_]*" || echo "$output" | grep -q -E "func: 0x[0-9a-fA-F]+"
[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.