From: James Clark <james.clark@linaro.org>
To: Ian Rogers <irogers@google.com>,
Michael Petlan <mpetlan@redhat.com>,
Qiao Zhao <qzhao@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>
Cc: Leo Yan <leo.yan@arm.com>, Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Paul Walmsley <pjw@kernel.org>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexandre Ghiti <alex@ghiti.fr>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-riscv@lists.infradead.org,
James Clark <james.clark@linaro.org>
Subject: [PATCH v6 0/2] perf tests: mmap-basic: fix user rdpmc detection logic
Date: Wed, 07 Oct 2026 11:52:11 +0100 [thread overview]
Message-ID: <20261007-rdpmc-detection-logic-v6-0-d7ed6a85f864@linaro.org> (raw)
I'm sending this to fix the comments that I left on the "V3 resend"
because I don't think Qiao sent a V4 and it's been quite a while.
There were also some unreported bugs that I found during testing.
Changes in v6:
- Also skip on EROFS if sysfs was mounted as read-only
- Don't perf_evsel__delete() on NULL evsels
- Don't try to write or restore if the read failed
- Use existing "goto cleanup" pattern instead of continue
- Link to v5: https://patch.msgid.link/20261006-rdpmc-detection-logic-v5-0-b25c9d49baa1@linaro.org
Changes in v5:
- Keep rdpmc_supported variable name.
- Keep enum instead of int.
- Remove #ifdef __aarch64__ in the capability tests that made the
cap_user_rdpmc test diverge. Now cap_user_rdpmc and pc->index are
tested in the same way for all architectures that support user rdpmc.
- Disable running the 'enabled' version for unsupported arches which was
equivalent to running the 'disabled' one twice and to be able to
simplify the test.
- Link to v4: https://patch.msgid.link/20260817-rdpmc-detection-logic-v4-1-c22074578f6a@linaro.org
Changes in V4:
- Don't remove pc->index check. Without it Perf can silently fall back
to the read() syscall and the test is useless.
- Test the 'expected disabled' case for Arm in an ifdef to workaround
platform differences.
- lseek() before writing to perf_user_access otherwise it's ignored.
- Support restoring arbitrary values to perf_user_access because RISC-V
uses '2' for legacy mode.
- Rename rdpmc_supported to rdpmc_expected as this is what the test
expects, not what the system does.
- Label pc->index as rdpmc_event_active for clarity.
- Add comments and simplify the commit message.
Signed-off-by: James Clark <james.clark@linaro.org>
---
James Clark (2):
perf tests: mmap-basic: Only test userspace reading on supported platforms
perf tests: mmap-basic: fix user rdpmc detection logic
tools/perf/tests/mmap-basic.c | 188 +++++++++++++++++++++++++-----------------
1 file changed, 113 insertions(+), 75 deletions(-)
---
base-commit: 1dc462fc214907671600172280c2e79ef9fe6fcf
change-id: 20260817-rdpmc-detection-logic-d3f7a49cfb46
Best regards,
--
James Clark <james.clark@linaro.org>
next reply other threads:[~2026-10-07 10:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 10:52 James Clark [this message]
2026-10-07 10:52 ` [PATCH v6 1/2] perf tests: mmap-basic: Only test userspace reading on supported platforms James Clark
2026-10-07 11:05 ` sashiko-bot
2026-10-07 10:52 ` [PATCH v6 2/2] perf tests: mmap-basic: fix user rdpmc detection logic James Clark
2026-10-07 11:02 ` sashiko-bot
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=20261007-rdpmc-detection-logic-v6-0-d7ed6a85f864@linaro.org \
--to=james.clark@linaro.org \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alex@ghiti.fr \
--cc=alexander.shishkin@linux.intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=mpetlan@redhat.com \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=peterz@infradead.org \
--cc=pjw@kernel.org \
--cc=qzhao@redhat.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