[Patch v2 14/16] perf/x86/intel: Only program ACR reload value for events with config2
From: Dapeng Mi
Date: Mon Nov 30 2026 - 19:46:48 EST
An ACR (Auto-Counter Reload) event requires its auto-reload value to be
programmed into the matching *_CFG_C MSR. This configuration is supplied
by the user via the event attribute's 'config2' field.
Currently, intel_pmu_enable_event_ext() unconditionally programs the
*_CFG_C MSR reload value for any event residing in an ACR event group,
without validating if 'config2' is actually configured. However, a
counting event with a zero 'config2' field can still reside within an ACR
event group; such an event should not have a reload value written to the
*_CFG_C reload field.
Enhance this check by ensuring that the RELOAD bits are only set
and programmed when the event belongs to an ACR group and 'config2' is
non-zero. This maintains consistency with intel_pmu_enable_acr() and
prevents erroneously setting up the auto-reload configuration for events
that were not explicitly requested to auto-reload.
Fixes: 5c3cdc74af25 ("perf/x86/intel: Consolidate MSR_IA32_PERF_CFG_C tracking")
Signed-off-by: Dapeng Mi <dapeng1.mi@xxxxxxxxxxxxxxx>
---
arch/x86/events/intel/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c
index 6d1038186197..9906eaaef49c 100644
--- a/arch/x86/events/intel/core.c
+++ b/arch/x86/events/intel/core.c
@@ -3476,7 +3476,7 @@ static void intel_pmu_enable_event_ext(struct perf_event *event)
struct hw_perf_event *hwc = &event->hw;
u64 ext = 0;
- if (is_acr_event_group(event))
+ if (is_acr_event_group(event) && event->attr.config2)
ext |= (-hwc->sample_period) & ARCH_PEBS_RELOAD;
if (event->attr.precise_ip) {
--
2.34.1