linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/10] riscv: Allow userspace to directly access perf counters
@ 2023-05-12  8:53 Alexandre Ghiti
  2023-05-12  8:53 ` [PATCH v2 01/10] perf: Fix wrong comment about default event_idx Alexandre Ghiti
                   ` (11 more replies)
  0 siblings, 12 replies; 46+ messages in thread
From: Alexandre Ghiti @ 2023-05-12  8:53 UTC (permalink / raw)
  To: Jonathan Corbet, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, Ian Rogers, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Atish Patra, Anup Patel, Will Deacon,
	Rob Herring, Andrew Jones, linux-doc, linux-kernel,
	linux-perf-users, linux-riscv, linux-arm-kernel
  Cc: Alexandre Ghiti

riscv used to allow direct access to cycle/time/instret counters,
bypassing the perf framework, this patchset intends to allow the user to
mmap any counter when accessed through perf. But we can't break the
existing behaviour so we introduce a sysctl perf_user_access like arm64
does, which defaults to the legacy mode described above.

*Note* that there are still ongoing discussions around which mode should
be the default mode with distro people.

base-commit-tag: v6.3

Changes in v2:
- Split into smaller patches, way better!
- Add RB from Conor
- Simplify the way we checked riscv architecture
- Fix race mmap and other thread running on other cpus
- Use hwc when available
- Set all userspace access flags in event_init, too cumbersome to handle sysctl changes
- Fix arch_perf_update_userpage for pmu other than riscv-pmu by renaming pmu driver
- Fixed kernel test robot build error
- Fixed documentation (Andrew and Bagas)
- perf testsuite passes mmap tests in all 3 modes

Alexandre Ghiti (10):
  perf: Fix wrong comment about default event_idx
  include: riscv: Fix wrong include guard in riscv_pmu.h
  riscv: Make legacy counter enum match the HW numbering
  drivers: perf: Rename riscv pmu driver
  riscv: Prepare for user-space perf event mmap support
  drivers: perf: Implement perf event mmap support in the legacy backend
  drivers: perf: Implement perf event mmap support in the SBI backend
  Documentation: admin-guide: Add riscv sysctl_perf_user_access
  tools: lib: perf: Implement riscv mmap support
  perf: tests: Adapt mmap-basic.c for riscv

 Documentation/admin-guide/sysctl/kernel.rst |  24 ++-
 arch/riscv/kernel/Makefile                  |   2 +-
 arch/riscv/kernel/perf_event.c              |  74 ++++++++
 drivers/perf/riscv_pmu.c                    |  41 ++++
 drivers/perf/riscv_pmu_legacy.c             |  37 +++-
 drivers/perf/riscv_pmu_sbi.c                | 196 +++++++++++++++++++-
 include/linux/perf/riscv_pmu.h              |  10 +-
 include/linux/perf_event.h                  |   3 +-
 tools/lib/perf/mmap.c                       |  65 +++++++
 tools/perf/tests/mmap-basic.c               |   4 +-
 10 files changed, 435 insertions(+), 21 deletions(-)
 create mode 100644 arch/riscv/kernel/perf_event.c

-- 
2.37.2


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

end of thread, other threads:[~2023-06-21 23:37 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12  8:53 [PATCH v2 00/10] riscv: Allow userspace to directly access perf counters Alexandre Ghiti
2023-05-12  8:53 ` [PATCH v2 01/10] perf: Fix wrong comment about default event_idx Alexandre Ghiti
2023-05-31 13:54   ` Andrew Jones
2023-06-15  7:10     ` Alexandre Ghiti
2023-06-15  8:24       ` Atish Patra
2023-05-12  8:53 ` [PATCH v2 02/10] include: riscv: Fix wrong include guard in riscv_pmu.h Alexandre Ghiti
2023-05-31 13:56   ` Andrew Jones
2023-06-15  8:36     ` Atish Patra
2023-05-12  8:53 ` [PATCH v2 03/10] riscv: Make legacy counter enum match the HW numbering Alexandre Ghiti
2023-05-31 14:01   ` Andrew Jones
2023-06-15  7:16     ` Alexandre Ghiti
2023-05-12  8:53 ` [PATCH v2 04/10] drivers: perf: Rename riscv pmu driver Alexandre Ghiti
2023-05-31 14:09   ` Andrew Jones
2023-06-15  7:25     ` Alexandre Ghiti
2023-06-15  8:34       ` Atish Patra
2023-05-12  8:53 ` [PATCH v2 05/10] riscv: Prepare for user-space perf event mmap support Alexandre Ghiti
2023-05-31 14:24   ` Andrew Jones
2023-06-16  8:28   ` Atish Patra
2023-06-16  8:56     ` Alexandre Ghiti
2023-06-20 15:27       ` Atish Patra
2023-05-12  8:53 ` [PATCH v2 06/10] drivers: perf: Implement perf event mmap support in the legacy backend Alexandre Ghiti
2023-05-31 14:27   ` Andrew Jones
2023-06-15  7:38     ` Alexandre Ghiti
2023-05-12  8:53 ` [PATCH v2 07/10] drivers: perf: Implement perf event mmap support in the SBI backend Alexandre Ghiti
2023-05-31 15:02   ` Andrew Jones
2023-06-15  8:41     ` Atish Patra
2023-06-15 13:27       ` Heinrich Schuchardt
2023-06-16  7:44         ` Atish Patra
2023-06-15  9:52     ` Alexandre Ghiti
2023-05-12  8:53 ` [PATCH v2 08/10] Documentation: admin-guide: Add riscv sysctl_perf_user_access Alexandre Ghiti
2023-05-31 15:07   ` Andrew Jones
2023-05-31 17:08     ` Atish Patra
2023-06-15 10:00     ` Alexandre Ghiti
2023-05-12  8:53 ` [PATCH v2 09/10] tools: lib: perf: Implement riscv mmap support Alexandre Ghiti
2023-05-31 15:12   ` Andrew Jones
2023-06-16  8:43   ` Atish Patra
2023-06-16  9:06     ` Alexandre Ghiti
2023-06-19 19:04       ` Atish Patra
2023-05-12  8:53 ` [PATCH v2 10/10] perf: tests: Adapt mmap-basic.c for riscv Alexandre Ghiti
2023-05-31 15:15   ` Andrew Jones
2023-06-05 13:53     ` Arnaldo Carvalho de Melo
2023-06-05 14:02       ` Alexandre Ghiti
     [not found]       ` <CAHVXubhofC+WaSysWaxcTA2GdJAF8kTD3COBeQDAy25af_rSLg@mail.gmail.com>
2023-06-05 14:31         ` Arnaldo Carvalho de Melo
2023-06-15 10:02     ` Alexandre Ghiti
2023-05-15 17:50 ` [PATCH v2 00/10] riscv: Allow userspace to directly access perf counters Conor Dooley
2023-06-21 23:37 ` Palmer Dabbelt

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).