Skip to contentSkip to conversation

perf test: Fix perf test 114 perf record test for s390

PATCH Superseded Thomas Richter 2 participants 2 messages Jan 28, 2025 perf events

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf test: Fix perf test 114 perf record test for s390

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.
Skip all tests which use perf record -e instruction ....

Cc James Clark <[email protected]>
Cc Namhyung Kim <[email protected]>
---
 tools/perf/tests/shell/record.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
tools/perf/tests/shell/record.sh +10 -5
index 0fc7a909ae9b..297d0e459875 100755
@@ -287,11 +287,15 @@ test_precise_max() {
     return
   fi
   # On AMD, cycles and instructions events are treated differently
-  if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/null
+  # On s390 event instructions can not be used for recording
+  if [ $(uname -m) != s390x ]
   then
-    echo "precise_max attribute [Failed instructions:P event]"
-    err=1
-    return
+    if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/null
+    then
+      echo "precise_max attribute [Failed instructions:P event]"
+      err=1
+      return
+    fi
   fi
   echo "precise_max attribute test [Success]"
 }
@@ -307,7 +311,8 @@ test_system_wide
 test_workload
 test_branch_counter
 test_cgroup
-test_leader_sampling
+# On s390 event instructions can not be used for recording
+[ $(uname -m) != s390x ] && test_leader_sampling
 test_topdown_leader_sampling
 test_precise_max
 
Signature · 1 line
2.48.1
reviewer
#1 lore raw
Quoted 36 lines · Thomas Richter

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.
Skip all tests which use perf record -e instruction ....

Cc James Clark <[email protected]>
Cc Namhyung Kim <[email protected]>
---
  tools/perf/tests/shell/record.sh | 15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)
tools/perf/tests/shell/record.sh +8 -4
index 0fc7a909ae9b..297d0e459875 100755
@@ -287,11 +287,15 @@ test_precise_max() {
      return
    fi
    # On AMD, cycles and instructions events are treated differently
-  if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/null
+  # On s390 event instructions can not be used for recording
+  if [ $(uname -m) != s390x ]
    then
-    echo "precise_max attribute [Failed instructions:P event]"
-    err=1
-    return
+    if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/null
+    then
+      echo "precise_max attribute [Failed instructions:P event]"
+      err=1
+      return
+    fi
    fi
    echo "precise_max attribute test [Success]"
  }

tools/perf/tests/shell/record.sh test_system_wide · line 315

Quoted 6 lines
tools/perf/tests/shell/record.sh +2 -1
@@ -307,7 +311,8 @@ test_system_wide
  test_workload
  test_branch_counter
  test_cgroup
-test_leader_sampling
+# On s390 event instructions can not be used for recording
+[ $(uname -m) != s390x ] && test_leader_sampling

Is this a fix for 180fd0c1eac7 ("perf tests: Make leader sampling test work without branch event")? If so sorry for the breakage.

Can you change it to cycles instead of instructions? The actual event didn't seem to be important for the test. I see there is a perf record -e cycles for test_precise_max() so I'm assuming that works for s390 as it isn't conditional.

Quoted 3 lines
tools/perf/tests/shell/record.sh +0 -0
  test_topdown_leader_sampling
  test_precise_max