perf cs-etm: Test sparse CPU maps

We only currently test with default (all CPUs) or --per-thread mode.

Different permutations of the "-C" option can affect decoding so add
tests for some of them.

Signed-off-by: James Clark <james.clark@linaro.org>
Tested-by: Leo Yan <leo.yan@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
Cc: Thomas Falcon <thomas.falcon@intel.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
James Clark
2026-01-19 10:18:36 +00:00
committed by Arnaldo Carvalho de Melo
parent a70493e2bb
commit 3d020f2e3b

View File

@@ -198,6 +198,58 @@ arm_cs_etm_basic_test() {
arm_cs_report "CoreSight basic testing with '$*'" $err
}
arm_cs_etm_test_cpu_list() {
echo "Testing sparse CPU list: $1"
perf record -o ${perfdata} -e cs_etm//u -C $1 \
-- taskset --cpu-list $1 true > /dev/null 2>&1
perf_script_branch_samples true
err=$?
arm_cs_report "CoreSight sparse CPUs with '$*'" $err
}
arm_cs_etm_sparse_cpus_test() {
# Iterate for every ETM device
cpus=()
for dev in /sys/bus/event_source/devices/cs_etm/cpu*; do
# Canonicalize the path
dev=`readlink -f $dev`
# Find the ETM device belonging to which CPU
cpus+=("$(cat $dev/cpu)")
done
mapfile -t cpus < <(printf '%s\n' "${cpus[@]}" | sort -n)
total=${#cpus[@]}
# Need more than 1 to test
if [ $total -le 1 ]; then
return 0
fi
half=$((total / 2))
# First half
first_half=$(IFS=,; echo "${cpus[*]:0:$half}")
arm_cs_etm_test_cpu_list $first_half
# Second half
second_half=$(IFS=,; echo "${cpus[*]:$half}")
arm_cs_etm_test_cpu_list $second_half
# Odd list is the same as halves unless >= 4 CPUs
if [ $total -lt 4 ]; then
return 0
fi
# Odd indices
odd_cpus=()
for ((i=1; i<total; i+=2)); do
odd_cpus+=("${cpus[$i]}")
done
odd_list=$(IFS=,; echo "${odd_cpus[*]}")
arm_cs_etm_test_cpu_list $odd_list
}
arm_cs_etm_traverse_path_test
arm_cs_etm_system_wide_test
arm_cs_etm_snapshot_test
@@ -211,4 +263,6 @@ arm_cs_etm_basic_test -e cs_etm/timestamp=1/ -a
arm_cs_etm_basic_test -e cs_etm/timestamp=0/
arm_cs_etm_basic_test -e cs_etm/timestamp=1/
arm_cs_etm_sparse_cpus_test
exit $glb_err