[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20260119-james-perf-coresight-cpu-map-segfault-v2-2-56b956a629ee@linaro.org>
Date: Mon, 19 Jan 2026 10:18:36 +0000
From: James Clark <james.clark@...aro.org>
To: Suzuki K Poulose <suzuki.poulose@....com>,
Mike Leach <mike.leach@...aro.org>, John Garry <john.g.garry@...cle.com>,
Will Deacon <will@...nel.org>, Leo Yan <leo.yan@...ux.dev>,
Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Namhyung Kim <namhyung@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Thomas Falcon <thomas.falcon@...el.com>
Cc: coresight@...ts.linaro.org, linux-arm-kernel@...ts.infradead.org,
linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
James Clark <james.clark@...aro.org>
Subject: [PATCH v2 2/2] 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@...aro.org>
---
tools/perf/tests/shell/test_arm_coresight.sh | 54 ++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
index 1c750b67d141..bbf89e944e7b 100755
--- a/tools/perf/tests/shell/test_arm_coresight.sh
+++ b/tools/perf/tests/shell/test_arm_coresight.sh
@@ -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
--
2.34.1
Powered by blists - more mailing lists