Skip to content

Commit 0b783d2

Browse files
James-A-Clarknamhyung
authored andcommitted
perf tests: test_arm_coresight: Simplify source iteration
There are two reasons to do this, firstly there is a shellcheck warning in cs_etm_dev_name(), which can be completely deleted. And secondly the current iteration method doesn't support systems with both ETE and ETM because it picks one or the other. There isn't a known system with this configuration, but it could happen in the future. Iterating over all the sources for each CPU can be done by going through /sys/bus/event_source/devices/cs_etm/cpu* and following the symlink back to the Coresight device in /sys/bus/coresight/devices. This will work whether the device is ETE, ETM or any future name, and is much simpler and doesn't require any hard coded version numbers Suggested-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: James Clark <james.clark@arm.com> Acked-by: Ian Rogers <irogers@google.com> Tested-by: Leo Yan <leo.yan@linaro.org> Cc: tianruidong@linux.alibaba.com Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Anushree Mathur <anushree.mathur@linux.vnet.ibm.com> Cc: Tiezhu Yang <yangtiezhu@loongson.cn> Cc: atrajeev@linux.vnet.ibm.com Cc: coresight@lists.linaro.org Link: https://lore.kernel.org/r/20231023131550.487760-1-james.clark@arm.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 parent 4ece2a7 commit 0b783d2

1 file changed

Lines changed: 3 additions & 14 deletions

File tree

tools/perf/tests/shell/test_arm_coresight.sh

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,6 @@
1111

1212
glb_err=0
1313

14-
cs_etm_dev_name() {
15-
cs_etm_path=$(find /sys/bus/event_source/devices/cs_etm/ -name cpu* -print -quit)
16-
trcdevarch=$(cat ${cs_etm_path}/mgmt/trcdevarch)
17-
archhver=$((($trcdevarch >> 12) & 0xf))
18-
archpart=$(($trcdevarch & 0xfff))
19-
20-
if [ $archhver -eq 5 -a "$(printf "0x%X\n" $archpart)" = "0xA13" ] ; then
21-
echo "ete"
22-
else
23-
echo "etm"
24-
fi
25-
}
26-
2714
skip_if_no_cs_etm_event() {
2815
perf list | grep -q 'cs_etm//' && return 0
2916

@@ -149,7 +136,9 @@ arm_cs_iterate_devices() {
149136

150137
arm_cs_etm_traverse_path_test() {
151138
# Iterate for every ETM device
152-
for dev in /sys/bus/coresight/devices/$(cs_etm_dev_name)*; do
139+
for dev in /sys/bus/event_source/devices/cs_etm/cpu*; do
140+
# Canonicalize the path
141+
dev=`readlink -f $dev`
153142

154143
# Find the ETM device belonging to which CPU
155144
cpu=`cat $dev/cpu`

0 commit comments

Comments
 (0)