* [PATCH] perf: arm_v7_pmu: suppress -Winitializer-overrides for perf maps
@ 2026-11-11 2:33 Rosen Penev
0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2026-11-11 2:33 UTC (permalink / raw)
To: Will Deacon, Mark Rutland, Nathan Chancellor
Cc: Nick Desaulniers, Bill Wendling, Justin Stitt, linux-arm-kernel,
linux-perf-users, linux-kernel, llvm
The perf_map and cache_map arrays intentionally use a range initializer
to fill all entries with HW_OP_UNSUPPORTED / CACHE_OP_UNSUPPORTED, then
override specific entries with supported event codes. This is valid C99
designated initializer behavior (last initializer wins), but Clang's
-Winitializer-overrides warns about each overridden entry.
Suppress the warning around these array definitions using the kernel's
__diag infrastructure, since the pattern is intentional and widespread
across all CPU-specific perf map variants in this file.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/perf/arm_v7_pmu.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/perf/arm_v7_pmu.c b/drivers/perf/arm_v7_pmu.c
index a1e438101114..9ac28c8adf80 100644
--- a/drivers/perf/arm_v7_pmu.c
+++ b/drivers/perf/arm_v7_pmu.c
@@ -146,6 +146,15 @@
#define SCORPION_ITLB_MISS 0x12021
+/*
+ * The perf_map and cache_map arrays use range initializers to fill all
+ * entries with HW_OP_UNSUPPORTED / CACHE_OP_UNSUPPORTED, then override
+ * specific entries with supported event codes. This is valid C99 but
+ * triggers Clang's -Winitializer-overrides.
+ */
+__diag_push();
+__diag_ignore_all("-Winitializer-overrides", "");
+
/*
* Cortex-A8 HW events mapping
*
@@ -530,6 +539,8 @@ static const unsigned scorpion_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
[C(BPU)][C(OP_WRITE)][C(RESULT_MISS)] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
};
+__diag_pop();
+
PMU_FORMAT_ATTR(event, "config:0-7");
static struct attribute *armv7_pmu_format_attrs[] = {
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-11 2:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-11 2:33 [PATCH] perf: arm_v7_pmu: suppress -Winitializer-overrides for perf maps Rosen Penev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®