Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] perf test: perf stat tests fails on s390
@ 2026-09-02 11:52 Thomas Richter
  2026-09-02 11:58 ` sashiko-bot
  2026-09-02 12:18 ` Aaron Tomlin
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Richter @ 2026-09-02 11:52 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	atomlin, irogers
  Cc: agordeev, iii, sumanthk, hca, japo, Thomas Richter

The test case 'perf stat tests' fails on s390 z/VM machines. The
root cause is the unsupported CPU measurement facility on z/VM.
Therefore the events cycles and instructions do not exist and
are unsupported. This cause the subtest
  Hide zero events stat test
to fail.

Output before:
 # perf test 116
 116: perf stat tests  : FAILED!

 === Test Summary ===
 Passed main tests : 0
 Passed subtests   : 0
 Skipped tests     : 0
 Failed tests      : 1
 List of failed tests:
  116: perf stat tests
 #

Output after:
 # ./perf test 116
 116: perf stat tests  : Ok

 === Test Summary ===
 Passed main tests : 1
 Passed subtests   : 0
 Skipped tests     : 0
 Failed tests      : 0
 #

Fixes: 64724095a33f ("perf stat: Add --hide-zero-events option to suppress zero-count events")
Cc: Aaron Tomlin <atomlin@atomlin.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/tests/shell/stat.sh | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
index 298ce454b45a..41bac99300a1 100755
--- a/tools/perf/tests/shell/stat.sh
+++ b/tools/perf/tests/shell/stat.sh
@@ -583,6 +583,11 @@ test_hide_zero_events_stat() {
   # Check that --metric-only works with --hide-zero-events
   if ! perf stat --hide-zero-events --metric-only -e instructions,cycles true > "${stat_output}" 2>&1
   then
+    grep -q 'No supported events found' "${stat_output}"
+    if [ $? -eq 0 ]; then
+      echo "Hide zero events stat test [Skipped - events not supported]"
+      return
+    fi
     echo "Hide zero events stat test [Failed - metric-only command failed]"
     err=1
     return
-- 
2.55.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf test: perf stat tests fails on s390
  2026-09-02 11:52 [PATCH] perf test: perf stat tests fails on s390 Thomas Richter
@ 2026-09-02 11:58 ` sashiko-bot
  2026-09-02 12:18 ` Aaron Tomlin
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-09-02 11:58 UTC (permalink / raw)
  To: Thomas Richter
  Cc: Alexander Gordeev, linux-perf-users, Vasily Gorbik, linux-s390,
	Heiko Carstens, Christian Borntraeger

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Code Fix: Replace with `if grep -q 'No supported events found' "${stat_output}"; then`. Standalone `grep -q` under `set -e` causes unexpected script abort.
--

commit 4b80c04b99f0ab66b8227b70f1041582e256987c
Author: Thomas Richter <tmricht@linux.ibm.com>

perf test: perf stat tests fails on s390

This commit fixes a failure in the 'perf stat tests' on s390 z/VM by skipping
the test if the cycles and instructions events are unsupported. It checks the
output of the failed perf stat command for 'No supported events found' to
determine if the test should be skipped.

> diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
> index 298ce454b45a1..41bac99300a16 100755
> --- a/tools/perf/tests/shell/stat.sh
> +++ b/tools/perf/tests/shell/stat.sh
> @@ -583,6 +583,11 @@ test_hide_zero_events_stat() {
>    # Check that --metric-only works with --hide-zero-events
>    if ! perf stat --hide-zero-events --metric-only -e instructions,cycles true > "${stat_output}" 2>&1
>    then
> +    grep -q 'No supported events found' "${stat_output}"
> +    if [ $? -eq 0 ]; then

[Severity: Medium]
In test_hide_zero_events_stat(), will this standalone grep cause the script
to abort unexpectedly?

If the script is running with 'set -e' and the perf stat command fails for
any reason other than unsupported events, grep will not find a match and will
return a non-zero exit code.

This non-zero exit directly forces a script abort, making the subsequent
'$?' condition and fallback error handlers unreachable.

Should this be combined into the if statement directly?

    if grep -q 'No supported events found' "${stat_output}"; then
        echo "Hide zero events stat test [Skipped - events not supported]"
        return
    fi

> +      echo "Hide zero events stat test [Skipped - events not supported]"
> +      return
> +    fi
>      echo "Hide zero events stat test [Failed - metric-only command failed]"
>      err=1
>      return

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902115218.2977412-1-tmricht@linux.ibm.com?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf test: perf stat tests fails on s390
  2026-09-02 11:52 [PATCH] perf test: perf stat tests fails on s390 Thomas Richter
  2026-09-02 11:58 ` sashiko-bot
@ 2026-09-02 12:18 ` Aaron Tomlin
  1 sibling, 0 replies; 3+ messages in thread
From: Aaron Tomlin @ 2026-09-02 12:18 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers, agordeev, iii, sumanthk, hca, japo

On Wed, Sep 02, 2026 at 01:52:18PM +0200, Thomas Richter wrote:
> The test case 'perf stat tests' fails on s390 z/VM machines. The
> root cause is the unsupported CPU measurement facility on z/VM.
> Therefore the events cycles and instructions do not exist and
> are unsupported. This cause the subtest
>   Hide zero events stat test
> to fail.
> 
> Output before:
>  # perf test 116
>  116: perf stat tests  : FAILED!
> 
>  === Test Summary ===
>  Passed main tests : 0
>  Passed subtests   : 0
>  Skipped tests     : 0
>  Failed tests      : 1
>  List of failed tests:
>   116: perf stat tests
>  #
> 
> Output after:
>  # ./perf test 116
>  116: perf stat tests  : Ok
> 
>  === Test Summary ===
>  Passed main tests : 1
>  Passed subtests   : 0
>  Skipped tests     : 0
>  Failed tests      : 0
>  #
> 
> Fixes: 64724095a33f ("perf stat: Add --hide-zero-events option to suppress zero-count events")
> Cc: Aaron Tomlin <atomlin@atomlin.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
> ---
>  tools/perf/tests/shell/stat.sh | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tools/perf/tests/shell/stat.sh b/tools/perf/tests/shell/stat.sh
> index 298ce454b45a..41bac99300a1 100755
> --- a/tools/perf/tests/shell/stat.sh
> +++ b/tools/perf/tests/shell/stat.sh
> @@ -583,6 +583,11 @@ test_hide_zero_events_stat() {
>    # Check that --metric-only works with --hide-zero-events
>    if ! perf stat --hide-zero-events --metric-only -e instructions,cycles true > "${stat_output}" 2>&1
>    then
> +    grep -q 'No supported events found' "${stat_output}"
> +    if [ $? -eq 0 ]; then
> +      echo "Hide zero events stat test [Skipped - events not supported]"
> +      return
> +    fi
>      echo "Hide zero events stat test [Failed - metric-only command failed]"
>      err=1
>      return
> -- 
> 2.55.0
> 

Hi Thomas,

This makes sense.

However, please see the valid feedback from Sashiko [1]. Otherwise:

Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>

[1]: https://sashiko.dev/#/patchset/20260902115218.2977412-1-tmricht%40linux.ibm.com

Kind regards,
-- 
Aaron Tomlin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-09-02 12:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 11:52 [PATCH] perf test: perf stat tests fails on s390 Thomas Richter
2026-09-02 11:58 ` sashiko-bot
2026-09-02 12:18 ` Aaron Tomlin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox