linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Richter <tmricht@linux.ibm.com>
To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	acme@kernel.org, irogers@google.com
Cc: svens@linux.ibm.com, gor@linux.ibm.com, sumanthk@linux.ibm.com,
	hca@linux.ibm.com, agordeev@linux.ibm.com,
	Thomas Richter <tmricht@linux.ibm.com>
Subject: [PATCH] perf test: test case 17 fails on s390 on z/vm
Date: Tue, 19 Dec 2023 15:32:35 +0100	[thread overview]
Message-ID: <20231219143235.1075522-1-tmricht@linux.ibm.com> (raw)

perf test 17 'Setup struct perf_event_attr' fails on s390 z/VM guest,
using linux-next kernel.
Root cause is the fall-back from hardware counter cycles

 perf_event_attr:
  type                             0 (PERF_TYPE_HARDWARE)
  size                             136
  config                           0 (PERF_COUNT_HW_CPU_CYCLES)
  { sample_period, sample_freq }   4000
  sample_type                      IP|TID|TIME|ADDR|PERIOD|DATA_SRC
  read_format                      ID|LOST

which returns -ENOENT on s390 z/VM guest. This causes the code to
fall back to software counter task-clock, as can be seen in the
debug output.
------------------------------------------------------------
 perf_event_attr:
  type                             1 (PERF_TYPE_SOFTWARE)
  size                             136
  config                           0x1 (PERF_COUNT_SW_TASK_CLOCK) <-here
  { sample_period, sample_freq }   4000
  sample_type                      IP|TID|TIME|ADDR|PERIOD|DATA_SRC
  read_format                      ID|LOST

This succeeds on s390 z/VM guest.
This successful installation of the counter task-clock is not listed
in the expected results and the test case fails.

This is caused by commit
commit eb2eac0c7b61 ("perf evsel: Fallback to "task-clock" when not system wide")
which introduced fall back from event 'cycles' to event 'task-clock'.

To fix this on s390 allow event number 0 (cycles) and event number 1
(task-clock) as expected result.

Output before:
 # ./perf test -Fv 17
 17: Setup struct perf_event_attr                                    :
 --- start ---
 running './tests/attr/test-stat-group1'
 unsupp  './tests/attr/test-stat-group1'
 running './tests/attr/test-record-graph-default'
 test limitation '!aarch64'
 excluded architecture list ['aarch64']
 expected config=0, got 1
 FAILED './tests/attr/test-record-graph-default' - match failure
 ---- end ----
 Setup struct perf_event_attr: FAILED!
 #

Output after:
 # ./perf test -F 17
 17: Setup struct perf_event_attr               : Ok
 #

Fixes: eb2eac0c7b61 ("perf evsel: Fallback to "task-clock" when not system wide")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/tests/attr/base-record | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/attr/base-record b/tools/perf/tests/attr/base-record
index 27c21271a16c..b44e4e6e4443 100644
--- a/tools/perf/tests/attr/base-record
+++ b/tools/perf/tests/attr/base-record
@@ -6,7 +6,7 @@ flags=0|8
 cpu=*
 type=0|1
 size=136
-config=0
+config=0|1
 sample_period=*
 sample_type=263
 read_format=0|4|20
-- 
2.43.0


                 reply	other threads:[~2023-12-19 14:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231219143235.1075522-1-tmricht@linux.ibm.com \
    --to=tmricht@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=irogers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).