[PATCH 01/12] perf/x86/intel/uncore: Fix PCU filter band mask calculation

From: Zide Chen

Date: Fri Dec 04 2026 - 22:34:35 EST


In hswep_pcu_hw_config() and snr_pcu_hw_config(), the filter band mask
is calculated as (0xff << reg1->idx) instead of
(0xff << (reg1->idx * 8)). Consequently, bits 9-15 of filter band 1 are
dropped, and filter bands 2 and 3 are completely cleared to zero.

Fix the shift calculation to (reg1->idx * 8) in both functions, and use
0xffULL to ensure an unsigned 64-bit mask. Also use 0xffULL in
snbep_pcu_hw_config() for consistency and to avoid signed integer
overflow when idx is 3.

Fixes: e735b9db12d7 ("perf/x86/intel/uncore: Add Haswell-EP uncore support")
Fixes: 210cc5f9db7a ("perf/x86/intel/uncore: Add uncore support for Snow Ridge server")
Signed-off-by: Zide Chen <zide.chen@xxxxxxxxx>
---
arch/x86/events/intel/uncore_snbep.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 1b460cf27a10..36f56163e07e 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -1130,7 +1130,7 @@ static int snbep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *
if (ev_sel >= 0xb && ev_sel <= 0xe) {
reg1->reg = SNBEP_PCU_MSR_PMON_BOX_FILTER;
reg1->idx = ev_sel - 0xb;
- reg1->config = event->attr.config1 & (0xff << (reg1->idx * 8));
+ reg1->config = event->attr.config1 & (0xffULL << (reg1->idx * 8));
}
return 0;
}
@@ -2853,7 +2853,7 @@ static int hswep_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *
if (ev_sel >= 0xb && ev_sel <= 0xe) {
reg1->reg = HSWEP_PCU_MSR_PMON_BOX_FILTER;
reg1->idx = ev_sel - 0xb;
- reg1->config = event->attr.config1 & (0xff << reg1->idx);
+ reg1->config = event->attr.config1 & (0xffULL << (reg1->idx * 8));
}
return 0;
}
@@ -4763,7 +4763,7 @@ static int snr_pcu_hw_config(struct intel_uncore_box *box, struct perf_event *ev
if (ev_sel >= 0xb && ev_sel <= 0xe) {
reg1->reg = SNR_PCU_MSR_PMON_BOX_FILTER;
reg1->idx = ev_sel - 0xb;
- reg1->config = event->attr.config1 & (0xff << reg1->idx);
+ reg1->config = event->attr.config1 & (0xffULL << (reg1->idx * 8));
}
return 0;
}
--
2.56.1