[RFC 0/3] perf/x86: Rework RDPMC access handling
From: Rob Herring <robh@kernel.org>
Date: 2021-07-28 23:02:39
Also in:
lkml
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