]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf tests metric-only perf stat: Fix tests 84 and 86 s390
authorThomas Richter <tmricht@linux.ibm.com>
Thu, 24 Apr 2025 13:33:10 +0000 (15:33 +0200)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 25 Apr 2025 15:32:07 +0000 (12:32 -0300)
On s390x KVM and z/VM machines the CPU Measurement Facility is not
available. Events cycles and instructions do not exist.  Running above
tests on s390 KVM and z/VM guests always fail with this error:

  # ./perf test 84 86
  84: perf stat JSON output linter          : FAILED!
  86: perf stat STD output linter           : FAILED!
  #

Root cause is command:

  # perf stat -j --metric-only -e instructions,cycles -- true
  {"metric-value" : "none"}
  #

Which fails due to unsupported events and returns "none".
Do not execute this test case on s390 KVM and z/VM machines.

Output after:
  # ./perf test 84 86
  84: perf stat JSON output linter          : Ok
  86: perf stat STD output linter           : Ok
  #

Fixes: 45a86d017adf4d6c ("perf test: Add --metric-only to perf stat output tests")
Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Suggested-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Reviewed-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Link: https://lore.kernel.org/r/20250424133310.37452-1-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/shell/lib/stat_output.sh
tools/perf/tests/shell/stat+json_output.sh

index 4d4aac547f0109d14d3b935747a71d1d27d1e5db..c2ec7881ec1de40bd6f082820823f7235d38f70a 100644 (file)
@@ -151,6 +151,11 @@ check_per_socket()
 check_metric_only()
 {
        echo -n "Checking $1 output: metric only "
+       if [ "$(uname -m)" = "s390x" ] && ! grep '^facilities' /proc/cpuinfo  | grep -qw 67
+       then
+               echo "[Skip] CPU-measurement counter facility not installed"
+               return
+       fi
        perf stat --metric-only $2 -e instructions,cycles true
        commachecker --metric-only
        echo "[Success]"
index a4f257ea839e1368f9fe045fcc349d162aed908d..98fb65274ac4f722e21872c3e4aca4f0af456fe5 100755 (executable)
@@ -176,6 +176,11 @@ check_per_socket()
 check_metric_only()
 {
        echo -n "Checking json output: metric only "
+       if [ "$(uname -m)" = "s390x" ] && ! grep '^facilities' /proc/cpuinfo  | grep -qw 67
+       then
+               echo "[Skip] CPU-measurement counter facility not installed"
+               return
+       fi
        perf stat -j --metric-only -e instructions,cycles -o "${stat_output}" true
        $PYTHON $pythonchecker --metric-only --file "${stat_output}"
        echo "[Success]"