[PATCH 09/12] perf/x86/intel/uncore: Fix SKX/SNR/ICX PCI extended umask truncation

From: Zide Chen

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


{icx,skx}_uncore_upi and {icx,snr}_uncore_m2m set event_mask_ext, but
the callbacks snbep_uncore_pci_{enable,disable}_event() only write the
lower config dword. As a result, extended umask bits are silently
dropped on enable and left uncleared on disable.

For example, on Ice Lake Server, the UNC_M2M_IMC_READS.TO_PMM event
(event=0x37, umask=0x0720) loses its filter, and the hardware counts
all reads instead of only PMM reads:

# perf stat -a -e uncore_m2m_0/event=0x37,umask=0x0720/ -- sleep 1

Use uncore_pci_{write,clear}_event_ctl() to program and clear the upper
dword at config_base + 4.

Writing 0 to the lower dword on disable stops the counter by clearing
the enable bit (bit 22), matching generic discovery and other uncore
disable callbacks.

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

diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 0b8057d142c1..3f6fd636829a 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -604,18 +604,14 @@ static void snbep_uncore_pci_enable_box(struct intel_uncore_box *box)

static void snbep_uncore_pci_enable_event(struct intel_uncore_box *box, struct perf_event *event)
{
- struct pci_dev *pdev = box->pci_dev;
struct hw_perf_event *hwc = &event->hw;

- pci_write_config_dword(pdev, hwc->config_base, hwc->config | SNBEP_PMON_CTL_EN);
+ uncore_pci_write_event_ctl(box, hwc, hwc->config | SNBEP_PMON_CTL_EN);
}

static void snbep_uncore_pci_disable_event(struct intel_uncore_box *box, struct perf_event *event)
{
- struct pci_dev *pdev = box->pci_dev;
- struct hw_perf_event *hwc = &event->hw;
-
- pci_write_config_dword(pdev, hwc->config_base, hwc->config);
+ uncore_pci_clear_event_ctl(box, &event->hw);
}

static u64 snbep_uncore_pci_read_counter(struct intel_uncore_box *box, struct perf_event *event)
--
2.56.1