Skip to content

perf: Rework event_init checks

Robin Murphy amd-gfx dmaengine dri-devel imx intel-gfx intel-xe linux-alpha linux-amlogic linux-arm-kernel linux-arm-msm linux-csky linux-cxl linux-fpga linux-iommu linux-mips linux-perf-users linux-pm linux-riscv linux-rockchip linux-s390 linux-sh linux-snps-arc linuxppc-dev lkml llvm loongarch oe-kbuild-all oe-lkp sparclinux 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest19 patches 28 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19perf/arm-cmn: Fix event validationdrivers/perf/arm-cmn.c+1 -41 reply
2/19perf/hisilicon: Fix group validationdrivers/perf/hisilicon/hisi_pcie_pmu.c drivers/perf/hisilicon/hisi_uncore_pmu.c drivers/perf/hisilicon/hns3_pmu.c+19 -386 replies
3/19perf/imx8_ddr: Fix group validationdrivers/perf/fsl_imx8_ddr_perf.c+5 -160 replies
4/19perf/starfive: Fix group validationdrivers/perf/starfive_starlink_pmu.c+7 -110 replies
5/19iommu/vt-d: Fix perfmon group validationdrivers/iommu/intel/perfmon.c+11 -70 replies
6/19ARM: l2x0: Fix group validationarch/arm/mm/cache-l2x0-pmu.c+4 -50 replies
7/19ARM: imx: Fix MMDC PMU group validationarch/arm/mach-imx/mmdc.c+6 -90 replies
8/19perf/arm_smmu_v3: Improve group validationdrivers/perf/arm_smmuv3_pmu.c+9 -130 replies
9/19perf/qcom: Improve group validationdrivers/perf/qcom_l2_pmu.c drivers/perf/qcom_l3_pmu.c+37 -580 replies
10/19perf/arm-ni: Improve event validationdrivers/perf/arm-ni.c+13 -160 replies
11/19perf/arm-cci: Tidy up event validationdrivers/perf/arm-cci.c+12 -350 replies
12/19perf: Ignore event state for group validationarch/alpha/kernel/perf_event.c arch/powerpc/perf/core-book3s.c arch/powerpc/perf/core-fsl-emb.c +5 more+7 -185 replies
13/19perf: Add helper for checking grouped eventsarch/x86/events/amd/ibs.c drivers/devfreq/event/rockchip-dfi.c drivers/perf/alibaba_uncore_drw_pmu.c +5 more+24 -660 replies
14/19perf: Clean up redundant group validationdrivers/perf/arm-ccn.c drivers/perf/fsl_imx9_ddr_perf.c drivers/perf/marvell_cn10k_ddr_pmu.c +1 more+0 -520 replies
15/19perf: Simplify group validationdrivers/perf/arm_cspmu/arm_cspmu.c drivers/perf/arm_dsu_pmu.c drivers/perf/arm_pmu.c +1 more+13 -410 replies
16/19perf: Introduce positive capability for samplingarch/alpha/kernel/perf_event.c arch/arc/kernel/perf_event.c arch/csky/kernel/perf_event.c +20 more+44 -146 replies
17/19perf: Retire PERF_PMU_CAP_NO_INTERRUPTarch/arc/kernel/perf_event.c arch/csky/kernel/perf_event.c arch/powerpc/perf/8xx-pmu.c +19 more+18 -651 reply
18/19perf: Introduce positive capability for raw eventsarch/s390/kernel/perf_cpum_cf.c arch/s390/kernel/perf_pai_crypto.c arch/s390/kernel/perf_pai_ext.c +4 more+21 -37 replies
19/19perf: Garbage-collect event_init checksarch/arm/mach-imx/mmdc.c arch/arm/mm/cache-l2x0-pmu.c arch/powerpc/perf/hv-24x7.c +52 more+1 -5902 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 00/19] perf: Rework event_init checks

Hi all,

[ Note I'm only CC'ing lists for now to avoid spamming nearly 100
individual maintainers/reviewers while we work out the basics ]

Reviving my idea from a few years back, the aim here is to minimise the amount of event_init boilerplate that most new drivers have to implement (and so many get wrong), while also trying to establish some more consistent and easy-to-follow patterns for the things that drivers should still care about (mostly group validation).

It's ended up somewhat big and ugly, so to start with I've tried to optimise for ease of review - based on the typical "fixes, cleanup, new development" order the split of the current patches is like so:

* Group validation rework (patches #1-#15)
- Specific drivers with functional issues by inspection (#1-#7)
- Specific drivers where cleanup changes were non-trivial (#8-#11)
- Common patterns across remaining drivers (#12-#15)
* Capabilities rework (patches #16-#18)
* Giant bonfire of remaining boilerplate! (patch #19)

If the overall idea is acceptable then a more relaxed merge strategy might be to look at landing the common parts first (#16-#18 and maybe #13), then rearrange the rest into per-driver patches, but I'm sure nobody wants a ~70-patch series out of the gate :)

Thanks,
Robin.

Robin Murphy (19):
perf/arm-cmn: Fix event validation perf/hisilicon: Fix group validation perf/imx8_ddr: Fix group validation perf/starfive: Fix group validation iommu/vt-d: Fix perfmon group validation
ARM: l2x0: Fix group validation
ARM: imx: Fix MMDC PMU group validation perf/arm_smmu_v3: Improve group validation perf/qcom: Improve group validation perf/arm-ni: Improve event validation perf/arm-cci: Tidy up event validation
perf: Ignore event state for group validation
perf: Add helper for checking grouped events
perf: Clean up redundant group validation
perf: Simplify group validation
perf: Introduce positive capability for sampling
perf: Retire PERF_PMU_CAP_NO_INTERRUPT
perf: Introduce positive capability for raw events
perf: Garbage-collect event_init checks

 arch/alpha/kernel/perf_event.c                |  5 +-
 arch/arc/kernel/perf_event.c                  |  4 +-
 arch/arm/mach-imx/mmdc.c                      | 29 ++----
 arch/arm/mm/cache-l2x0-pmu.c                  | 19 +---
 arch/csky/kernel/perf_event.c                 |  3 +-
 arch/loongarch/kernel/perf_event.c            |  1 +
 arch/mips/kernel/perf_event_mipsxx.c          |  1 +
 arch/powerpc/perf/8xx-pmu.c                   |  3 +-
 arch/powerpc/perf/core-book3s.c               |  4 +-
 arch/powerpc/perf/core-fsl-emb.c              |  4 +-
 arch/powerpc/perf/hv-24x7.c                   | 11 ---
 arch/powerpc/perf/hv-gpci.c                   | 11 ---
 arch/powerpc/perf/imc-pmu.c                   | 31 +-----
 arch/powerpc/perf/kvm-hv-pmu.c                |  5 +-
 arch/powerpc/perf/vpa-pmu.c                   | 13 +--
 arch/powerpc/platforms/pseries/papr_scm.c     | 18 +---
 arch/s390/kernel/perf_cpum_cf.c               |  8 +-
 arch/s390/kernel/perf_cpum_sf.c               |  2 +
 arch/s390/kernel/perf_pai_crypto.c            |  1 +
 arch/s390/kernel/perf_pai_ext.c               |  1 +
 arch/sh/kernel/perf_event.c                   |  1 -
 arch/sparc/kernel/perf_event.c                |  4 +-
 arch/x86/events/amd/ibs.c                     | 32 ++-----
 arch/x86/events/amd/iommu.c                   | 15 ---
 arch/x86/events/amd/power.c                   |  7 --
 arch/x86/events/amd/uncore.c                  | 12 +--
 arch/x86/events/core.c                        |  7 +-
 arch/x86/events/intel/bts.c                   |  3 -
 arch/x86/events/intel/cstate.c                | 16 +---
 arch/x86/events/intel/pt.c                    |  3 -
 arch/x86/events/intel/uncore.c                | 16 +---
 arch/x86/events/intel/uncore_snb.c            | 18 ----
 arch/x86/events/msr.c                         |  8 +-
 arch/x86/events/rapl.c                        | 11 ---
 arch/xtensa/kernel/perf_event.c               |  1 +
 drivers/devfreq/event/rockchip-dfi.c          | 13 +--
 drivers/dma/idxd/perfmon.c                    | 17 +---
 drivers/fpga/dfl-fme-perf.c                   | 18 +---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pmu.c       |  4 -
 drivers/gpu/drm/i915/i915_pmu.c               | 13 ---
 drivers/gpu/drm/xe/xe_pmu.c                   | 13 ---
 .../hwtracing/coresight/coresight-etm-perf.c  |  5 -
 drivers/hwtracing/ptt/hisi_ptt.c              |  8 --
 drivers/iommu/intel/perfmon.c                 | 28 +++---
 drivers/perf/alibaba_uncore_drw_pmu.c         | 28 +-----
 drivers/perf/amlogic/meson_ddr_pmu_core.c     |  9 --
 drivers/perf/arm-cci.c                        | 56 +++--------
 drivers/perf/arm-ccn.c                        | 34 -------
 drivers/perf/arm-cmn.c                        | 15 +--
 drivers/perf/arm-ni.c                         | 35 +++----
 drivers/perf/arm_cspmu/arm_cspmu.c            | 34 +------
 drivers/perf/arm_dmc620_pmu.c                 | 28 +-----
 drivers/perf/arm_dsu_pmu.c                    | 26 +----
 drivers/perf/arm_pmu.c                        | 19 +---
 drivers/perf/arm_pmu_platform.c               |  2 +-
 drivers/perf/arm_smmuv3_pmu.c                 | 35 ++-----
 drivers/perf/arm_spe_pmu.c                    |  7 +-
 drivers/perf/cxl_pmu.c                        |  6 --
 drivers/perf/dwc_pcie_pmu.c                   | 21 +---
 drivers/perf/fsl_imx8_ddr_perf.c              | 32 +------
 drivers/perf/fsl_imx9_ddr_perf.c              | 27 ------
 drivers/perf/hisilicon/hisi_pcie_pmu.c        | 25 ++---
 drivers/perf/hisilicon/hisi_uncore_pmu.c      | 41 ++------
 drivers/perf/hisilicon/hns3_pmu.c             | 24 ++---
 drivers/perf/marvell_cn10k_ddr_pmu.c          | 18 ----
 drivers/perf/marvell_cn10k_tad_pmu.c          | 12 +--
 drivers/perf/marvell_pem_pmu.c                | 22 +----
 drivers/perf/qcom_l2_pmu.c                    | 96 ++++++-------------
 drivers/perf/qcom_l3_pmu.c                    | 33 ++-----
 drivers/perf/riscv_pmu_legacy.c               |  1 -
 drivers/perf/riscv_pmu_sbi.c                  |  3 +-
 drivers/perf/starfive_starlink_pmu.c          | 32 ++-----
 drivers/perf/thunderx2_pmu.c                  | 45 ++-------
 drivers/perf/xgene_pmu.c                      | 29 ------
 drivers/powercap/intel_rapl_common.c          |  9 +-
 include/linux/perf_event.h                    | 10 +-
 kernel/events/core.c                          | 35 +++++--
 kernel/events/hw_breakpoint.c                 |  1 +
 78 files changed, 244 insertions(+), 1053 deletions(-)
Signature · 1 line
2.39.2.101.g768bb238c484.dirty