Skip to content

RFC perf/x86: Rework RDPMC access handling

Rob Herring linux-perf-users lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3x86: perf: Move RDPMC event flag to a common definitionarch/x86/events/core.c arch/x86/events/perf_event.h include/linux/perf_event.h+8 -60 replies
2/3perf/x86: Control RDPMC access from .enable() hookarch/x86/events/core.c arch/x86/include/asm/mmu_context.h arch/x86/include/asm/perf_event.h +1 more+49 -6210 replies
3/3perf/x86: Call mmap event callbacks on event's CPUarch/x86/events/core.c arch/x86/include/asm/mmu.h include/linux/perf_event.h +1 more+61 -410 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 0/3] perf/x86: Rework RDPMC access handling

This series is preparation for supporting perf user counter access on arm64.

Originally, the arm64 implementation was just a copy of the x86 version, but Will did not like the mm_context state tracking nor the IPIs (mm_cpumask doesn't work for arm64). The hook into switch_mm and the IPIs feel like working around limitations in the perf core (aka the platform problem). So this series aims to solve that such that all the state for RDPMC is tracked and controlled via the perf core.

Alternatively, I could avoid all the x86 changes here with a new PMU callback (.set_user_access()?) and plumb that into the perf core context and mmap code. However, it's better in the long run if there's a common implementation.

So far, I've only tested the perf core changes with the arm64 version of the code which is similar to the x86 version here. I'm hoping for some quick feedback on the direction here and whether I've missed some usecase that isn't handled.

Rob

Rob Herring (3):
x86: perf: Move RDPMC event flag to a common definition perf/x86: Control RDPMC access from .enable() hook perf/x86: Call mmap event callbacks on event's CPU

 arch/x86/events/core.c             | 113 +++++++++++++++--------------
 arch/x86/events/perf_event.h       |   2 +-
 arch/x86/include/asm/mmu.h         |   1 -
 arch/x86/include/asm/mmu_context.h |   6 --
 arch/x86/include/asm/perf_event.h  |   1 -
 arch/x86/mm/tlb.c                  |  29 +-------
 include/linux/perf_event.h         |   9 ++-
 kernel/events/core.c               |  56 +++++++++++---
 8 files changed, 113 insertions(+), 104 deletions(-)

--
2.27.0