ounting of PMU events depending on how much the event increments on
a single cycle. Two new config fields for perf_event_open have been
added, and a PMU cap file for reading the max_threshold. See the second
commit message and the docs in the last commit for more details.
The feature is not currently supported on KVM guests, and PMMIR is set
to read as zero, so it's not advertised as available. But it can be
added at a later time. Writes to PMEVTYPER.TC and TH from guests are
already RES0.
The change has been validated on the Arm FVP model:
a) Zero values, works as expected (as before).
$ perf stat -e dtlb_walk/threshold=0,threshold_compare=0/ -- true
5962 dtlb_walk/threshold=0,threshold_compare=0/
b) Threshold >= 255 causes count to be 0 because dtlb_walk doesn't
increase by more than 1 per cycle.
$ perf stat -e dtlb_walk/threshold=255,threshold_compare=2/ -- true
0 dtlb_walk/threshold=255,threshold_compare=2/
c) Keeping comparison as >= but lowering the threshold to 1 makes the
count return.
$ perf stat -e dtlb_walk/threshold=1,threshold_compare=2/ -- true
6329 dtlb_walk/threshold=1,threshold_compare=2/
Anshuman Khandual (3):
drivers: perf: arm_pmuv3: Read PMMIR_EL1 unconditionally
drivers: perf: arm_pmuv3: Drop some unused arguments from
armv8_pmu_init()
drivers: perf: arm_pmuv3: Add new macro PMUV3_INIT_MAP_EVENT()
James Clark (11):
arm: perf: Remove inlines from arm_pmuv3.c
arm: perf/kvm: Use GENMASK for ARMV8_PMU_PMCR_N
arm: perf: Use GENMASK for PMMIR fields
arm: perf: Convert remaining fields to use GENMASK
arm64: perf: Include threshold control fields in PMEVTYPER mask
arm: pmu: Share user ABI format mechanism with SPE
perf/arm_dmc620: Remove duplicate format attribute #defines
arm: pmu: Move error message and -EOPNOTSUPP to individual PMUs
arm64: perf: Add support for event counting threshold
Documentation: arm64: Document the PMU event counting threshold
feature
arm: perf: Fix ARCH=arm build with GCC
Oliver Upton (2):
KVM: arm64: Make PMEVTYPER<n>_EL0.NSH RES0 if EL2 isn't advertised
KVM: arm64: Add PMU event filter bits required if EL3 is implemented
Reiji Watanabe (1):
KVM: arm64: PMU: Add a helper to read a vCPU's PMCR_EL0
Rob Herring (Arm) (1):
perf: arm_pmuv3: Avoid assigning fixed cycle counter with threshold
Will Deacon (1):
Revert "perf/arm_dmc620: Remove duplicate format attribute #defines"
Documentation/arch/arm64/perf.rst | 72 ++++++++
arch/arm/kernel/perf_event_v7.c | 6 +-
arch/arm64/kvm/arm.c | 3 +-
arch/arm64/kvm/pmu-emul.c | 58 +++++--
arch/arm64/kvm/sys_regs.c | 21 ++-
drivers/perf/apple_m1_cpu_pmu.c | 6 +-
drivers/perf/arm_pmu.c | 11 +-
drivers/perf/arm_pmuv3.c | 274 ++++++++++++++++++------------
drivers/perf/arm_spe_pmu.c | 22 ---
include/kvm/arm_pmu.h | 11 ++
include/linux/perf/arm_pmu.h | 22 +++
include/linux/perf/arm_pmuv3.h | 43 +++--
12 files changed, 366 insertions(+), 183 deletions(-)
--
2.33.0