linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] perf tests: Handle s390 metrics in perf all metrics test
@ 2025-11-19 10:47 Thomas Richter
  2025-11-19 17:06 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Richter @ 2025-11-19 10:47 UTC (permalink / raw)
  To: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	irogers
  Cc: agordeev, gor, sumanthk, hca, japo, Thomas Richter

This test case fails on s390 because some counters metrics
are not available and the metric defined on them fail.
Add s390x specific list of metrics to be skipped.

Add an extra line to display which metric has been skipped.
It is shown with the verbose option turned on.

Also return "Ok" instead of "Skipped" when no errors
have been detected, but some metric have been skipped.
The seems more logical otherwise "Skipped" means all
metric tests have been skipped instead of just a few.

Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/tests/shell/stat_all_metrics.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/stat_all_metrics.sh b/tools/perf/tests/shell/stat_all_metrics.sh
index a7edf01b3943..b86b36a49228 100755
--- a/tools/perf/tests/shell/stat_all_metrics.sh
+++ b/tools/perf/tests/shell/stat_all_metrics.sh
@@ -7,6 +7,10 @@ ParanoidAndNotRoot()
   [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
 }
 
+# Ignore metric which are not supported on s390x
+[ "$(uname -m)" = "s390x" ] && ignore="|branch_miss_rate|l1d_miss_rate|llc_miss_rate|\
+		dtlb_miss_rate|itlb_miss_rate|l1i_miss_rate|l1_prefetch_miss_rate"
+
 test_prog="sleep 0.01"
 system_wide_flag="-a"
 if ParanoidAndNotRoot 0
@@ -27,9 +31,10 @@ for m in $(perf list --raw-dump metrics); do
   fi
   if [[ "$result" =~ "Cannot resolve IDs for" || "$result" =~ "No supported events found" ]]
   then
-    if [[ "$m" == @(l1_prefetch_miss_rate|stalled_cycles_per_instruction) ]]
+    if [[ "$m" == @(l1_prefetch_miss_rate|stalled_cycles_per_instruction$ignore) ]]
     then
       # Default metrics that may use unsupported events.
+      echo "Skipped metric $m"
       continue
     fi
     echo "Metric contains missing events"
@@ -106,4 +111,5 @@ for m in $(perf list --raw-dump metrics); do
   err=1
 done
 
+[ "$err" -eq 2 ] && err=0
 exit "$err"
-- 
2.51.1


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

* Re: [PATCH linux-next] perf tests: Handle s390 metrics in perf all metrics test
  2025-11-19 10:47 [PATCH linux-next] perf tests: Handle s390 metrics in perf all metrics test Thomas Richter
@ 2025-11-19 17:06 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2025-11-19 17:06 UTC (permalink / raw)
  To: Thomas Richter
  Cc: linux-kernel, linux-s390, linux-perf-users, acme, namhyung,
	agordeev, gor, sumanthk, hca, japo

On Wed, Nov 19, 2025 at 2:48 AM Thomas Richter <tmricht@linux.ibm.com> wrote:
>
> This test case fails on s390 because some counters metrics
> are not available and the metric defined on them fail.
> Add s390x specific list of metrics to be skipped.
>
> Add an extra line to display which metric has been skipped.
> It is shown with the verbose option turned on.
>
> Also return "Ok" instead of "Skipped" when no errors
> have been detected, but some metric have been skipped.
> The seems more logical otherwise "Skipped" means all
> metric tests have been skipped instead of just a few.
>
> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>

Thanks Thomas, I believe the intent with these metrics is they don't
fail but report unsupported for their counters. There's been some
discussion here:
https://lore.kernel.org/lkml/aRi9xnwdLh3Dir9f@google.com/
with Namhyung and James pointing out the issue on AMD and ARM, and me
being confused we Intel isn't failing similarly for events like itlb
accesses that Intel doesn't support. I'll try to find time to dig into
the issue.

Thanks,
Ian

> ---
>  tools/perf/tests/shell/stat_all_metrics.sh | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/shell/stat_all_metrics.sh b/tools/perf/tests/shell/stat_all_metrics.sh
> index a7edf01b3943..b86b36a49228 100755
> --- a/tools/perf/tests/shell/stat_all_metrics.sh
> +++ b/tools/perf/tests/shell/stat_all_metrics.sh
> @@ -7,6 +7,10 @@ ParanoidAndNotRoot()
>    [ "$(id -u)" != 0 ] && [ "$(cat /proc/sys/kernel/perf_event_paranoid)" -gt $1 ]
>  }
>
> +# Ignore metric which are not supported on s390x
> +[ "$(uname -m)" = "s390x" ] && ignore="|branch_miss_rate|l1d_miss_rate|llc_miss_rate|\
> +               dtlb_miss_rate|itlb_miss_rate|l1i_miss_rate|l1_prefetch_miss_rate"
> +
>  test_prog="sleep 0.01"
>  system_wide_flag="-a"
>  if ParanoidAndNotRoot 0
> @@ -27,9 +31,10 @@ for m in $(perf list --raw-dump metrics); do
>    fi
>    if [[ "$result" =~ "Cannot resolve IDs for" || "$result" =~ "No supported events found" ]]
>    then
> -    if [[ "$m" == @(l1_prefetch_miss_rate|stalled_cycles_per_instruction) ]]
> +    if [[ "$m" == @(l1_prefetch_miss_rate|stalled_cycles_per_instruction$ignore) ]]
>      then
>        # Default metrics that may use unsupported events.
> +      echo "Skipped metric $m"
>        continue
>      fi
>      echo "Metric contains missing events"
> @@ -106,4 +111,5 @@ for m in $(perf list --raw-dump metrics); do
>    err=1
>  done
>
> +[ "$err" -eq 2 ] && err=0
>  exit "$err"
> --
> 2.51.1
>

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

end of thread, other threads:[~2025-11-19 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 10:47 [PATCH linux-next] perf tests: Handle s390 metrics in perf all metrics test Thomas Richter
2025-11-19 17:06 ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).