perf test cs-etm: Add all branch instructions to test

If we reduce the number of samples searched to speed up the test, then
there will be less chance of hitting one of these branches. Extend the
regex to cover all branches so the test will always pass.

Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Amir Ayupov <aaupov@meta.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Mike Leach <mike.leach@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paschalis Mpeis <Paschalis.Mpeis@arm.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
James Clark 2026-06-09 15:40:22 +01:00 committed by Arnaldo Carvalho de Melo
parent 3c84ec94a6
commit 0f900110c7

View File

@ -38,8 +38,7 @@ cleanup_files()
trap cleanup_files EXIT TERM INT
# Ranges start and end on branches, so check for some likely branch instructions
sep="\s\|\s"
branch_search="\sbl${sep}b${sep}b.ne${sep}b.eq${sep}cbz\s"
branch_search='[[:space:]](bl|b(\.(eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al))?|br|blr|ret|cbz|cbnz|tbz|tbnz|svc|eret)([[:space:]]|$)'
## Test kernel ##
if [ "$(id -u)" == 0 ] && [ -e /proc/kcore ]; then
@ -47,7 +46,7 @@ if [ "$(id -u)" == 0 ] && [ -e /proc/kcore ]; then
perf record -o ${perfdata} -e cs_etm//k --kcore -- touch $file > /dev/null 2>&1
perf script -i ${perfdata} -s python:${script_path} -- \
-d --stop-sample=30 -k ${perfdata}/kcore_dir/kcore 2> /dev/null > ${file}
grep -q -e ${branch_search} ${file}
grep -q -E ${branch_search} ${file}
echo "Found kernel branches"
else
# Root and kcore are required for correct kernel decode due to runtime code patching
@ -59,7 +58,7 @@ echo "Testing userspace disassembly"
perf record -o ${perfdata} -e cs_etm//u -- touch $file > /dev/null 2>&1
perf script -i ${perfdata} -s python:${script_path} -- \
-d --stop-sample=30 2> /dev/null > ${file}
grep -q -e ${branch_search} ${file}
grep -q -E ${branch_search} ${file}
echo "Found userspace branches"
glb_err=0