Skip to contentSkip to conversation

perf test: Fix hybrid testing of event fallback test

PATCH Applied Ian Rogers 3 participants 6 messages Dec 1, 2025 – Dec 3, 2025 perf events

lore
Share & tools
lore

Ian Rogers

author reviewer
#0 lore raw

PATCH 1/1 perf test: Fix hybrid testing of event fallback test

The mem-loads-aux event exists on hybrid systems but the "cpu" PMU does not. This causes an event parsing error which erroneously makes the test look like it is failing. Avoid naming the PMU to avoid this. Rather than cleaning up perf.data in the directory the test is run, explicitly send the 'perf record' output to /dev/null and avoid any cleanup scripts.

Fixes fc9c17b22352 ("perf test: Add a perf event fallback test")
---
 .../tests/shell/test_event_open_fallback.sh   | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
tools/perf/tests/shell/test_event_open_fallback.sh +2 -17
index 9c411153c01b..9420a7557c13 100755
@@ -6,24 +6,9 @@ skip_cnt=0
 ok_cnt=0
 err_cnt=0
 
-cleanup()
-{
-	rm -f perf.data
-	rm -f perf.data.old
-	trap - EXIT TERM INT
-}
-
-trap_cleanup()
-{
-	cleanup
-	exit 1
-}
-
-trap trap_cleanup EXIT TERM INT
-
 perf_record()
 {
-	perf record "$@" -- true 1>/dev/null 2>&1
+	perf record -o /dev/null "$@" -- true 1>/dev/null 2>&1
 }
 
 test_decrease_precise_ip()
@@ -49,7 +34,7 @@ test_decrease_precise_ip_complicated()
 
 	perf list pmu | grep -q 'mem-loads-aux' || return 2
 
-	if ! perf_record -e '{cpu/mem-loads-aux/S,cpu/mem-loads/PS}'; then
+	if ! perf_record -e '{mem-loads-aux:S,mem-loads:PS}'; then
 		return 1
 	fi
 	return 0
Signature · 1 line
2.52.0.158.g65b55ccf14-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 44 lines · Ian Rogers

The mem-loads-aux event exists on hybrid systems but the "cpu" PMU does not. This causes an event parsing error which erroneously makes the test look like it is failing. Avoid naming the PMU to avoid this. Rather than cleaning up perf.data in the directory the test is run, explicitly send the 'perf record' output to /dev/null and avoid any cleanup scripts.

Fixes fc9c17b22352 ("perf test: Add a perf event fallback test")
---
 .../tests/shell/test_event_open_fallback.sh   | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
tools/perf/tests/shell/test_event_open_fallback.sh +1 -16
index 9c411153c01b..9420a7557c13 100755
@@ -6,24 +6,9 @@ skip_cnt=0
 ok_cnt=0
 err_cnt=0
 
-cleanup()
-{
-	rm -f perf.data
-	rm -f perf.data.old
-	trap - EXIT TERM INT
-}
-
-trap_cleanup()
-{
-	cleanup
-	exit 1
-}
-
-trap trap_cleanup EXIT TERM INT
-
 perf_record()
 {
-	perf record "$@" -- true 1>/dev/null 2>&1
+	perf record -o /dev/null "$@" -- true 1>/dev/null 2>&1
 }
 
 test_decrease_precise_ip()

tools/perf/tests/shell/test_event_open_fallback.sh test_decrease_precise_ip_complicated() · line 40

Quoted 8 lines
tools/perf/tests/shell/test_event_open_fallback.sh +1 -1
@@ -49,7 +34,7 @@ test_decrease_precise_ip_complicated()
 
 	perf list pmu | grep -q 'mem-loads-aux' || return 2
 
-	if ! perf_record -e '{cpu/mem-loads-aux/S,cpu/mem-loads/PS}'; then
+	if ! perf_record -e '{mem-loads-aux:S,mem-loads:PS}'; then
 		return 1
 	fi
 	return 0
maintainer
#2 lore raw
In reply to Ian Rogers
Quoted 44 lines · Ian Rogers

The mem-loads-aux event exists on hybrid systems but the "cpu" PMU does not. This causes an event parsing error which erroneously makes the test look like it is failing. Avoid naming the PMU to avoid this. Rather than cleaning up perf.data in the directory the test is run, explicitly send the 'perf record' output to /dev/null and avoid any cleanup scripts.

Fixes fc9c17b22352 ("perf test: Add a perf event fallback test")
---
 .../tests/shell/test_event_open_fallback.sh   | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
tools/perf/tests/shell/test_event_open_fallback.sh +1 -16
index 9c411153c01b..9420a7557c13 100755
@@ -6,24 +6,9 @@ skip_cnt=0
 ok_cnt=0
 err_cnt=0
 
-cleanup()
-{
-	rm -f perf.data
-	rm -f perf.data.old
-	trap - EXIT TERM INT
-}
-
-trap_cleanup()
-{
-	cleanup
-	exit 1
-}
-
-trap trap_cleanup EXIT TERM INT
-
 perf_record()
 {
-	perf record "$@" -- true 1>/dev/null 2>&1
+	perf record -o /dev/null "$@" -- true 1>/dev/null 2>&1
 }
 
 test_decrease_precise_ip()

tools/perf/tests/shell/test_event_open_fallback.sh test_decrease_precise_ip_complicated() · line 37

Quoted 5 lines
tools/perf/tests/shell/test_event_open_fallback.sh +1 -1
@@ -49,7 +34,7 @@ test_decrease_precise_ip_complicated()
 
 	perf list pmu | grep -q 'mem-loads-aux' || return 2
 
-	if ! perf_record -e '{cpu/mem-loads-aux/S,cpu/mem-loads/PS}'; then
+	if ! perf_record -e '{mem-loads-aux:S,mem-loads:PS}'; then

I think we need to either keep the trap handler or convert all perf record commands including this to use -o /dev/null.

Thanks,
Namhyung

Quoted 6 lines
tools/perf/tests/shell/test_event_open_fallback.sh +0 -0
 		return 1
 	fi
 	return 0
Signature · 1 line
2.52.0.158.g65b55ccf14-goog
author reviewer
#3 lore raw
Quoted 47 lines · Namhyung Kim
Quoted 45 lines · Ian Rogers

The mem-loads-aux event exists on hybrid systems but the "cpu" PMU does not. This causes an event parsing error which erroneously makes the test look like it is failing. Avoid naming the PMU to avoid this. Rather than cleaning up perf.data in the directory the test is run, explicitly send the 'perf record' output to /dev/null and avoid any cleanup scripts.

Fixes fc9c17b22352 ("perf test: Add a perf event fallback test")
---
 .../tests/shell/test_event_open_fallback.sh   | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
tools/perf/tests/shell/test_event_open_fallback.sh +1 -16
index 9c411153c01b..9420a7557c13 100755
@@ -6,24 +6,9 @@ skip_cnt=0
 ok_cnt=0
 err_cnt=0
 
-cleanup()
-{
-     rm -f perf.data
-     rm -f perf.data.old
-     trap - EXIT TERM INT
-}
-
-trap_cleanup()
-{
-     cleanup
-     exit 1
-}
-
-trap trap_cleanup EXIT TERM INT
-
 perf_record()
 {
-     perf record "$@" -- true 1>/dev/null 2>&1
+     perf record -o /dev/null "$@" -- true 1>/dev/null 2>&1
 }
 
 test_decrease_precise_ip()
@@ -49,7 +34,7 @@ test_decrease_precise_ip_complicated()
 
Quoted 7 lines

tools/perf/tests/shell/test_event_open_fallback.sh test_decrease_precise_ip_complicated() · line 37

Quoted 4 lines
tools/perf/tests/shell/test_event_open_fallback.sh +1 -1
      perf list pmu | grep -q 'mem-loads-aux' || return 2
 
-     if ! perf_record -e '{cpu/mem-loads-aux/S,cpu/mem-loads/PS}'; then
+     if ! perf_record -e '{mem-loads-aux:S,mem-loads:PS}'; then

I think we need to either keep the trap handler or convert all perf record commands including this to use -o /dev/null.

So all the perf record commands use "-o /dev/null" as perf record is always run using the "perf_record" function (ie the one updated here) :-)

Thanks,
Ian

Quoted 10 lines

Thanks,
Namhyung

Quoted 6 lines
tools/perf/tests/shell/test_event_open_fallback.sh +0 -1
              return 1
      fi
      return 0
--

2.52.0.158.g65b55ccf14-goog

maintainer
#4 lore raw
Quoted 56 lines · Ian Rogers
Quoted 47 lines · Namhyung Kim
Quoted 45 lines · Ian Rogers

The mem-loads-aux event exists on hybrid systems but the "cpu" PMU does not. This causes an event parsing error which erroneously makes the test look like it is failing. Avoid naming the PMU to avoid this. Rather than cleaning up perf.data in the directory the test is run, explicitly send the 'perf record' output to /dev/null and avoid any cleanup scripts.

Fixes fc9c17b22352 ("perf test: Add a perf event fallback test")
---
 .../tests/shell/test_event_open_fallback.sh   | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)
tools/perf/tests/shell/test_event_open_fallback.sh +1 -16
index 9c411153c01b..9420a7557c13 100755
@@ -6,24 +6,9 @@ skip_cnt=0
 ok_cnt=0
 err_cnt=0
 
-cleanup()
-{
-     rm -f perf.data
-     rm -f perf.data.old
-     trap - EXIT TERM INT
-}
-
-trap_cleanup()
-{
-     cleanup
-     exit 1
-}
-
-trap trap_cleanup EXIT TERM INT
-
 perf_record()
 {
-     perf record "$@" -- true 1>/dev/null 2>&1
+     perf record -o /dev/null "$@" -- true 1>/dev/null 2>&1
 }
 
 test_decrease_precise_ip()
@@ -49,7 +34,7 @@ test_decrease_precise_ip_complicated()
 
Quoted 7 lines

tools/perf/tests/shell/test_event_open_fallback.sh test_decrease_precise_ip_complicated() · line 37

Quoted 4 lines
tools/perf/tests/shell/test_event_open_fallback.sh +1 -1
      perf list pmu | grep -q 'mem-loads-aux' || return 2
 
-     if ! perf_record -e '{cpu/mem-loads-aux/S,cpu/mem-loads/PS}'; then
+     if ! perf_record -e '{mem-loads-aux:S,mem-loads:PS}'; then

I think we need to either keep the trap handler or convert all perf record commands including this to use -o /dev/null.

Quoted 3 lines

So all the perf record commands use "-o /dev/null" as perf record is always run using the "perf_record" function (ie the one updated here) :-)

Oh.. I missed that. LGTM!

Thanks,
Namhyung

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
tools/perf/tests/shell/test_event_open_fallback.sh +0 -1
              return 1
      fi
      return 0
--

2.52.0.158.g65b55ccf14-goog

maintainer Applied
#5 lore raw
In reply to Ian Rogers
Quoted 8 lines · Ian Rogers

The mem-loads-aux event exists on hybrid systems but the "cpu" PMU does not. This causes an event parsing error which erroneously makes the test look like it is failing. Avoid naming the PMU to avoid this. Rather than cleaning up perf.data in the directory the test is run, explicitly send the 'perf record' output to /dev/null and avoid any cleanup scripts.

[...]

Applied to perf-tools-next, thanks!

Best regards,
Namhyung