* [PATCH 01/12] perf/x86/intel/uncore: Fix PCU filter band mask calculation
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 02/12] perf/x86/intel/uncore: Fix ICX UPI and M3UPI box control offset Zide Chen
` (11 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
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@intel.com>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 02/12] perf/x86/intel/uncore: Fix ICX UPI and M3UPI box control offset
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
2026-12-05 3:22 ` [PATCH 01/12] perf/x86/intel/uncore: Fix PCU filter band mask calculation Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 03/12] perf/x86/intel/uncore: Replace CTL_OFFS8 box flag with type flag Zide Chen
` (10 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
skx_upi_uncore_pci_init_box() and ivbep_uncore_pci_init_box() hardcoded
SKX_UPI_PCI_PMON_BOX_CTL (0x378) and SNBEP_PCI_PMON_BOX_CTL (0xf4).
When shared with ICX (icx_uncore_upi and icx_uncore_m3upi), these
hardcoded offsets caused init writes to hit unrelated PCI configuration
space instead of the ICX-specific box control registers at 0x318 and
0xa0.
Use uncore_pci_box_ctl() to get the box control offset from the uncore
type. Existing IVB-EP and SKX users of ivbep_uncore_pci_init_box() are
unaffected because their box_ctl already equals
SNBEP_PCI_PMON_BOX_CTL (0xf4). skx_uncore_upi is likewise unaffected
because its box_ctl is SKX_UPI_PCI_PMON_BOX_CTL (0x378).
Fixes: 2b3b76b5ec67 ("perf/x86/intel/uncore: Add Ice Lake server uncore support")
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_snbep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 36f56163e07e..35212195b379 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -1525,7 +1525,7 @@ static int ivbep_uncore_pci_init_box(struct intel_uncore_box *box)
{
struct pci_dev *pdev = box->pci_dev;
- return pci_write_config_dword(pdev, SNBEP_PCI_PMON_BOX_CTL,
+ return pci_write_config_dword(pdev, uncore_pci_box_ctl(box),
IVBEP_PMON_BOX_CTL_INT);
}
@@ -4177,7 +4177,7 @@ static int skx_upi_uncore_pci_init_box(struct intel_uncore_box *box)
struct pci_dev *pdev = box->pci_dev;
__set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
- return pci_write_config_dword(pdev, SKX_UPI_PCI_PMON_BOX_CTL,
+ return pci_write_config_dword(pdev, uncore_pci_box_ctl(box),
IVBEP_PMON_BOX_CTL_INT);
}
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 03/12] perf/x86/intel/uncore: Replace CTL_OFFS8 box flag with type flag
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
2026-12-05 3:22 ` [PATCH 01/12] perf/x86/intel/uncore: Fix PCU filter band mask calculation Zide Chen
2026-12-05 3:22 ` [PATCH 02/12] perf/x86/intel/uncore: Fix ICX UPI and M3UPI box control offset Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 04/12] perf/x86/intel/uncore: Fix DMR MMIO counter control stride Zide Chen
` (9 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
Setting UNCORE_BOX_FLAG_CTL_OFFS8 during runtime box initialization
requires custom init_box callbacks, leading to unnecessary custom ops.
Counter control register stride is a static architectural property of
the PMU type, not dynamic runtime state of a box instance. Replacing
UNCORE_BOX_FLAG_CTL_OFFS8 with a 1-bit ctl_offs8 field in struct
intel_uncore_type is not only more accurate, but also allows the stride
to be handled in a more generic way.
Since all discovered PCI types have an 8-byte stride, set ctl_offs8 = 1
in uncore_update_uncore_type(), and set it in all other types whose
boxes currently carry the UNCORE_BOX_FLAG_CTL_OFFS8 flag.
This allows spr_uncore_mmio_offs8_init_box() and the associated ops
to be dropped, paving the way for more generic handling of 8-byte
stride MMIO boxes in DMR and other future platforms.
No functional change intended.
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore.h | 7 +++---
arch/x86/events/intel/uncore_discovery.c | 2 +-
arch/x86/events/intel/uncore_snbep.c | 31 +++++++++---------------
3 files changed, 15 insertions(+), 25 deletions(-)
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index c8dfa2d21bfd..c88949387b7c 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -91,6 +91,7 @@ struct intel_uncore_type {
unsigned num_shared_regs:8;
unsigned single_fixed:1;
unsigned pair_ctr_ctl:1;
+ unsigned ctl_offs8:1; /* counter control registers are 8 bytes apart */
union {
u64 *msr_offsets;
u64 *pci_offsets;
@@ -197,10 +198,8 @@ struct intel_uncore_box {
#define CFL_UNC_CBO_7_PER_CTR0 0xf76
#define UNCORE_BOX_FLAG_INITIALIZED 0
-/* event config registers are 8-byte apart */
-#define UNCORE_BOX_FLAG_CTL_OFFS8 1
/* CFL 8th CBOX has different MSR space */
-#define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 2
+#define UNCORE_BOX_FLAG_CFL8_CBOX_MSR_OFFS 1
struct uncore_event_desc {
struct device_attribute attr;
@@ -327,7 +326,7 @@ static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box)
static inline
unsigned uncore_pci_event_ctl(struct intel_uncore_box *box, int idx)
{
- if (test_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags))
+ if (box->pmu->type->ctl_offs8)
return idx * 8 + box->pmu->type->event_ctl;
return idx * 4 + box->pmu->type->event_ctl;
diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
index 99a1b974b14f..75fd3e52c540 100644
--- a/arch/x86/events/intel/uncore_discovery.c
+++ b/arch/x86/events/intel/uncore_discovery.c
@@ -585,7 +585,6 @@ int intel_generic_uncore_pci_init_box(struct intel_uncore_box *box)
if (!box_ctl)
return -ENODEV;
- __set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
return pci_write_config_dword(box->pci_dev, box_ctl,
GENERIC_PMON_BOX_CTL_INT);
}
@@ -746,6 +745,7 @@ static bool uncore_update_uncore_type(enum uncore_access_type type_id,
break;
case UNCORE_ACCESS_PCI:
uncore->ops = &generic_uncore_pci_ops;
+ uncore->ctl_offs8 = 1;
break;
case UNCORE_ACCESS_MMIO:
uncore->ops = &generic_uncore_mmio_ops;
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 35212195b379..e0be7a35baec 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -4176,7 +4176,6 @@ static int skx_upi_uncore_pci_init_box(struct intel_uncore_box *box)
{
struct pci_dev *pdev = box->pci_dev;
- __set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
return pci_write_config_dword(pdev, uncore_pci_box_ctl(box),
IVBEP_PMON_BOX_CTL_INT);
}
@@ -4326,6 +4325,7 @@ static struct intel_uncore_type skx_uncore_upi = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.event_mask_ext = SKX_UPI_CTL_UMASK_EXT,
.box_ctl = SKX_UPI_PCI_PMON_BOX_CTL,
+ .ctl_offs8 = 1,
.ops = &skx_upi_uncore_pci_ops,
.format_group = &skx_upi_uncore_format_group,
.attr_update = skx_upi_attr_update,
@@ -4338,7 +4338,6 @@ static int skx_m2m_uncore_pci_init_box(struct intel_uncore_box *box)
{
struct pci_dev *pdev = box->pci_dev;
- __set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
return pci_write_config_dword(pdev, SKX_M2M_PCI_PMON_BOX_CTL,
IVBEP_PMON_BOX_CTL_INT);
}
@@ -4361,6 +4360,7 @@ static struct intel_uncore_type skx_uncore_m2m = {
.event_ctl = SKX_M2M_PCI_PMON_CTL0,
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.box_ctl = SKX_M2M_PCI_PMON_BOX_CTL,
+ .ctl_offs8 = 1,
.ops = &skx_m2m_uncore_pci_ops,
.format_group = &skx_uncore_format_group,
};
@@ -4848,7 +4848,6 @@ static int snr_m2m_uncore_pci_init_box(struct intel_uncore_box *box)
struct pci_dev *pdev = box->pci_dev;
int box_ctl = uncore_pci_box_ctl(box);
- __set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
return pci_write_config_dword(pdev, box_ctl, IVBEP_PMON_BOX_CTL_INT);
}
@@ -4885,6 +4884,7 @@ static struct intel_uncore_type snr_uncore_m2m = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
+ .ctl_offs8 = 1,
.ops = &snr_m2m_uncore_pci_ops,
.format_group = &snr_m2m_uncore_format_group,
};
@@ -4917,6 +4917,7 @@ static struct intel_uncore_type snr_uncore_pcie3 = {
.event_mask = SKX_IIO_PMON_RAW_EVENT_MASK,
.event_mask_ext = SKX_IIO_PMON_RAW_EVENT_MASK_EXT,
.box_ctl = SNR_PCIE3_PCI_PMON_BOX_CTL,
+ .ctl_offs8 = 1,
.ops = &snr_pcie3_uncore_pci_ops,
.format_group = &skx_uncore_iio_format_group,
};
@@ -5450,6 +5451,7 @@ static struct intel_uncore_type icx_uncore_m2m = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
+ .ctl_offs8 = 1,
.ops = &snr_m2m_uncore_pci_ops,
.format_group = &snr_m2m_uncore_format_group,
};
@@ -5549,6 +5551,7 @@ static struct intel_uncore_type icx_uncore_upi = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.event_mask_ext = ICX_UPI_CTL_UMASK_EXT,
.box_ctl = ICX_UPI_PCI_PMON_BOX_CTL,
+ .ctl_offs8 = 1,
.ops = &skx_upi_uncore_pci_ops,
.format_group = &icx_upi_uncore_format_group,
.attr_update = icx_upi_attr_update,
@@ -5981,6 +5984,7 @@ static struct intel_uncore_ops spr_uncore_pci_ops = {
#define SPR_UNCORE_PCI_COMMON_FORMAT() \
SPR_UNCORE_COMMON_FORMAT(), \
+ .ctl_offs8 = 1, \
.ops = &spr_uncore_pci_ops
static struct intel_uncore_type spr_uncore_m2m = {
@@ -6020,25 +6024,9 @@ static struct intel_uncore_type spr_uncore_mdf = {
.name = "mdf",
};
-static int spr_uncore_mmio_offs8_init_box(struct intel_uncore_box *box)
-{
- __set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
- return intel_generic_uncore_mmio_init_box(box);
-}
-
-static struct intel_uncore_ops spr_uncore_mmio_offs8_ops = {
- .init_box = spr_uncore_mmio_offs8_init_box,
- .exit_box = uncore_mmio_exit_box,
- .disable_box = intel_generic_uncore_mmio_disable_box,
- .enable_box = intel_generic_uncore_mmio_enable_box,
- .disable_event = intel_generic_uncore_mmio_disable_event,
- .enable_event = spr_uncore_mmio_enable_event,
- .read_counter = uncore_mmio_read_counter,
-};
-
#define SPR_UNCORE_MMIO_OFFS8_COMMON_FORMAT() \
SPR_UNCORE_COMMON_FORMAT(), \
- .ops = &spr_uncore_mmio_offs8_ops
+ .ctl_offs8 = 1
static struct event_constraint spr_uncore_cxlcm_constraints[] = {
UNCORE_EVENT_CONSTRAINT(0x02, 0x0f),
@@ -6126,6 +6114,7 @@ static struct intel_uncore_type spr_uncore_upi = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.event_mask_ext = SPR_RAW_EVENT_MASK_EXT,
.format_group = &spr_uncore_raw_format_group,
+ .ctl_offs8 = 1,
.ops = &spr_uncore_pci_ops,
.name = "upi",
.attr_update = spr_upi_attr_update,
@@ -6276,6 +6265,8 @@ static void uncore_type_customized_copy(struct intel_uncore_type *to_type,
to_type->num_shared_regs = from_type->num_shared_regs;
if (from_type->constraints)
to_type->constraints = from_type->constraints;
+ if (from_type->ctl_offs8)
+ to_type->ctl_offs8 = from_type->ctl_offs8;
if (from_type->ops)
to_type->ops = from_type->ops;
if (from_type->event_descs)
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 04/12] perf/x86/intel/uncore: Fix DMR MMIO counter control stride
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (2 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 03/12] perf/x86/intel/uncore: Replace CTL_OFFS8 box flag with type flag Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 05/12] perf/x86/intel/uncore: Drop spr_uncore_mmio_ops for generic MMIO Zide Chen
` (8 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
Unlike Sapphire Rapids and Granite Rapids, where MMIO counter control
registers are a mix of 32-bit (4-byte stride, e.g. IMC) and 64-bit
(8-byte stride, e.g. CXL) layouts, all Diamond Rapids MMIO uncore units
use 64-bit counter control registers spaced 8 bytes apart.
Because DMR MMIO types do not set ctl_offs8, uncore_pci_event_ctl()
addresses counter control registers with a 4-byte stride instead of 8.
As a result, counter 1's configuration is written to the upper 32 bits
of counter 0's control register, leaving counter 1 unprogrammed and
corrupting counter 0.
Rather than defining dozens of static intel_uncore_type structures
solely to set .ctl_offs8 = 1, introduce uncore_types_set_ctl_offs8()
to set the flag across an uncore type array.
Fixes: 6daf2c35b835 ("perf/x86/intel/uncore: Add IMH PMON support for Diamond Rapids")
Fixes: 66e2075426f3 ("perf/x86/intel/uncore: Add CBB PMON support for Diamond Rapids")
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_snbep.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index e0be7a35baec..e73c028c9415 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -6991,6 +6991,15 @@ int dmr_uncore_pci_init(void)
return 0;
}
+static void uncore_types_set_ctl_offs8(struct intel_uncore_type **types)
+{
+ if (!types)
+ return;
+
+ for (; *types; types++)
+ (*types)->ctl_offs8 = 1;
+}
+
void dmr_uncore_mmio_init(void)
{
uncore_mmio_uncores = uncore_get_uncores(UNCORE_ACCESS_MMIO,
@@ -6999,6 +7008,8 @@ void dmr_uncore_mmio_init(void)
UNCORE_DMR_NUM_UNCORE_TYPES,
dmr_uncores);
+ uncore_types_set_ctl_offs8(uncore_mmio_uncores);
+
dmr_uncore_iio_free_running.num_boxes =
uncore_type_max_boxes(uncore_mmio_uncores, UNCORE_DMR_ITC);
}
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 05/12] perf/x86/intel/uncore: Drop spr_uncore_mmio_ops for generic MMIO
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (3 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 04/12] perf/x86/intel/uncore: Fix DMR MMIO counter control stride Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 06/12] perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats Zide Chen
` (7 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
Under the discovery PMON architecture, programmable counters count as
long as the box is unfrozen via the box control register and a valid
event encoding is programmed.
However, fixed counters have no event select or unit mask fields, and
require the enable bit (GENERIC_PMON_CTL_EN, bit 22) to be set to
start counting.
Move fixed counter handling into intel_generic_uncore_mmio_enable_event(),
making spr_uncore_mmio_enable_event() and spr_uncore_mmio_ops redundant.
Because GENERIC_PMON_CTL_EN is the same bit (bit 22) as SNBEP_PMON_CTL_EN,
IMC types behave exactly as before. Drop spr_uncore_mmio_ops and let IMC
types inherit generic MMIO ops from discovery.
No functional change intended.
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_discovery.c | 5 +++++
arch/x86/events/intel/uncore_discovery.h | 1 +
arch/x86/events/intel/uncore_snbep.c | 28 +-----------------------
3 files changed, 7 insertions(+), 27 deletions(-)
diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
index 75fd3e52c540..979d3da466e3 100644
--- a/arch/x86/events/intel/uncore_discovery.c
+++ b/arch/x86/events/intel/uncore_discovery.c
@@ -703,6 +703,11 @@ void intel_generic_uncore_mmio_enable_event(struct intel_uncore_box *box,
if (!box->io_addr)
return;
+ if (uncore_pmc_fixed(hwc->idx)) {
+ writel(GENERIC_PMON_CTL_EN, box->io_addr + hwc->config_base);
+ return;
+ }
+
writel(hwc->config, box->io_addr + hwc->config_base);
}
diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
index 142e1b56cfc2..58746f9868a7 100644
--- a/arch/x86/events/intel/uncore_discovery.h
+++ b/arch/x86/events/intel/uncore_discovery.h
@@ -50,6 +50,7 @@
#define GENERIC_PMON_CTL_EV_SEL_MASK 0x000000ff
#define GENERIC_PMON_CTL_UMASK_MASK 0x0000ff00
#define GENERIC_PMON_CTL_EDGE_DET (1 << 18)
+#define GENERIC_PMON_CTL_EN (1 << 22)
#define GENERIC_PMON_CTL_INVERT (1 << 23)
#define GENERIC_PMON_CTL_TRESH_MASK 0xff000000
#define GENERIC_PMON_RAW_EVENT_MASK (GENERIC_PMON_CTL_EV_SEL_MASK | \
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index e73c028c9415..9e164beb32c5 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -5915,30 +5915,6 @@ static struct intel_uncore_type spr_uncore_pcu = {
.attr_update = uncore_alias_groups,
};
-static void spr_uncore_mmio_enable_event(struct intel_uncore_box *box,
- struct perf_event *event)
-{
- struct hw_perf_event *hwc = &event->hw;
-
- if (!box->io_addr)
- return;
-
- if (uncore_pmc_fixed(hwc->idx))
- writel(SNBEP_PMON_CTL_EN, box->io_addr + hwc->config_base);
- else
- writel(hwc->config, box->io_addr + hwc->config_base);
-}
-
-static struct intel_uncore_ops spr_uncore_mmio_ops = {
- .init_box = intel_generic_uncore_mmio_init_box,
- .exit_box = uncore_mmio_exit_box,
- .disable_box = intel_generic_uncore_mmio_disable_box,
- .enable_box = intel_generic_uncore_mmio_enable_box,
- .disable_event = intel_generic_uncore_mmio_disable_event,
- .enable_event = spr_uncore_mmio_enable_event,
- .read_counter = uncore_mmio_read_counter,
-};
-
static struct uncore_event_desc spr_uncore_imc_events[] = {
INTEL_UNCORE_EVENT_DESC(clockticks, "event=0x01,umask=0x00"),
INTEL_UNCORE_EVENT_DESC(cas_count_read, "event=0x05,umask=0xcf"),
@@ -5951,8 +5927,7 @@ static struct uncore_event_desc spr_uncore_imc_events[] = {
};
#define SPR_UNCORE_MMIO_COMMON_FORMAT() \
- SPR_UNCORE_COMMON_FORMAT(), \
- .ops = &spr_uncore_mmio_ops
+ SPR_UNCORE_COMMON_FORMAT()
static struct intel_uncore_type spr_uncore_imc = {
SPR_UNCORE_MMIO_COMMON_FORMAT(),
@@ -6639,7 +6614,6 @@ static struct intel_uncore_type dmr_uncore_imc = {
.fixed_ctr_bits = 48,
.fixed_ctr = DMR_IMC_PMON_FIXED_CTR,
.fixed_ctl = DMR_IMC_PMON_FIXED_CTL,
- .ops = &spr_uncore_mmio_ops,
.format_group = &dmr_imc_uncore_format_group,
.attr_update = uncore_alias_groups,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 06/12] perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (4 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 05/12] perf/x86/intel/uncore: Drop spr_uncore_mmio_ops for generic MMIO Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:49 ` sashiko-bot
2026-12-05 3:22 ` [PATCH 07/12] perf/x86/intel/uncore: Program upper dword in generic ops Zide Chen
` (6 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
IMC on SPR/EMR/GNR/SRF and HBM on SPR have only 32-bit counter control
registers with an 8-bit umask. However, their types inherited
SPR_UNCORE_COMMON_FORMAT(), erroneously setting event_mask_ext and
exposing non-existent extended umask bits 32-55 in sysfs.
Redefine SPR_UNCORE_MMIO_COMMON_FORMAT() using skx_uncore_format_group
without event_mask_ext, and switch spr_uncore_hbm to use it. This
narrows the sysfs umask attribute from "config:8-15,32-55" to
"config:8-15" to match hardware specs.
Fixes: 85f2e30f987e ("perf/x86/intel/uncore: Add Sapphire Rapids server IMC support")
Fixes: f8a86a9bb5f7 ("perf/x86/intel/uncore: Support HBM and CXL PMON counters")
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_snbep.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 9e164beb32c5..14232ef4f77b 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -5926,8 +5926,11 @@ static struct uncore_event_desc spr_uncore_imc_events[] = {
{ /* end: all zeroes */ },
};
+/* 32-bit MMIO counter control registers (4-byte stride, no upper dword) */
#define SPR_UNCORE_MMIO_COMMON_FORMAT() \
- SPR_UNCORE_COMMON_FORMAT()
+ .event_mask = SNBEP_PMON_RAW_EVENT_MASK, \
+ .format_group = &skx_uncore_format_group, \
+ .attr_update = uncore_alias_groups
static struct intel_uncore_type spr_uncore_imc = {
SPR_UNCORE_MMIO_COMMON_FORMAT(),
@@ -6024,7 +6027,7 @@ static struct intel_uncore_type spr_uncore_cxldp = {
};
static struct intel_uncore_type spr_uncore_hbm = {
- SPR_UNCORE_COMMON_FORMAT(),
+ SPR_UNCORE_MMIO_COMMON_FORMAT(),
.name = "hbm",
};
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 06/12] perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats
2026-12-05 3:22 ` [PATCH 06/12] perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats Zide Chen
@ 2026-12-05 3:49 ` sashiko-bot
2026-12-05 4:41 ` Chen, Zide
0 siblings, 1 reply; 20+ messages in thread
From: sashiko-bot @ 2026-12-05 3:49 UTC (permalink / raw)
To: Zide Chen; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf/x86/intel/uncore: SPR_UNCORE_MMIO_COMMON_FORMAT()
duplicates defaults
--
commit 3da01c0f67231ec78a98734f80d875faa2f8e3b8
Author: Zide Chen <zide.chen@intel.com>
perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats
This commit redefines SPR_UNCORE_MMIO_COMMON_FORMAT() without
event_mask_ext using skx_uncore_format_group, and switches spr_uncore_hbm
to use it so IMC and HBM expose an 8-bit umask in sysfs.
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index 9e164beb32c53..14232ef4f77bd 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
> @@ -5926,8 +5926,11 @@ static struct uncore_event_desc spr_uncore_imc_events[] = {
> { /* end: all zeroes */ },
> };
>
> +/* 32-bit MMIO counter control registers (4-byte stride, no upper dword) */
> #define SPR_UNCORE_MMIO_COMMON_FORMAT() \
> - SPR_UNCORE_COMMON_FORMAT()
> + .event_mask = SNBEP_PMON_RAW_EVENT_MASK, \
> + .format_group = &skx_uncore_format_group, \
> + .attr_update = uncore_alias_groups
>
> static struct intel_uncore_type spr_uncore_imc = {
> SPR_UNCORE_MMIO_COMMON_FORMAT(),
[Severity: Low]
Can SPR_UNCORE_MMIO_COMMON_FORMAT() be dropped instead of redefining it
with legacy SNB-EP and SKX symbols?
Its users (spr_uncore_imc, spr_uncore_hbm, and gnr_uncore_imc) all go
through intel_uncore_generic_init_uncores(), which already leaves
event_mask_ext zeroed and sets equivalent defaults
(GENERIC_PMON_RAW_EVENT_MASK and &generic_uncore_format_group).
Setting .attr_update = uncore_alias_groups directly on those types would
match sibling discovery-based 32-bit types like spr_uncore_pcu.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205032253.258646-1-zide.chen@intel.com?part=6
^ permalink raw reply [flat|nested] 20+ messages in thread* Re: [PATCH 06/12] perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats
2026-12-05 3:49 ` sashiko-bot
@ 2026-12-05 4:41 ` Chen, Zide
0 siblings, 0 replies; 20+ messages in thread
From: Chen, Zide @ 2026-12-05 4:41 UTC (permalink / raw)
To: linux-perf-users
On 12/4/2026 9:49 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] perf/x86/intel/uncore: SPR_UNCORE_MMIO_COMMON_FORMAT()
> duplicates defaults
> --
>
> commit 3da01c0f67231ec78a98734f80d875faa2f8e3b8
> Author: Zide Chen <zide.chen@intel.com>
>
> perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats
>
> This commit redefines SPR_UNCORE_MMIO_COMMON_FORMAT() without
> event_mask_ext using skx_uncore_format_group, and switches spr_uncore_hbm
> to use it so IMC and HBM expose an 8-bit umask in sysfs.
>
>> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
>> index 9e164beb32c53..14232ef4f77bd 100644
>> --- a/arch/x86/events/intel/uncore_snbep.c
>> +++ b/arch/x86/events/intel/uncore_snbep.c
>> @@ -5926,8 +5926,11 @@ static struct uncore_event_desc spr_uncore_imc_events[] = {
>> { /* end: all zeroes */ },
>> };
>>
>> +/* 32-bit MMIO counter control registers (4-byte stride, no upper dword) */
>> #define SPR_UNCORE_MMIO_COMMON_FORMAT() \
>> - SPR_UNCORE_COMMON_FORMAT()
>> + .event_mask = SNBEP_PMON_RAW_EVENT_MASK, \
>> + .format_group = &skx_uncore_format_group, \
>> + .attr_update = uncore_alias_groups
>>
>> static struct intel_uncore_type spr_uncore_imc = {
>> SPR_UNCORE_MMIO_COMMON_FORMAT(),
>
> [Severity: Low]
> Can SPR_UNCORE_MMIO_COMMON_FORMAT() be dropped instead of redefining it
> with legacy SNB-EP and SKX symbols?
>
> Its users (spr_uncore_imc, spr_uncore_hbm, and gnr_uncore_imc) all go
> through intel_uncore_generic_init_uncores(), which already leaves
> event_mask_ext zeroed and sets equivalent defaults
> (GENERIC_PMON_RAW_EVENT_MASK and &generic_uncore_format_group).
>
> Setting .attr_update = uncore_alias_groups directly on those types would
> match sibling discovery-based 32-bit types like spr_uncore_pcu.
>
Again, very good catch!
As suggested, I will drop SPR_UNCORE_MMIO_COMMON_FORMAT() in v2 and set
.attr_update directly on spr_uncore_imc, spr_uncore_hbm, gnr_uncore_imc.
Drop another macro and reduce 6 LOC!
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 07/12] perf/x86/intel/uncore: Program upper dword in generic ops
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (5 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 06/12] perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and HBM event formats Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI Zide Chen
` (5 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
Generic MMIO and PCI {enable,disable}_event() callbacks only write to
the lower 32 bits of counter control registers, forcing extra custom
ops to write to the upper 32 bits for types that support 64-bit
registers.
Add uncore_box_has_ext_event_ctl() to check whether a box supports
upper control dwords: event_mask_ext indicates that the type supports
it, while ctl_offs8 serves as a safety guard against clobbering
neighboring registers on 4-byte stride units.
Add uncore_{pci,mmio}_{write,clear}_event_ctl() helpers and use them
in the generic PCI and MMIO ops to safely write and clear the upper 32
bits.
This allows custom ops like spr_uncore_pci_ops to be dropped, and
64-bit control registers to be handled in a generic way for any type
that sets both ctl_offs8 and event_mask_ext.
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore.h | 46 ++++++++++++++++++++++++
arch/x86/events/intel/uncore_discovery.c | 14 +++-----
2 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index c88949387b7c..449512cab817 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -338,6 +338,52 @@ unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx)
return idx * 8 + box->pmu->type->perf_ctr;
}
+static inline bool uncore_box_has_ext_event_ctl(struct intel_uncore_box *box)
+{
+ return box->pmu->type->ctl_offs8 && box->pmu->type->event_mask_ext;
+}
+
+static inline void uncore_pci_write_event_ctl(struct intel_uncore_box *box,
+ struct hw_perf_event *hwc, u64 config)
+{
+ /* Upper dword first so the counter does not use stale filters. */
+ if (uncore_box_has_ext_event_ctl(box))
+ pci_write_config_dword(box->pci_dev, hwc->config_base + 4,
+ upper_32_bits(config));
+ pci_write_config_dword(box->pci_dev, hwc->config_base,
+ lower_32_bits(config));
+}
+
+static inline void uncore_pci_clear_event_ctl(struct intel_uncore_box *box,
+ struct hw_perf_event *hwc)
+{
+ /* Stop the counter before clearing upper dword filters. */
+ pci_write_config_dword(box->pci_dev, hwc->config_base, 0);
+ if (uncore_box_has_ext_event_ctl(box))
+ pci_write_config_dword(box->pci_dev, hwc->config_base + 4, 0);
+}
+
+static inline void uncore_mmio_write_event_ctl(struct intel_uncore_box *box,
+ struct hw_perf_event *hwc, u64 config)
+{
+ /* Upper dword first so the counter does not use stale filters. */
+ if (uncore_box_has_ext_event_ctl(box))
+ writel(upper_32_bits(config),
+ box->io_addr + hwc->config_base + 4);
+ writel(lower_32_bits(config), box->io_addr + hwc->config_base);
+}
+
+static inline void uncore_mmio_clear_event_ctl(struct intel_uncore_box *box,
+ struct hw_perf_event *hwc)
+{
+ /* Stop the counter before clearing upper dword filters. */
+ writel(0, box->io_addr + hwc->config_base);
+
+ /* Fixed counter controls are 32-bit with no upper dword filters. */
+ if (!uncore_pmc_fixed(hwc->idx) && uncore_box_has_ext_event_ctl(box))
+ writel(0, box->io_addr + hwc->config_base + 4);
+}
+
static inline unsigned uncore_msr_box_offset(struct intel_uncore_box *box)
{
struct intel_uncore_pmu *pmu = box->pmu;
diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
index 979d3da466e3..07df52e2e265 100644
--- a/arch/x86/events/intel/uncore_discovery.c
+++ b/arch/x86/events/intel/uncore_discovery.c
@@ -609,19 +609,15 @@ void intel_generic_uncore_pci_enable_box(struct intel_uncore_box *box)
static void intel_generic_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);
+ uncore_pci_write_event_ctl(box, hwc, hwc->config);
}
void intel_generic_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, 0);
+ uncore_pci_clear_event_ctl(box, &event->hw);
}
u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
@@ -708,18 +704,16 @@ void intel_generic_uncore_mmio_enable_event(struct intel_uncore_box *box,
return;
}
- writel(hwc->config, box->io_addr + hwc->config_base);
+ uncore_mmio_write_event_ctl(box, hwc, hwc->config);
}
void intel_generic_uncore_mmio_disable_event(struct intel_uncore_box *box,
struct perf_event *event)
{
- struct hw_perf_event *hwc = &event->hw;
-
if (!box->io_addr)
return;
- writel(0, box->io_addr + hwc->config_base);
+ uncore_mmio_clear_event_ctl(box, &event->hw);
}
static struct intel_uncore_ops generic_uncore_mmio_ops = {
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (6 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 07/12] perf/x86/intel/uncore: Program upper dword in generic ops Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:46 ` sashiko-bot
2026-12-05 3:22 ` [PATCH 09/12] perf/x86/intel/uncore: Fix SKX/SNR/ICX PCI extended umask truncation Zide Chen
` (4 subsequent siblings)
12 siblings, 1 reply; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
Now that generic discovery PCI ops support 64-bit control registers,
spr_uncore_pci_ops is redundant and can be replaced with the generic
PCI ops.
Because SPR UPI and M3UPI bypass uncore_update_uncore_type() and do
not inherit default ops automatically, make generic_uncore_pci_ops
global so that these extra types can assign it explicitly.
Opportunistically, rename it to intel_generic_uncore_pci_ops to match
the generic discovery naming convention.
No functional change intended.
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_discovery.c | 4 ++--
arch/x86/events/intel/uncore_discovery.h | 1 +
arch/x86/events/intel/uncore_snbep.c | 23 ++---------------------
3 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
index 07df52e2e265..8e4053d7bbd9 100644
--- a/arch/x86/events/intel/uncore_discovery.c
+++ b/arch/x86/events/intel/uncore_discovery.c
@@ -633,7 +633,7 @@ u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
return count;
}
-static struct intel_uncore_ops generic_uncore_pci_ops = {
+struct intel_uncore_ops intel_generic_uncore_pci_ops = {
.init_box = intel_generic_uncore_pci_init_box,
.disable_box = intel_generic_uncore_pci_disable_box,
.enable_box = intel_generic_uncore_pci_enable_box,
@@ -743,7 +743,7 @@ static bool uncore_update_uncore_type(enum uncore_access_type type_id,
uncore->ops = &generic_uncore_msr_ops;
break;
case UNCORE_ACCESS_PCI:
- uncore->ops = &generic_uncore_pci_ops;
+ uncore->ops = &intel_generic_uncore_pci_ops;
uncore->ctl_offs8 = 1;
break;
case UNCORE_ACCESS_MMIO:
diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
index 58746f9868a7..04778b1c22a9 100644
--- a/arch/x86/events/intel/uncore_discovery.h
+++ b/arch/x86/events/intel/uncore_discovery.h
@@ -168,6 +168,7 @@ void intel_generic_uncore_pci_disable_event(struct intel_uncore_box *box,
struct perf_event *event);
u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
struct perf_event *event);
+extern struct intel_uncore_ops intel_generic_uncore_pci_ops;
struct intel_uncore_type **
intel_uncore_generic_init_uncores(enum uncore_access_type type_id, int num_extra);
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 14232ef4f77b..0b8057d142c1 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -5941,29 +5941,10 @@ static struct intel_uncore_type spr_uncore_imc = {
.event_descs = spr_uncore_imc_events,
};
-static void spr_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 + 4, (u32)(hwc->config >> 32));
- pci_write_config_dword(pdev, hwc->config_base, (u32)hwc->config);
-}
-
-static struct intel_uncore_ops spr_uncore_pci_ops = {
- .init_box = intel_generic_uncore_pci_init_box,
- .disable_box = intel_generic_uncore_pci_disable_box,
- .enable_box = intel_generic_uncore_pci_enable_box,
- .disable_event = intel_generic_uncore_pci_disable_event,
- .enable_event = spr_uncore_pci_enable_event,
- .read_counter = intel_generic_uncore_pci_read_counter,
-};
-
#define SPR_UNCORE_PCI_COMMON_FORMAT() \
SPR_UNCORE_COMMON_FORMAT(), \
.ctl_offs8 = 1, \
- .ops = &spr_uncore_pci_ops
+ .ops = &intel_generic_uncore_pci_ops
static struct intel_uncore_type spr_uncore_m2m = {
SPR_UNCORE_PCI_COMMON_FORMAT(),
@@ -6093,7 +6074,7 @@ static struct intel_uncore_type spr_uncore_upi = {
.event_mask_ext = SPR_RAW_EVENT_MASK_EXT,
.format_group = &spr_uncore_raw_format_group,
.ctl_offs8 = 1,
- .ops = &spr_uncore_pci_ops,
+ .ops = &intel_generic_uncore_pci_ops,
.name = "upi",
.attr_update = spr_upi_attr_update,
.get_topology = spr_upi_get_topology,
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI
2026-12-05 3:22 ` [PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI Zide Chen
@ 2026-12-05 3:46 ` sashiko-bot
2026-12-05 4:41 ` Chen, Zide
0 siblings, 1 reply; 20+ messages in thread
From: sashiko-bot @ 2026-12-05 3:46 UTC (permalink / raw)
To: Zide Chen; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] perf/x86/intel/uncore: five generic PCI callbacks remain
non-static
- [Low] perf/x86/intel/uncore: redundant ops and ctl_offs8 in PCI format
macro
--
commit 5f71697af3492a89c48cdbab965d8b6947a44340
Author: Zide Chen <zide.chen@intel.com>
perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI
This commit exports generic_uncore_pci_ops as intel_generic_uncore_pci_ops
and removes spr_uncore_pci_ops and spr_uncore_pci_enable_event() in favor
of the generic PCI ops.
> diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
> index 58746f9868a72..04778b1c22a94 100644
> --- a/arch/x86/events/intel/uncore_discovery.h
> +++ b/arch/x86/events/intel/uncore_discovery.h
> @@ -168,6 +168,7 @@ void intel_generic_uncore_pci_disable_event(struct intel_uncore_box *box,
> struct perf_event *event);
> u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
> struct perf_event *event);
> +extern struct intel_uncore_ops intel_generic_uncore_pci_ops;
[Severity: Low]
Can the five individual PCI callbacks (intel_generic_uncore_pci_init_box(),
intel_generic_uncore_pci_disable_box(), intel_generic_uncore_pci_enable_box(),
intel_generic_uncore_pci_disable_event(), and
intel_generic_uncore_pci_read_counter()) be made static again, with their
prototypes dropped from uncore_discovery.h?
After removing spr_uncore_pci_ops, none of them have any remaining callers
outside arch/x86/events/intel/uncore_discovery.c.
> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
> index 14232ef4f77bd..0b8057d142c11 100644
> --- a/arch/x86/events/intel/uncore_snbep.c
> +++ b/arch/x86/events/intel/uncore_snbep.c
[ ... ]
> #define SPR_UNCORE_PCI_COMMON_FORMAT() \
> SPR_UNCORE_COMMON_FORMAT(), \
> .ctl_offs8 = 1, \
> - .ops = &spr_uncore_pci_ops
> + .ops = &intel_generic_uncore_pci_ops
[Severity: Low]
Can SPR_UNCORE_PCI_COMMON_FORMAT() be dropped in favor of
SPR_UNCORE_COMMON_FORMAT()?
uncore_update_uncore_type() already sets ctl_offs8 and
intel_generic_uncore_pci_ops for discovered UNCORE_ACCESS_PCI types, and
only spr_uncore_m3upi among this macro's users bypasses discovery.
Setting .ctl_offs8 and .ops explicitly on spr_uncore_m3upi (matching
spr_uncore_upi) avoids repeating them on the six discovered types,
similar to commit "perf/x86/intel/uncore: Drop spr_uncore_mmio_ops for
generic MMIO".
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205032253.258646-1-zide.chen@intel.com?part=8
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI
2026-12-05 3:46 ` sashiko-bot
@ 2026-12-05 4:41 ` Chen, Zide
0 siblings, 0 replies; 20+ messages in thread
From: Chen, Zide @ 2026-12-05 4:41 UTC (permalink / raw)
To: sashiko-reviews; +Cc: linux-perf-users
On 12/4/2026 9:46 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issues to consider:
> - [Low] perf/x86/intel/uncore: five generic PCI callbacks remain
> non-static
> - [Low] perf/x86/intel/uncore: redundant ops and ctl_offs8 in PCI format
> macro
> --
>
> commit 5f71697af3492a89c48cdbab965d8b6947a44340
> Author: Zide Chen <zide.chen@intel.com>
>
> perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI
>
> This commit exports generic_uncore_pci_ops as intel_generic_uncore_pci_ops
> and removes spr_uncore_pci_ops and spr_uncore_pci_enable_event() in favor
> of the generic PCI ops.
>
>> diff --git a/arch/x86/events/intel/uncore_discovery.h b/arch/x86/events/intel/uncore_discovery.h
>> index 58746f9868a72..04778b1c22a94 100644
>> --- a/arch/x86/events/intel/uncore_discovery.h
>> +++ b/arch/x86/events/intel/uncore_discovery.h
>> @@ -168,6 +168,7 @@ void intel_generic_uncore_pci_disable_event(struct intel_uncore_box *box,
>> struct perf_event *event);
>> u64 intel_generic_uncore_pci_read_counter(struct intel_uncore_box *box,
>> struct perf_event *event);
>> +extern struct intel_uncore_ops intel_generic_uncore_pci_ops;
>
> [Severity: Low]
> Can the five individual PCI callbacks (intel_generic_uncore_pci_init_box(),
> intel_generic_uncore_pci_disable_box(), intel_generic_uncore_pci_enable_box(),
> intel_generic_uncore_pci_disable_event(), and
> intel_generic_uncore_pci_read_counter()) be made static again, with their
> prototypes dropped from uncore_discovery.h?
>
> After removing spr_uncore_pci_ops, none of them have any remaining callers
> outside arch/x86/events/intel/uncore_discovery.c.
Good catch. This can further cleanup the code.
Now that intel_generic_uncore_pci_ops is exported directly, none of the
individual callbacks need external visibility. I will mark all five
callbacks static and drop their declarations from uncore_discovery.h.
>
>> diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
>> index 14232ef4f77bd..0b8057d142c11 100644
>> --- a/arch/x86/events/intel/uncore_snbep.c
>> +++ b/arch/x86/events/intel/uncore_snbep.c
>
> [ ... ]
>
>> #define SPR_UNCORE_PCI_COMMON_FORMAT() \
>> SPR_UNCORE_COMMON_FORMAT(), \
>> .ctl_offs8 = 1, \
>> - .ops = &spr_uncore_pci_ops
>> + .ops = &intel_generic_uncore_pci_ops
>
> [Severity: Low]
> Can SPR_UNCORE_PCI_COMMON_FORMAT() be dropped in favor of
> SPR_UNCORE_COMMON_FORMAT()?
>
> uncore_update_uncore_type() already sets ctl_offs8 and
> intel_generic_uncore_pci_ops for discovered UNCORE_ACCESS_PCI types, and
> only spr_uncore_m3upi among this macro's users bypasses discovery.
>
> Setting .ctl_offs8 and .ops explicitly on spr_uncore_m3upi (matching
> spr_uncore_upi) avoids repeating them on the six discovered types,
> similar to commit "perf/x86/intel/uncore: Drop spr_uncore_mmio_ops for
> generic MMIO".
Agreed.
Your suggestion makes sense. I will adopt it in v2, which further
reduces ~10 LOC.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 09/12] perf/x86/intel/uncore: Fix SKX/SNR/ICX PCI extended umask truncation
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (7 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 08/12] perf/x86/intel/uncore: Drop spr_uncore_pci_ops for generic PCI Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 10/12] perf/x86/intel/uncore: Program SNR PCIe3 upper filter before enable Zide Chen
` (3 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
{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@intel.com>
---
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
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 10/12] perf/x86/intel/uncore: Program SNR PCIe3 upper filter before enable
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (8 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 09/12] perf/x86/intel/uncore: Fix SKX/SNR/ICX PCI extended umask truncation Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:22 ` [PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops Zide Chen
` (2 subsequent siblings)
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
snr_uncore_pci_enable_event() wrote the enable bit before programming
the upper filter dword, risking stale filtering. Switch snr_uncore_pcie3
to ivbep_uncore_pci_ops, which safely writes the upper dword first, and
drop the redundant custom ops.
Fixes: a3b1e8451d3f ("perf/x86/intel/uncore: Support PCIe3 unit on Snow Ridge")
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_snbep.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 3f6fd636829a..4bc7e10fcaba 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -4885,24 +4885,6 @@ static struct intel_uncore_type snr_uncore_m2m = {
.format_group = &snr_m2m_uncore_format_group,
};
-static void snr_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, (u32)(hwc->config | SNBEP_PMON_CTL_EN));
- pci_write_config_dword(pdev, hwc->config_base + 4, (u32)(hwc->config >> 32));
-}
-
-static struct intel_uncore_ops snr_pcie3_uncore_pci_ops = {
- .init_box = snr_m2m_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snr_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static struct intel_uncore_type snr_uncore_pcie3 = {
.name = "pcie3",
.num_counters = 4,
@@ -4914,7 +4896,7 @@ static struct intel_uncore_type snr_uncore_pcie3 = {
.event_mask_ext = SKX_IIO_PMON_RAW_EVENT_MASK_EXT,
.box_ctl = SNR_PCIE3_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &snr_pcie3_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &skx_uncore_iio_format_group,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (9 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 10/12] perf/x86/intel/uncore: Program SNR PCIe3 upper filter before enable Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:53 ` sashiko-bot
2026-12-05 3:22 ` [PATCH 12/12] perf/x86/intel/uncore: Fix DMR IMC threshold field Zide Chen
2026-12-05 3:54 ` [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config sashiko-bot
12 siblings, 1 reply; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
Now that snbep_uncore_pci_enable_event() programs the upper dword and
ivbep_uncore_pci_init_box() uses uncore_pci_box_ctl(), customized PCI
ops for SKX, SNR and ICX become redundant with ivbep_uncore_pci_ops.
Switch the SKX UPI/M2M, SNR M2M and ICX UPI/M2M types to
ivbep_uncore_pci_ops and drop their custom init_box and ops.
No functional change intended.
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_snbep.c | 61 +++-------------------------
1 file changed, 5 insertions(+), 56 deletions(-)
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 4bc7e10fcaba..4e93b185790e 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -4168,23 +4168,6 @@ static const struct attribute_group skx_upi_uncore_format_group = {
.attrs = skx_upi_uncore_formats_attr,
};
-static int skx_upi_uncore_pci_init_box(struct intel_uncore_box *box)
-{
- struct pci_dev *pdev = box->pci_dev;
-
- return pci_write_config_dword(pdev, uncore_pci_box_ctl(box),
- IVBEP_PMON_BOX_CTL_INT);
-}
-
-static struct intel_uncore_ops skx_upi_uncore_pci_ops = {
- .init_box = skx_upi_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snbep_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static umode_t
skx_upi_mapping_visible(struct kobject *kobj, struct attribute *attr, int die)
{
@@ -4322,7 +4305,7 @@ static struct intel_uncore_type skx_uncore_upi = {
.event_mask_ext = SKX_UPI_CTL_UMASK_EXT,
.box_ctl = SKX_UPI_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &skx_upi_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &skx_upi_uncore_format_group,
.attr_update = skx_upi_attr_update,
.get_topology = skx_upi_get_topology,
@@ -4330,23 +4313,6 @@ static struct intel_uncore_type skx_uncore_upi = {
.cleanup_mapping = skx_upi_cleanup_mapping,
};
-static int skx_m2m_uncore_pci_init_box(struct intel_uncore_box *box)
-{
- struct pci_dev *pdev = box->pci_dev;
-
- return pci_write_config_dword(pdev, SKX_M2M_PCI_PMON_BOX_CTL,
- IVBEP_PMON_BOX_CTL_INT);
-}
-
-static struct intel_uncore_ops skx_m2m_uncore_pci_ops = {
- .init_box = skx_m2m_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snbep_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static struct intel_uncore_type skx_uncore_m2m = {
.name = "m2m",
.num_counters = 4,
@@ -4357,7 +4323,7 @@ static struct intel_uncore_type skx_uncore_m2m = {
.event_mask = SNBEP_PMON_RAW_EVENT_MASK,
.box_ctl = SKX_M2M_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &skx_m2m_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &skx_uncore_format_group,
};
@@ -4839,23 +4805,6 @@ void snr_uncore_cpu_init(void)
uncore_msr_uncores = snr_msr_uncores;
}
-static int snr_m2m_uncore_pci_init_box(struct intel_uncore_box *box)
-{
- struct pci_dev *pdev = box->pci_dev;
- int box_ctl = uncore_pci_box_ctl(box);
-
- return pci_write_config_dword(pdev, box_ctl, IVBEP_PMON_BOX_CTL_INT);
-}
-
-static struct intel_uncore_ops snr_m2m_uncore_pci_ops = {
- .init_box = snr_m2m_uncore_pci_init_box,
- .disable_box = snbep_uncore_pci_disable_box,
- .enable_box = snbep_uncore_pci_enable_box,
- .disable_event = snbep_uncore_pci_disable_event,
- .enable_event = snbep_uncore_pci_enable_event,
- .read_counter = snbep_uncore_pci_read_counter,
-};
-
static struct attribute *snr_m2m_uncore_formats_attr[] = {
&format_attr_event.attr,
&format_attr_umask_ext3.attr,
@@ -4881,7 +4830,7 @@ static struct intel_uncore_type snr_uncore_m2m = {
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &snr_m2m_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &snr_m2m_uncore_format_group,
};
@@ -5430,7 +5379,7 @@ static struct intel_uncore_type icx_uncore_m2m = {
.event_mask_ext = SNR_M2M_PCI_PMON_UMASK_EXT,
.box_ctl = SNR_M2M_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &snr_m2m_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &snr_m2m_uncore_format_group,
};
@@ -5530,7 +5479,7 @@ static struct intel_uncore_type icx_uncore_upi = {
.event_mask_ext = ICX_UPI_CTL_UMASK_EXT,
.box_ctl = ICX_UPI_PCI_PMON_BOX_CTL,
.ctl_offs8 = 1,
- .ops = &skx_upi_uncore_pci_ops,
+ .ops = &ivbep_uncore_pci_ops,
.format_group = &icx_upi_uncore_format_group,
.attr_update = icx_upi_attr_update,
.get_topology = icx_upi_get_topology,
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops
2026-12-05 3:22 ` [PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops Zide Chen
@ 2026-12-05 3:53 ` sashiko-bot
2026-12-05 4:42 ` Chen, Zide
0 siblings, 1 reply; 20+ messages in thread
From: sashiko-bot @ 2026-12-05 3:53 UTC (permalink / raw)
To: Zide Chen; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf/x86/intel/uncore: inaccurate prerequisite in commit message
rationale
--
commit 61c1c6333811b4a38a88e98d376bc02052ac4e9e
Author: Zide Chen <zide.chen@intel.com>
perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops
This commit switches the SKX UPI/M2M, SNR M2M and ICX UPI/M2M uncore
types to ivbep_uncore_pci_ops and drops their custom init_box callbacks
and ops structs.
> Now that snbep_uncore_pci_enable_event() programs the upper dword and
> ivbep_uncore_pci_init_box() uses uncore_pci_box_ctl(), customized PCI
> ops for SKX, SNR and ICX become redundant with ivbep_uncore_pci_ops.
[Severity: Low]
Is the reference to snbep_uncore_pci_enable_event() accurate here?
All three removed ops structs (skx_upi_uncore_pci_ops,
skx_m2m_uncore_pci_ops, and snr_m2m_uncore_pci_ops) already used
snbep_uncore_pci_enable_event() before this change.
What eliminated the remaining difference with ivbep_uncore_pci_ops was
moving the ctl_offs8 flag into struct intel_uncore_type in commit
"perf/x86/intel/uncore: Replace CTL_OFFS8 box flag with type flag",
together with ivbep_uncore_pci_init_box() using uncore_pci_box_ctl().
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205032253.258646-1-zide.chen@intel.com?part=11
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops
2026-12-05 3:53 ` sashiko-bot
@ 2026-12-05 4:42 ` Chen, Zide
0 siblings, 0 replies; 20+ messages in thread
From: Chen, Zide @ 2026-12-05 4:42 UTC (permalink / raw)
To: sashiko-reviews; +Cc: linux-perf-users
On 12/4/2026 9:53 PM, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] perf/x86/intel/uncore: inaccurate prerequisite in commit message
> rationale
> --
>
> commit 61c1c6333811b4a38a88e98d376bc02052ac4e9e
> Author: Zide Chen <zide.chen@intel.com>
>
> perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops
>
> This commit switches the SKX UPI/M2M, SNR M2M and ICX UPI/M2M uncore
> types to ivbep_uncore_pci_ops and drops their custom init_box callbacks
> and ops structs.
>
>> Now that snbep_uncore_pci_enable_event() programs the upper dword and
>> ivbep_uncore_pci_init_box() uses uncore_pci_box_ctl(), customized PCI
>> ops for SKX, SNR and ICX become redundant with ivbep_uncore_pci_ops.
>
> [Severity: Low]
> Is the reference to snbep_uncore_pci_enable_event() accurate here?
>
> All three removed ops structs (skx_upi_uncore_pci_ops,
> skx_m2m_uncore_pci_ops, and snr_m2m_uncore_pci_ops) already used
> snbep_uncore_pci_enable_event() before this change.
>
> What eliminated the remaining difference with ivbep_uncore_pci_ops was
> moving the ctl_offs8 flag into struct intel_uncore_type in commit
> "perf/x86/intel/uncore: Replace CTL_OFFS8 box flag with type flag",
> together with ivbep_uncore_pci_init_box() using uncore_pci_box_ctl().
>
You are right! The removed ops structs already shared
snbep_uncore_pci_enable_event() with ivbep_uncore_pci_ops. The reference
was an errant carryover from other patches in the series.
I will update the commit log in v2.
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 12/12] perf/x86/intel/uncore: Fix DMR IMC threshold field
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (10 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 11/12] perf/x86/intel/uncore: Consolidate SKX, SNR and ICX PCI uncore ops Zide Chen
@ 2026-12-05 3:22 ` Zide Chen
2026-12-05 3:54 ` [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config sashiko-bot
12 siblings, 0 replies; 20+ messages in thread
From: Zide Chen @ 2026-12-05 3:22 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Ian Rogers, Adrian Hunter, Alexander Shishkin,
Andi Kleen, Eranian Stephane
Cc: Chun-Tse Shao, linux-kernel, linux-perf-users, Dapeng Mi,
Zide Chen
The DMR IMC threshold format (RES_THRESHOLD, EDS 23.3.51) should be
a 9-bit field spanning bits 24-32. Currently it is defined as thresh10,
erroneously overlapping bit 23 (inv).
Fix this by defining thresh9_3 (config:24-32) and setting
event_mask_ext so that bit 32 is not masked off by perf.
This is a user-visible change to the sysfs format ABI: the "thresh"
attribute changes from "config:23-32" to "config:24-32".
Fixes: 6daf2c35b835 ("perf/x86/intel/uncore: Add IMH PMON support for Diamond Rapids")
Signed-off-by: Zide Chen <zide.chen@intel.com>
---
arch/x86/events/intel/uncore_snbep.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/uncore_snbep.c b/arch/x86/events/intel/uncore_snbep.c
index 4e93b185790e..a3352d8dd752 100644
--- a/arch/x86/events/intel/uncore_snbep.c
+++ b/arch/x86/events/intel/uncore_snbep.c
@@ -480,6 +480,7 @@
#define DMR_CXLCM_EVENT_MASK_EXT 0xf
#define DMR_HAMVF_EVENT_MASK_EXT 0xffffffff
#define DMR_PCIE4_EVENT_MASK_EXT 0xffffff
+#define DMR_IMC_EVENT_MASK_EXT 0x1
#define UNCORE_DMR_ITC 0x30
@@ -503,7 +504,7 @@ DEFINE_UNCORE_FORMAT_ATTR(tid_en2, tid_en, "config:16");
DEFINE_UNCORE_FORMAT_ATTR(inv, inv, "config:23");
DEFINE_UNCORE_FORMAT_ATTR(inv2, inv, "config:21");
DEFINE_UNCORE_FORMAT_ATTR(thresh_ext, thresh_ext, "config:32-35");
-DEFINE_UNCORE_FORMAT_ATTR(thresh10, thresh, "config:23-32");
+DEFINE_UNCORE_FORMAT_ATTR(thresh9_3, thresh, "config:24-32");
DEFINE_UNCORE_FORMAT_ATTR(thresh9_2, thresh, "config:23-31");
DEFINE_UNCORE_FORMAT_ATTR(thresh9, thresh, "config:24-35");
DEFINE_UNCORE_FORMAT_ATTR(thresh8, thresh, "config:24-31");
@@ -6511,7 +6512,7 @@ static struct attribute *dmr_imc_uncore_formats_attr[] = {
&format_attr_umask.attr,
&format_attr_edge.attr,
&format_attr_inv.attr,
- &format_attr_thresh10.attr,
+ &format_attr_thresh9_3.attr,
NULL,
};
@@ -6525,6 +6526,7 @@ static struct intel_uncore_type dmr_uncore_imc = {
.fixed_ctr_bits = 48,
.fixed_ctr = DMR_IMC_PMON_FIXED_CTR,
.fixed_ctl = DMR_IMC_PMON_FIXED_CTL,
+ .event_mask_ext = DMR_IMC_EVENT_MASK_EXT,
.format_group = &dmr_imc_uncore_format_group,
.attr_update = uncore_alias_groups,
};
--
2.56.1
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config
2026-12-05 3:22 [PATCH 00/12] perf/x86/intel/uncore: Fix 64-bit counter config Zide Chen
` (11 preceding siblings ...)
2026-12-05 3:22 ` [PATCH 12/12] perf/x86/intel/uncore: Fix DMR IMC threshold field Zide Chen
@ 2026-12-05 3:54 ` sashiko-bot
12 siblings, 0 replies; 20+ messages in thread
From: sashiko-bot @ 2026-12-05 3:54 UTC (permalink / raw)
To: Zide Chen; +Cc: linux-perf-users
Sashiko has finished reviewing this 12-patch series:
- Patches 1-5, 7, 9, 10, and 12: no issues found.
- Patch 6 ("perf/x86/intel/uncore: Fix SPR/EMR/GNR/SRF IMC and H..."): 1
potential issue (1 Low)
- Patch 8 ("perf/x86/intel/uncore: Drop spr_uncore_pci_ops for g..."): 2
potential issues (2 Low)
- Patch 11 ("perf/x86/intel/uncore: Consolidate SKX, SNR and ICX..."): 1
potential issue (1 Low)
Detailed reviews have been sent as separate replies to patches 6, 8, and
11.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205032253.258646-1-zide.chen@intel.com
^ permalink raw reply [flat|nested] 20+ messages in thread