]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf tests arm_spe: Add test for discard mode
authorJames Clark <james.clark@linaro.org>
Wed, 8 Jan 2025 14:29:00 +0000 (14:29 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 13 Jan 2025 14:45:05 +0000 (11:45 -0300)
Add a test that checks that there were no AUX or AUXTRACE events
recorded when discard mode is used.

Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
Signed-off-by: James Clark <james.clark@linaro.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Cc: Graham Woodward <graham.woodward@arm.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: Kan Liang <kan.liang@linux.intel.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rob Herring <robh@kernel.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Cc: Veronika Molnarova <vmolnaro@redhat.com>
Cc: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20250108142904.401139-6-james.clark@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/shell/test_arm_spe.sh

index 3258368634f793a1c5cde4c065f30f4404b0dcec..a69aab70dd8aef164db77714f96c01bd5897aa88 100755 (executable)
@@ -107,7 +107,37 @@ arm_spe_system_wide_test() {
        arm_spe_report "SPE system-wide testing" $err
 }
 
+arm_spe_discard_test() {
+       echo "SPE discard mode"
+
+       for f in /sys/bus/event_source/devices/arm_spe_*; do
+               if [ -e "$f/format/discard" ]; then
+                       cpu=$(cut -c -1 "$f/cpumask")
+                       break
+               fi
+       done
+
+       if [ -z $cpu ]; then
+               arm_spe_report "SPE discard mode not present" 2
+               return
+       fi
+
+       # Test can use wildcard SPE instance and Perf will only open the event
+       # on instances that have that format flag. But make sure the target
+       # runs on an instance with discard mode otherwise we're not testing
+       # anything.
+       perf record -o ${perfdata} -e arm_spe/discard/ -N -B --no-bpf-event \
+               -- taskset --cpu-list $cpu true
+
+       if perf report -i ${perfdata} --stats | grep 'AUX events\|AUXTRACE events'; then
+               arm_spe_report "SPE discard mode found unexpected data" 1
+       else
+               arm_spe_report "SPE discard mode" 0
+       fi
+}
+
 arm_spe_snapshot_test
 arm_spe_system_wide_test
+arm_spe_discard_test
 
 exit $glb_err