From 0f900110c7b49cae863c19960991033e55c0ad2e Mon Sep 17 00:00:00 2001 From: James Clark Date: Tue, 9 Jun 2026 15:40:22 +0100 Subject: [PATCH] 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 Signed-off-by: James Clark Cc: Amir Ayupov Cc: Ian Rogers Cc: Jiri Olsa Cc: Jonathan Corbet Cc: Mike Leach Cc: Namhyung Kim Cc: Paschalis Mpeis Cc: Shuah Khan Cc: Suzuki Poulouse Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/shell/test_arm_coresight_disasm.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/perf/tests/shell/test_arm_coresight_disasm.sh b/tools/perf/tests/shell/test_arm_coresight_disasm.sh index 87797d239f76..f78dfb6bf73e 100755 --- a/tools/perf/tests/shell/test_arm_coresight_disasm.sh +++ b/tools/perf/tests/shell/test_arm_coresight_disasm.sh @@ -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