Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v6 0/2] perf tests: mmap-basic: fix user rdpmc detection logic
@ 2026-10-07 10:52 James Clark
  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 10:52 ` [PATCH v6 2/2] perf tests: mmap-basic: fix user rdpmc detection logic James Clark
  0 siblings, 2 replies; 5+ messages in thread
From: James Clark @ 2026-10-07 10:52 UTC (permalink / raw)
  To: Ian Rogers, Michael Petlan, Qiao Zhao, Arnaldo Carvalho de Melo,
	Namhyung Kim
  Cc: Leo Yan, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Adrian Hunter, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti, linux-perf-users,
	linux-kernel, linux-riscv, James Clark

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>


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

end of thread, other threads:[~2026-10-07 11:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-07 10:52 [PATCH v6 0/2] perf tests: mmap-basic: fix user rdpmc detection logic James Clark
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

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