[PATCH 0/3] perf/core: Assert PERF_EVENT_FLAG_ARCH is followed

From: Anshuman Khandual
Date: Mon Aug 29 2022 - 02:55:26 EST


This series ensures that PERF_EVENT_FLAG_ARCH mask is followed correctly,
while defining all the platform specific hardware event flags. But after
adding these checks, there are couple of build failures on x86 platform
like the following.

BUILD_BUG_ON(~PERF_EVENT_FLAG_ARCH & PERF_X86_EVENT_AMD_BRS)
BUILD_BUG_ON(~PERF_EVENT_FLAG_ARCH & PERF_X86_EVENT_PEBS_LAT_HYBRID)

This happens because both these flags PERF_X86_EVENT_AMD_BRS (0x10000) and
PERF_X86_EVENT_PEBS_LAT_HYBRID (0x20000) falls outside PERF_EVENT_FLAG_ARCH
(0x0000ffff). Given that x86 platform is already using up all available bit
positions, should this platform flags mask be extended to (0x000fffff) ?

This seires applies on v6.0-rc3.

Anshuman Khandual (3):
perf/core: Assert PERF_EVENT_FLAG_ARCH does not overlap with generic flags
arm64/perf: Assert all platform event flags are within PERF_EVENT_FLAG_ARCH
x86/perf: Assert all platform event flags are within PERF_EVENT_FLAG_ARCH

arch/arm64/kernel/perf_event.c | 1 +
arch/x86/events/amd/core.c | 2 ++
arch/x86/events/core.c | 16 ++++++++++++++++
drivers/perf/apple_m1_cpu_pmu.c | 1 +
drivers/perf/arm_spe_pmu.c | 1 +
kernel/events/core.c | 1 +
6 files changed, 22 insertions(+)

--
2.25.1