Skip to contentSkip to conversation

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

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

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 perf test: Fix perf test 114 perf record test subtest precise_max for s390

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.

Change the event instruction to cycles for subtest test_precise_max as suggested by James Clark.

---
 tools/perf/tests/shell/record.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/record.sh +2 -2
index 0fc7a909ae9b..957ee10aff44 100755
@@ -287,9 +287,9 @@ 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
+  if ! perf record -o "${perfdata}" -e "cycles:P" true 2> /dev/null
   then
-    echo "precise_max attribute [Failed instructions:P event]"
+    echo "precise_max attribute [Failed cycles:P event]"
     err=1
     return
   fi
Signature · 1 line
2.48.1
#1 lore raw

PATCH v2 2/2 perf test: Skip perf test 114 perf record test subtest test_leader_sampling for s390

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.

Omit subtest test_leader_sampling on s390.

---
 tools/perf/tests/shell/record.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/shell/record.sh +2 -1
index 957ee10aff44..9e645eb09d9e 100755
@@ -307,7 +307,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
#2 lore raw

Re: [PATCH 2/2 v2] perf test: Skip perf test 114 perf record test subtest test_leader_sampling for s390

Quoted 15 lines · Thomas Richter

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.

Omit subtest test_leader_sampling on s390.

---
  tools/perf/tests/shell/record.sh | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/tests/shell/record.sh +0 -0
index 957ee10aff44..9e645eb09d9e 100755

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

Quoted 9 lines
tools/perf/tests/shell/record.sh +2 -1
@@ -307,7 +307,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
 

I still think we should use the cycles event instead of skipping. My intention was to use the most commonly available event with 80fd0c1eac7 ("perf tests: Make leader sampling test work without branch event"), it's not important which event is used exactly

reviewer
#3 lore raw
In reply to Thomas Richter

Is this a v2 of "[PATCH] perf test: Fix perf test 114 perf record test for s390"? Or maybe the v2 is a typo?

Quoted 17 lines · Thomas Richter

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.

Change the event instruction to cycles for subtest test_precise_max as suggested by James Clark.

---
  tools/perf/tests/shell/record.sh | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/record.sh +0 -0
index 0fc7a909ae9b..957ee10aff44 100755

tools/perf/tests/shell/record.sh test_precise_max() { · line 290

Quoted 5 lines
tools/perf/tests/shell/record.sh +1 -1
@@ -287,9 +287,9 @@ 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
+  if ! perf record -o "${perfdata}" -e "cycles:P" true 2> /dev/null

I'm not sure if this is the right fix. Doesn't this make the test test cycles:P twice now?

I think the fix is to first test if cycles can be sampled, then test cycles:P. Then test if instructions can be sampled, then test instructions:P.

At the moment it checks the events with perf stat, and it checks them both at the same time. Obviously that doesn't work if an event works for perf stat but not perf record. And checking them both at the same time doesn't allow for one existing and not the other.

Quoted 6 lines
tools/perf/tests/shell/record.sh +1 -1
    then
-    echo "precise_max attribute [Failed instructions:P event]"
+    echo "precise_max attribute [Failed cycles:P event]"
      err=1
      return
    fi
reviewer
#4 lore raw
Quoted 3 lines · James Clark

Is this a v2 of "[PATCH] perf test: Fix perf test 114 perf record test for s390"? Or maybe the v2 is a typo?

Nevermind, the CC list is different on the two patches that's why I got confused.

Quoted 38 lines · Thomas Richter
Quoted 17 lines

On s390 the event instructions can not be used for recording. This event is only supported by perf stat.

Change the event instruction to cycles for subtest test_precise_max as suggested by James Clark.

---
  tools/perf/tests/shell/record.sh | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/tests/shell/record.sh +0 -0
index 0fc7a909ae9b..957ee10aff44 100755
@@ -287,9 +287,9 @@ test_precise_max() {
Quoted 6 lines

      return
    fi
    # On AMD, cycles and instructions events are treated differently -  if ! perf record -o "${perfdata}" -e "instructions:P" true 2> /dev/ null
+  if ! perf record -o "${perfdata}" -e "cycles:P" true 2> /dev/null

I'm not sure if this is the right fix. Doesn't this make the test test cycles:P twice now?

I think the fix is to first test if cycles can be sampled, then test cycles:P. Then test if instructions can be sampled, then test instructions:P.

At the moment it checks the events with perf stat, and it checks them both at the same time. Obviously that doesn't work if an event works for perf stat but not perf record. And checking them both at the same time doesn't allow for one existing and not the other.

Quoted 6 lines

    then
-    echo "precise_max attribute [Failed instructions:P event]" +    echo "precise_max attribute [Failed cycles:P event]" err=1
      return
    fi