perf/x86/intel: Fix inaccurate hard-coded event configurations
Subsystems (2)
cover perf/x86/intel: Fix inaccurate hard-coded event configurations
Currently, the Intel perf code defines several hard-coded event configurations for each platform. These configurations include event constraints, extra MSR settings, and predefined extra MSR values for certain cache events.
For example, the following five hard-coded event configurations are defined for Sapphire Rapids:
- intel_glc_event_constraints[]: Non-PEBS event constraints.
- intel_glc_pebs_event_constraints[]: PEBS event constraints.
- intel_glc_extra_regs[]: Event-to-extra MSR mapping for events requiring extra MSR access.
- glc_hw_cache_event_ids[]: Cache event IDs.
- glc_hw_cache_extra_regs[]: Extra MSR values for L3 and node events, mainly for OCR/OMR events.
However, these hard-coded configurations can become outdated or incorrect as perfmon events are continuously updated
(see: https://github.com/intel/perfmon). This can result in events being scheduled on incorrect hardware counters, leading to inaccurate counts, especially for legacy cache events such as llc-load-misses and llc-store-misses. While these legacy events are less commonly used since the introduction of JSON-based cache events, it is still important to keep them accurate.
This patchset addresses all identified mismatches on mainstream platforms, including server platforms (ICX, SPR, EMR, GNR, DMR, SRF, and CWF) and client platforms (ADL, MTL, LNL, ARL, PTL, and NVL).
Note: Due to issues in the 7.1-rc2 release that cause boot-up hangs on Intel hybrid platforms, this patchset was developed and tested against the 7.0 release.
Testing:
All tests below were run on the platforms mentioned above, with no issues found:
1. Perf counting test:
$perf test 114
2. Perf sampling test:
$perf test 148
3. Legacy LLC cache events counting test:
$perf stat -e llc-loads,llc-load-misses,llc-stores,llc-store-misses -a
Dapeng Mi (11):
perf/x86/intel: Update event constraints and cache_extra_regs[] for
ICX
perf/x86/intel: Update event constraints and cache_extra_regs[] for
SPR
perf/x86/intel: Update event constraints for DMR perf/x86/intel: Update event constraints and cache_extra_regs[] for
ADL
perf/x86/intel: Update event constraints and cache_extra_regs[] for
MTL
perf/x86/intel: Update event constraints and cache_extra_regs[] for
LNL
perf/x86/intel: Update event constraints and cache_extra_regs[] for
ARL
perf/x86/intel: Update event constraints for PTL perf/x86/intel: Update event constraints and cache_extra_regs[] for
NVL
perf/x86/intel: Update event constraints and cache_extra_regs[] for
SRF
perf/x86/intel: Update event constraints and cache_extra_regs[] for
CWF
arch/x86/events/intel/core.c | 476 +++++++++++++++++++++++++++++------ arch/x86/events/intel/ds.c | 23 +- arch/x86/events/perf_event.h | 4 +- 3 files changed, 421 insertions(+), 82 deletions(-)
base-commit: 028ef9c96e96197026887c0f092424679298aae8
Signature · 1 line
2.34.1
PATCH 1/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for ICX
Update perf hard-coded event constraints and cache_extra_regs[] for Icelake server according to the latest ICX perfmon events (v1.30).
Since the value of cache extra registers differs with previous generations, introduce new snc_hw_cache_extra_regs[] to represent the value of extra registers on ICX.
ICX perfmon events:
https://github.com/intel/perfmon/blob/main/ICX/events/icelakex_core.json
--- arch/x86/events/intel/core.c | 48 ++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-)
arch/x86/events/intel/core.c +43 -5
@@ -310,10 +310,11 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* old INST_RETIRED.PREC_DIST */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -1019,6 +1020,41 @@ static __initconst const u64 skl_hw_cache_extra_regs }, }; +static __initconst const u64 snc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x3F3FFC0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3F3FC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, + [C (NODE ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x104000002 ,/* OCR.DEMAND_RFO.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000002 ,/* OCR.DEMAND_RFO.REMOTE_DRAM */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, +}; +#define SNB_DMND_DATA_RD (1ULL << 0)#define SNB_DMND_RFO (1ULL << 1)#define SNB_DMND_IFETCH (1ULL << 2)
@@ -8119,17 +8155,19 @@ __init int intel_pmu_init(void)case INTEL_ICELAKE_X :case INTEL_ICELAKE_D : +memcpy (hw_cache_extra_regs, snc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); x86_pmu.pebs_ept =1 ; pmem = true; - fallthrough; + goto snc_common;case INTEL_ICELAKE_L :case INTEL_ICELAKE :case INTEL_TIGERLAKE_L :case INTEL_TIGERLAKE :case INTEL_ROCKETLAKE : +memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); + snc_common: x86_pmu.late_ack = true;memcpy (hw_cache_event_ids, skl_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); hw_cache_event_ids[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;intel_pmu_lbr_init_skl ();
Signature · 1 line
2.34.1
Re: [PATCH 01/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ICX
Quoted 2 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Icelake server according to the latest ICX perfmon events (v1.30).
Nit: Ice Lake>
Quoted 9 lines
Since the value of cache extra registers differs with previous generations, introduce new snc_hw_cache_extra_regs[] to represent the value of extra registers on ICX.
ICX perfmon events:
https://github.com/intel/perfmon/blob/main/ICX/events/icelakex_core.jsonSigned-off-by Dapeng Mi <[email protected]>---
Quoted 86 lines
arch/x86/events/intel/core.c | 48 ++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-)arch/x86/events/intel/core.c +43
-5@@ -310,10 +310,11 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* old INST_RETIRED.PREC_DIST */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),@@ -1019,6 +1020,41 @@ static __initconst const u64 skl_hw_cache_extra_regs }, }; +static __initconst const u64 snc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x3F3FFC0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3F3FC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, + [C (NODE ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x104000002 ,/* OCR.DEMAND_RFO.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000002 ,/* OCR.DEMAND_RFO.REMOTE_DRAM */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, +}; +#define SNB_DMND_DATA_RD (1ULL << 0)#define SNB_DMND_RFO (1ULL << 1)#define SNB_DMND_IFETCH (1ULL << 2)@@ -8119,17 +8155,19 @@ __init int intel_pmu_init(void)case INTEL_ICELAKE_X :case INTEL_ICELAKE_D : +memcpy (hw_cache_extra_regs, snc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); x86_pmu.pebs_ept =1 ; pmem = true; - fallthrough; + goto snc_common;case INTEL_ICELAKE_L :case INTEL_ICELAKE :case INTEL_TIGERLAKE_L :case INTEL_TIGERLAKE :case INTEL_ROCKETLAKE : +memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); + snc_common: x86_pmu.late_ack = true;memcpy (hw_cache_event_ids, skl_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); hw_cache_event_ids[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;intel_pmu_lbr_init_skl ();
Re: [PATCH 01/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ICX
Quoted 5 lines · Zide
Quoted 2 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Icelake server according to the latest ICX perfmon events (v1.30).
Nit: Ice Lake>
Sure. Thanks.
Quoted 97 lines
Quoted 9 lines
Since the value of cache extra registers differs with previous generations, introduce new snc_hw_cache_extra_regs[] to represent the value of extra registers on ICX.
ICX perfmon events:
https://github.com/intel/perfmon/blob/main/ICX/events/icelakex_core.jsonSigned-off-by Dapeng Mi <[email protected]>---
Reviewed-by [email protected]Quoted 86 lines
arch/x86/events/intel/core.c | 48 ++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-)arch/x86/events/intel/core.c +43
-5@@ -310,10 +310,11 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* old INST_RETIRED.PREC_DIST */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),@@ -1019,6 +1020,41 @@ static __initconst const u64 skl_hw_cache_extra_regs }, }; +static __initconst const u64 snc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x3F3FFC0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3F3FC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, + [C (NODE ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x104000002 ,/* OCR.DEMAND_RFO.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000002 ,/* OCR.DEMAND_RFO.REMOTE_DRAM */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, +}; +#define SNB_DMND_DATA_RD (1ULL << 0)#define SNB_DMND_RFO (1ULL << 1)#define SNB_DMND_IFETCH (1ULL << 2)@@ -8119,17 +8155,19 @@ __init int intel_pmu_init(void)case INTEL_ICELAKE_X :case INTEL_ICELAKE_D : +memcpy (hw_cache_extra_regs, snc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); x86_pmu.pebs_ept =1 ; pmem = true; - fallthrough; + goto snc_common;case INTEL_ICELAKE_L :case INTEL_ICELAKE :case INTEL_TIGERLAKE_L :case INTEL_TIGERLAKE :case INTEL_ROCKETLAKE : +memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); + snc_common: x86_pmu.late_ack = true;memcpy (hw_cache_event_ids, skl_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); hw_cache_event_ids[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;intel_pmu_lbr_init_skl ();
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor ICX
In reply to Dapeng MiThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: acc41cdcb091453f48381d1c0d2e76b63c9d985f Gitweb: https://git.kernel.org/tip/acc41cdcb091453f48381d1c0d2e76b63c9d985f Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:33 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:02 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor ICX
Update perf hard-coded event constraints and cache_extra_regs[] for Icelake server according to the latest ICX perfmon events (v1.30).
Since the value of cache extra registers differs with previous generations, introduce new snc_hw_cache_extra_regs[] to represent the value of extra registers on ICX.
ICX perfmon events:
https://github.com/intel/perfmon/blob/main/ICX/events/icelakex_core.json
--- arch/x86/events/intel/core.c | 48 +++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 5 deletions(-)
arch/x86/events/intel/core.c +43 -5
@@ -310,10 +310,11 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = {static struct event_constraint intel_icl_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x01c0 ,0 ),/* old INST_RETIRED.PREC_DIST */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -1019,6 +1020,41 @@ static __initconst const u64 skl_hw_cache_extra_regs }, }; +static __initconst const u64 snc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x3F3FFC0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3F3FC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, + [C (NODE ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x104000002 ,/* OCR.DEMAND_RFO.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000002 ,/* OCR.DEMAND_RFO.REMOTE_DRAM */ + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =0x0 , + [C (RESULT_MISS ) ] =0x0 , + }, + }, +}; +#define SNB_DMND_DATA_RD (1ULL << 0)#define SNB_DMND_RFO (1ULL << 1)#define SNB_DMND_IFETCH (1ULL << 2)
@@ -8154,17 +8190,19 @@ __init int intel_pmu_init(void)case INTEL_ICELAKE_X :case INTEL_ICELAKE_D : +memcpy (hw_cache_extra_regs, snc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); x86_pmu.pebs_ept =1 ; pmem = true; - fallthrough; + goto snc_common;case INTEL_ICELAKE_L :case INTEL_ICELAKE :case INTEL_TIGERLAKE_L :case INTEL_TIGERLAKE :case INTEL_ROCKETLAKE : +memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); + snc_common: x86_pmu.late_ack = true;memcpy (hw_cache_event_ids, skl_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hw_cache_extra_regs, skl_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); hw_cache_event_ids[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;intel_pmu_lbr_init_skl ();
PATCH 2/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for SPR
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Sapphire rapids according to the latest SPR perfmon events (v1.39).
Emerald Rapids (EMR) and Granite Rapids (GNR) share exactly same event constraints and extra MSR values with SPR. No extra changes are needed for EMR and GNR.
Please note the change could temporarily impact other platforms which share the hard coded data structures, but it would be fixed in subsequent patches soon.
SPR perfmon events:
https://github.com/intel/perfmon/blob/main/SPR/events/sapphirerapids_core.json
--- arch/x86/events/intel/core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
arch/x86/events/intel/core.c +14 -9
@@ -356,11 +356,12 @@ static struct extra_reg intel_glc_extra_regs[] __read_mostly = {static struct event_constraint intel_glc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -380,9 +381,13 @@ static struct event_constraint intel_glc_event_constraints[] = {INTEL_UEVENT_CONSTRAINT (0x01a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x02a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x05a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x06a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x08a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x0ca3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x08a4 ,0x1 ), +INTEL_UEVENT_CONSTRAINT (0x01cd ,0xfe ),INTEL_UEVENT_CONSTRAINT (0x02cd ,0x1 ),INTEL_EVENT_CONSTRAINT (0xce ,0x1 ), INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xdf, 0xf),
@@ -714,18 +719,18 @@ static __initconst const u64 glc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10001 , - [C (RESULT_MISS ) ] =0x3fbfc00001 , + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x3f3ffc0002 , - [C (RESULT_MISS ) ] =0x3f3fc00002 , + [C (RESULT_ACCESS ) ] =0x3f3ffc0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3f3fc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ }, }, [C (NODE ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10c000001 , - [C (RESULT_MISS ) ] =0x3fb3000001 , + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ }, }, };
Signature · 1 line
2.34.1
Re: [PATCH 02/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for SPR
Quoted 10 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Sapphire rapids according to the latest SPR perfmon events (v1.39).
Emerald Rapids (EMR) and Granite Rapids (GNR) share exactly same event constraints and extra MSR values with SPR. No extra changes are needed for EMR and GNR.
Please note the change could temporarily impact other platforms which share the hard coded data structures, but it would be fixed in subsequent patches soon.
This may make bisection difficult. Would it be possible to reorder the patches to avoid this? For example, moving patch 6/11 ahead of this patch to avoid impacting Lunar Lake.
Quoted 67 lines
SPR perfmon events:
https://github.com/intel/perfmon/blob/main/SPR/events/sapphirerapids_core.jsonSigned-off-by Dapeng Mi <[email protected]>--- arch/x86/events/intel/core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)arch/x86/events/intel/core.c +14
-9@@ -356,11 +356,12 @@ static struct extra_reg intel_glc_extra_regs[] __read_mostly = {static struct event_constraint intel_glc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),@@ -380,9 +381,13 @@ static struct event_constraint intel_glc_event_constraints[] = {INTEL_UEVENT_CONSTRAINT (0x01a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x02a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x05a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x06a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x08a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x0ca3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x08a4 ,0x1 ), +INTEL_UEVENT_CONSTRAINT (0x01cd ,0xfe ),INTEL_UEVENT_CONSTRAINT (0x02cd ,0x1 ),INTEL_EVENT_CONSTRAINT (0xce ,0x1 ), INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xdf, 0xf),@@ -714,18 +719,18 @@ static __initconst const u64 glc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10001 , - [C (RESULT_MISS ) ] =0x3fbfc00001 , + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x3f3ffc0002 , - [C (RESULT_MISS ) ] =0x3f3fc00002 , + [C (RESULT_ACCESS ) ] =0x3f3ffc0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3f3fc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ }, }, [C (NODE ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10c000001 , - [C (RESULT_MISS ) ] =0x3fb3000001 , + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ }, }, };
Re: [PATCH 02/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for SPR
Quoted 9 lines · Zide
Quoted 7 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Sapphire rapids according to the latest SPR perfmon events (v1.39).
Emerald Rapids (EMR) and Granite Rapids (GNR) share exactly same event constraints and extra MSR values with SPR. No extra changes are needed for EMR and GNR.
Quoted 6 lines
Quoted 3 lines
Please note the change could temporarily impact other platforms which share the hard coded data structures, but it would be fixed in subsequent patches soon.
This may make bisection difficult. Would it be possible to reorder the patches to avoid this? For example, moving patch 6/11 ahead of this patch to avoid impacting Lunar Lake.
Hmm, it's hard to fix it by just reordering the patches. Currently the hard-coded event data structures of previous generations would be reused by later generations. If there are some differences between the older and later generations, only the differences are overwritten. So even we move the patch 6/11 ahead of this patch, it still impacts other platforms.
Besides, the "impact" here doesn't mean it must cause issues, it may fix the incorrect hard-coded event configurations (This should be most of the cases), sometimes the new changes may be still inaccurate for other platforms which reuse the hard-coded event structures, but it doesn't make things worse.
Strictly speaking, I don't think this could cause the bisection issue. For a certain platform, we still can figure out which commit causes the issues by bisection.
IMO, it seems there is no way to ensure the change won't impact other platforms except putting all changes into a single patch which is obviously not accepted.
Thanks.
Quoted 68 lines
Quoted 68 lines
SPR perfmon events:
https://github.com/intel/perfmon/blob/main/SPR/events/sapphirerapids_core.jsonSigned-off-by Dapeng Mi <[email protected]>--- arch/x86/events/intel/core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)arch/x86/events/intel/core.c +14
-9@@ -356,11 +356,12 @@ static struct extra_reg intel_glc_extra_regs[] __read_mostly = {static struct event_constraint intel_glc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),@@ -380,9 +381,13 @@ static struct event_constraint intel_glc_event_constraints[] = {INTEL_UEVENT_CONSTRAINT (0x01a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x02a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x05a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x06a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x08a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x0ca3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x08a4 ,0x1 ), +INTEL_UEVENT_CONSTRAINT (0x01cd ,0xfe ),INTEL_UEVENT_CONSTRAINT (0x02cd ,0x1 ),INTEL_EVENT_CONSTRAINT (0xce ,0x1 ), INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xdf, 0xf),@@ -714,18 +719,18 @@ static __initconst const u64 glc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10001 , - [C (RESULT_MISS ) ] =0x3fbfc00001 , + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x3f3ffc0002 , - [C (RESULT_MISS ) ] =0x3f3fc00002 , + [C (RESULT_ACCESS ) ] =0x3f3ffc0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3f3fc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ }, }, [C (NODE ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10c000001 , - [C (RESULT_MISS ) ] =0x3fb3000001 , + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ }, }, };
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor SPR
In reply to Dapeng MiThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 30d82ddee085b4b0f9a1b5bded53acaca68d9a52 Gitweb: https://git.kernel.org/tip/30d82ddee085b4b0f9a1b5bded53acaca68d9a52 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:34 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:02 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor SPR
Update perf hard-coded event constraints and cache_extra_regs[] for Sapphire rapids according to the latest SPR perfmon events (v1.39).
Emerald Rapids (EMR) and Granite Rapids (GNR) share exactly same event constraints and extra MSR values with SPR. No extra changes are needed for EMR and GNR.
Please note the change could temporarily impact other platforms which share the hard coded data structures, but it would be fixed in subsequent patches soon.
SPR perfmon events:
https://github.com/intel/perfmon/blob/main/SPR/events/sapphirerapids_core.json
--- arch/x86/events/intel/core.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
arch/x86/events/intel/core.c +14 -9
@@ -356,11 +356,12 @@ static struct extra_reg intel_glc_extra_regs[] __read_mostly = {static struct event_constraint intel_glc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -380,9 +381,13 @@ static struct event_constraint intel_glc_event_constraints[] = {INTEL_UEVENT_CONSTRAINT (0x01a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x02a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x05a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x06a3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x08a3 ,0xf ), +INTEL_UEVENT_CONSTRAINT (0x0ca3 ,0xf ),INTEL_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x08a4 ,0x1 ), +INTEL_UEVENT_CONSTRAINT (0x01cd ,0xfe ),INTEL_UEVENT_CONSTRAINT (0x02cd ,0x1 ),INTEL_EVENT_CONSTRAINT (0xce ,0x1 ), INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xdf, 0xf),
@@ -714,18 +719,18 @@ static __initconst const u64 glc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10001 , - [C (RESULT_MISS ) ] =0x3fbfc00001 , + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x3f3ffc0002 , - [C (RESULT_MISS ) ] =0x3f3fc00002 , + [C (RESULT_ACCESS ) ] =0x3f3ffc0002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3f3fc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ }, }, [C (NODE ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x10c000001 , - [C (RESULT_MISS ) ] =0x3fb3000001 , + [C (RESULT_ACCESS ) ] =0x104000001 ,/* OCR.DEMAND_DATA_RD.LOCAL_DRAM */ + [C (RESULT_MISS ) ] =0x730000001 ,/* OCR.DEMAND_DATA_RD.REMOTE_DRAM */ }, }, };
PATCH 3/11 perf/x86/intel: Update event constraints for DMR
In reply to Dapeng MiAdd missed event constraint for 0x0200 event and add comments to show the event names in pnc_hw_cache_extra_regs[].
--- arch/x86/events/intel/core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
arch/x86/events/intel/core.c +8 -7
@@ -466,11 +466,12 @@ static struct extra_reg intel_lnc_extra_regs[] __read_mostly = {static struct event_constraint intel_pnc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -821,12 +822,12 @@ static __initconst const u64 pnc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x4000000000000001 , - [C (RESULT_MISS ) ] =0xFFFFF000000001 , + [C (RESULT_ACCESS ) ] =0x4000000000000001 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFFFFF000000001 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x4000000000000002 , - [C (RESULT_MISS ) ] =0xFFFFF000000002 , + [C (RESULT_ACCESS ) ] =0x4000000000000002 ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFFFFF000000002 ,/* OMR.DEMAND_RFO.L3_MISS */ }, }, };
Signature · 1 line
2.34.1
Re: [PATCH 03/11] perf/x86/intel: Update event constraints for DMR
Quoted 5 lines · Dapeng Mi
Add missed event constraint for
0x0200event and add comments to show the event names in pnc_hw_cache_extra_regs[].Signed-off-by Dapeng Mi <[email protected]>---
Quoted 40 lines
arch/x86/events/intel/core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)arch/x86/events/intel/core.c +8
-7@@ -466,11 +466,12 @@ static struct extra_reg intel_lnc_extra_regs[] __read_mostly = {static struct event_constraint intel_pnc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),@@ -821,12 +822,12 @@ static __initconst const u64 pnc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x4000000000000001 , - [C (RESULT_MISS ) ] =0xFFFFF000000001 , + [C (RESULT_ACCESS ) ] =0x4000000000000001 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFFFFF000000001 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x4000000000000002 , - [C (RESULT_MISS ) ] =0xFFFFF000000002 , + [C (RESULT_ACCESS ) ] =0x4000000000000002 ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFFFFF000000002 ,/* OMR.DEMAND_RFO.L3_MISS */ }, }, };
[tip: perf/core] perf/x86/intel: Update event constraints for DMR
In reply to Dapeng MiThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 070bd45e1dba684bfa4e7fdaa8ef8efa99b4572e Gitweb: https://git.kernel.org/tip/070bd45e1dba684bfa4e7fdaa8ef8efa99b4572e Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:35 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:03 +02:00
perf/x86/intel: Update event constraints for DMR
Add missed event constraint for 0x0200 event and add comments to show the event names in pnc_hw_cache_extra_regs[].
--- arch/x86/events/intel/core.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
arch/x86/events/intel/core.c +8 -7
@@ -466,11 +466,12 @@ static struct extra_reg intel_lnc_extra_regs[] __read_mostly = {static struct event_constraint intel_pnc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -821,12 +822,12 @@ static __initconst const u64 pnc_hw_cache_extra_regs { [C (LL ) ] = { [C (OP_READ ) ] = { - [C (RESULT_ACCESS ) ] =0x4000000000000001 , - [C (RESULT_MISS ) ] =0xFFFFF000000001 , + [C (RESULT_ACCESS ) ] =0x4000000000000001 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFFFFF000000001 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE ) ] = { - [C (RESULT_ACCESS ) ] =0x4000000000000002 , - [C (RESULT_MISS ) ] =0xFFFFF000000002 , + [C (RESULT_ACCESS ) ] =0x4000000000000002 ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFFFFF000000002 ,/* OMR.DEMAND_RFO.L3_MISS */ }, }, };
PATCH 4/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for ADL
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Alderlake according to the latest ADL perfmon events (V1.39).
One important note is that ADL has differences on the L3/node related OCR events although it shares same uarch with SPR server, e.g., ADL has different extra MSR values and no node events. So some variants of structures and functions are introduced to reflect these differences, like adl_glc_hw_cache_event_ids[], adl_glc_hw_cache_extra_regs[] and intel_pmu_init_glc_hybrid(), etc.
Please note these changes would temporarily impact other platforms like MTL/ARL-U which shares hard-coded event structures, but it would be fixed soon in subsequent patches.
ADL perfmon events:
https://github.com/intel/perfmon/blob/main/ADL/events/alderlake_goldencove_core.json
https://github.com/intel/perfmon/blob/main/ADL/events/alderlake_gracemont_core.json
--- arch/x86/events/intel/core.c | 137 +++++++++++++++++++++++++++++++++-- arch/x86/events/intel/ds.c | 2 +- 2 files changed, 131 insertions(+), 8 deletions(-)
arch/x86/events/intel/core.c +130 -7
@@ -215,8 +215,10 @@ static struct event_constraint intel_slm_event_constraints[] __read_mostly =static struct event_constraint intel_grt_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ EVENT_CONSTRAINT_END };
@@ -713,6 +715,80 @@ static __initconst const u64 glc_hw_cache_event_ids }, }; +/* ADL P-core (Golden cove) specific event code. */ +static __initconst const u64 adl_glc_hw_cache_event_ids + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (L1D ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe124 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + }, + }, + [C (L1I ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_MISS ) ] =0xe424 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x12a , + [C (RESULT_MISS ) ] =0x12a , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x12a , + [C (RESULT_MISS ) ] =0x12a , + }, + }, + [C (DTLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe12 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + [C (RESULT_MISS ) ] =0xe13 , + }, + }, + [C (ITLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =0xe11 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (BPU ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x4c4 , + [C (RESULT_MISS ) ] =0x4c5 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, +}; +static __initconst const u64 glc_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -736,6 +812,24 @@ static __initconst const u64 glc_hw_cache_extra_regs }, }; +/* ADL P-core (Golden cove) specific extra regs value. */ +static __initconst const u64 adl_glc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2384,6 +2478,23 @@ static __initconst const u64 tnt_hw_cache_extra_regs }, }; +static __initconst const u64 grt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3F84400001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3F84400002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; + +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2434,9 +2545,12 @@ static struct attribute *grt_mem_attrs[] = { };static struct extra_reg intel_grt_extra_regs[]__read_mostly = { -/* must define OFFCORE_RSP_X first, see intel_fixup_er() */ -INTEL_UEVENT_EXTRA_REG (0x01b7 ,MSR_OFFCORE_RSP_0 ,0x3fffffffffull ,RSP_0 ), -INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OFFCORE_RSP_1 ,0x3fffffffffull ,RSP_1 ), +/* +* Must define OFFCORE_RSP_X first, see intel_fixup_er(). +* Bit 63 only valid on OFFCORE_RSP_0 MSR. +*/ +INTEL_UEVENT_EXTRA_REG (0x01b7 ,MSR_OFFCORE_RSP_0 ,0x8003f03fffffffffull ,RSP_0 ), +INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OFFCORE_RSP_1 ,0x3f03fffffffffull ,RSP_1 ),INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x5d0 ),EVENT_EXTRA_END };
@@ -7499,6 +7613,15 @@ static __always_inline void intel_pmu_init_glc(struct pmu *pmu)intel_pmu_ref_cycles_ext (); } +static __always_inline void intel_pmu_init_glc_hybrid(struct pmu *pmu) +{ +intel_pmu_init_glc (pmu); + +/* ADL has different extra MSR values from Server for the L3 or node OCR/OMR events. */ +memcpy (hybrid_var (pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids,sizeof (hw_cache_event_ids)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), adl_glc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_grt(struct pmu *pmu) { x86_pmu.mid_ack = true;
@@ -7511,7 +7634,7 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu) x86_pmu.flags |=PMU_FL_INSTR_LATENCY ;memcpy (hybrid_var (pmu, hw_cache_event_ids), glp_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hybrid_var (pmu, hw_cache_extra_regs), tnt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), grt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));hybrid_var (pmu, hw_cache_event_ids)[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;hybrid (pmu, event_constraints) = intel_grt_event_constraints;hybrid (pmu, pebs_constraints) = intel_grt_pebs_event_constraints;
@@ -8269,7 +8392,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_glc (&pmu->pmu); +intel_pmu_init_glc_hybrid (&pmu->pmu);if (cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) { pmu->cntr_mask64 <<=2 ; pmu->cntr_mask64 |=0x3 ;
@@ -8326,7 +8449,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_glc (&pmu->pmu); +intel_pmu_init_glc_hybrid (&pmu->pmu); pmu->extra_regs = intel_rwc_extra_regs;/* Initialize Atom core specific PerfMon capabilities.*/
arch/x86/events/intel/ds.c +1 -1
@@ -1292,7 +1292,7 @@ struct event_constraint intel_glm_pebs_event_constraints[] = {struct event_constraint intel_grt_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0x3 ), -INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xf ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0x3f ),EVENT_CONSTRAINT_END };
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 04/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ADL
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The commit introduces a bisectability regression for MTL and ARL-U platforms by temporarily…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The commit introduces a bisectability regression for MTL and ARL-U platforms by temporarily applying incorrect Alderlake-specific cache event structures.
- [Low] Unnecessary duplication of the Golden Cove hardware cache event IDs array.
--
commit 58bdcbf21858fcf6337dcba2e5e091a86ddafd3c
Author: Dapeng Mi <[email protected]>
perf/x86/intel: Update event constraints and cache_extra_regs[] for ADL
This commit updates the hard-coded event constraints and cache_extra_regs[] for Alderlake according to the latest ADL perfmon events. It introduces ADL-specific variants of structures and functions to reflect differences in L3/node related OCR events.
Quoted 3 lines
Please note these changes would temporarily impact other platforms like MTL/ARL-U which shares hard-coded event structures, but it would be fixed soon in subsequent patches.
Does this introduce a bisectability regression for Meteorlake and Arrowlake-U platforms?
Every commit needs to be self-contained and functionally correct to keep the tree bisectable. I noticed the fixes are included later in the series.
Could the patch series be reorganized to avoid leaving any platform in a regressed state during bisection?
Quoted 4 lines
arch/x86/events/intel/core.c +0
-0
[ ... ]
Quoted 19 lines
arch/x86/events/intel/core.c +15
-0@@ -713,6 +715,80 @@ static __initconst const u64 glc_hw_cache_event_ids }, }; +/* ADL P-core (Golden cove) specific event code. */ +static __initconst const u64 adl_glc_hw_cache_event_ids + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (L1D ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe124 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + }, + },
[ ... ]
Quoted 5 lines
+ [ C(BPU ) ] = {
arch/x86/events/intel/core.c +4
-0+ [ C(OP_READ) ] = { + [ C(RESULT_ACCESS) ] = 0x4c4, + [ C(RESULT_MISS) ] = 0x4c5, + },
arch/x86/events/intel/core.c static __initconst const u64 glc_hw_cache_event_ids · line 790
Quoted 10 lines
arch/x86/events/intel/core.c +10
-0+ [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, +};
This array appears to be identical to the existing glc_hw_cache_event_ids array, except that the C(NODE) entries are omitted and default to zero.
Instead of duplicating the entire array and risking silent divergence when future updates are made, could we dynamically clear the C(NODE) entries for Alderlake during initialization?
A similar pattern of localized overrides is already utilized in intel_pmu_init_grt() for the C(ITLB) event.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Re: [PATCH 04/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ADL
Quoted 18 lines · On 5/15/2026 2:38 PM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The commit introduces a bisectability regression for MTL and ARL-U platforms by temporarily applying incorrect Alderlake-specific cache event structures.
- [Low] Unnecessary duplication of the Golden Cove hardware cache event IDs array.
--commit
58bdcbf21858fcf6337dcba2e5e091a86ddafd3c
Author: Dapeng Mi <[email protected]>perf/x86/intel: Update event constraints and cache_extra_regs[] for ADL
This commit updates the hard-coded event constraints and cache_extra_regs[] for Alderlake according to the latest ADL perfmon events. It introduces ADL-specific variants of structures and functions to reflect differences in L3/node related OCR events.
Quoted 3 lines
Please note these changes would temporarily impact other platforms like MTL/ARL-U which shares hard-coded event structures, but it would be fixed soon in subsequent patches.
Quoted 8 lines
Does this introduce a bisectability regression for Meteorlake and Arrowlake-U platforms?
Every commit needs to be self-contained and functionally correct to keep the tree bisectable. I noticed the fixes are included later in the series.
Could the patch series be reorganized to avoid leaving any platform in a regressed state during bisection?
Hmm, it would not introduce a bisectability regression. The hard coded cache event MSR value table are already inaccurate before this patch. Although the changes would impact the MTL/ARL-U, but it doesn't introduce new issues.
Quoted 46 lines
Quoted 5 lines
arch/x86/events/intel/core.c +0
-0[ ... ]
Quoted 19 lines
arch/x86/events/intel/core.c +15
-0@@ -713,6 +715,80 @@ static __initconst const u64 glc_hw_cache_event_ids }, }; +/* ADL P-core (Golden cove) specific event code. */ +static __initconst const u64 adl_glc_hw_cache_event_ids + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (L1D ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe124 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + }, + },[ ... ]
Quoted 5 lines
+ [ C(BPU ) ] = {
arch/x86/events/intel/core.c +4
-0+ [ C(OP_READ) ] = { + [ C(RESULT_ACCESS) ] = 0x4c4, + [ C(RESULT_MISS) ] = 0x4c5, + },arch/x86/events/intel/core.c static __initconst const u64 glc_hw_cache_event_ids · line 790
Quoted 10 lines
arch/x86/events/intel/core.c +10
-0+ [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, +};This array appears to be identical to the existing
glc_hw_cache_event_idsarray, except that the C(NODE) entries are omitted and default to zero.
Quoted 6 lines
Instead of duplicating the entire array and risking silent divergence when future updates are made, could we dynamically clear the C(NODE) entries for Alderlake during initialization?
A similar pattern of localized overrides is already utilized in
intel_pmu_init_grt()for the C(ITLB) event.
The new introduced adl_glc_hw_cache_event_ids[] table would be called by multiple places, It looks clearer to define a new table instead of overwriting the old table.
Thanks.
Quoted 1 line
Re: [PATCH 04/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ADL
In reply to Dapeng MiQuoted 10 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Alderlake according to the latest ADL perfmon events (V1.39).
One important note is that ADL has differences on the L3/node related OCR events although it shares same uarch with SPR server, e.g., ADL has different extra MSR values and no node events. So some variants of structures and functions are introduced to reflect these differences, like adl_glc_hw_cache_event_ids[], adl_glc_hw_cache_extra_regs[] and
intel_pmu_init_glc_hybrid(), etc.
Quoted 3 lines
Please note these changes would temporarily impact other platforms like MTL/ARL-U which shares hard-coded event structures, but it would be fixed soon in subsequent patches.
Ditto, could the code be rearranged to avoid this?
Quoted 228 lines
ADL perfmon events:
https://github.com/intel/perfmon/blob/main/ADL/events/alderlake_goldencove_core.json
https://github.com/intel/perfmon/blob/main/ADL/events/alderlake_gracemont_core.jsonSigned-off-by Dapeng Mi <[email protected]>--- arch/x86/events/intel/core.c | 137 +++++++++++++++++++++++++++++++++-- arch/x86/events/intel/ds.c | 2 +- 2 files changed, 131 insertions(+), 8 deletions(-)arch/x86/events/intel/core.c +130
-7@@ -215,8 +215,10 @@ static struct event_constraint intel_slm_event_constraints[] __read_mostly =static struct event_constraint intel_grt_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ EVENT_CONSTRAINT_END };@@ -713,6 +715,80 @@ static __initconst const u64 glc_hw_cache_event_ids }, }; +/* ADL P-core (Golden cove) specific event code. */ +static __initconst const u64 adl_glc_hw_cache_event_ids + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (L1D ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe124 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + }, + }, + [C (L1I ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_MISS ) ] =0xe424 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x12a , + [C (RESULT_MISS ) ] =0x12a , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x12a , + [C (RESULT_MISS ) ] =0x12a , + }, + }, + [C (DTLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe12 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + [C (RESULT_MISS ) ] =0xe13 , + }, + }, + [C (ITLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =0xe11 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (BPU ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x4c4 , + [C (RESULT_MISS ) ] =0x4c5 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, +}; +static __initconst const u64 glc_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]@@ -736,6 +812,24 @@ static __initconst const u64 glc_hw_cache_extra_regs }, }; +/* ADL P-core (Golden cove) specific extra regs value. */ +static __initconst const u64 adl_glc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]@@ -2384,6 +2478,23 @@ static __initconst const u64 tnt_hw_cache_extra_regs }, }; +static __initconst const u64 grt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3F84400001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3F84400002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; + +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]@@ -2434,9 +2545,12 @@ static struct attribute *grt_mem_attrs[] = { };static struct extra_reg intel_grt_extra_regs[]__read_mostly = { -/* must define OFFCORE_RSP_X first, see intel_fixup_er() */ -INTEL_UEVENT_EXTRA_REG (0x01b7 ,MSR_OFFCORE_RSP_0 ,0x3fffffffffull ,RSP_0 ), -INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OFFCORE_RSP_1 ,0x3fffffffffull ,RSP_1 ), +/* +* Must define OFFCORE_RSP_X first, see intel_fixup_er(). +* Bit 63 only valid on OFFCORE_RSP_0 MSR. +*/ +INTEL_UEVENT_EXTRA_REG (0x01b7 ,MSR_OFFCORE_RSP_0 ,0x8003f03fffffffffull ,RSP_0 ), +INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OFFCORE_RSP_1 ,0x3f03fffffffffull ,RSP_1 ),INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x5d0 ),EVENT_EXTRA_END };@@ -7499,6 +7613,15 @@ static __always_inline void intel_pmu_init_glc(struct pmu *pmu)intel_pmu_ref_cycles_ext (); } +static __always_inline void intel_pmu_init_glc_hybrid(struct pmu *pmu) +{ +intel_pmu_init_glc (pmu); + +/* ADL has different extra MSR values from Server for the L3 or node OCR/OMR events. */ +memcpy (hybrid_var (pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids,sizeof (hw_cache_event_ids)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), adl_glc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_grt(struct pmu *pmu) { x86_pmu.mid_ack = true;@@ -7511,7 +7634,7 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu) x86_pmu.flags |=PMU_FL_INSTR_LATENCY ;memcpy (hybrid_var (pmu, hw_cache_event_ids), glp_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hybrid_var (pmu, hw_cache_extra_regs), tnt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), grt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));hybrid_var (pmu, hw_cache_event_ids)[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;hybrid (pmu, event_constraints) = intel_grt_event_constraints;hybrid (pmu, pebs_constraints) = intel_grt_pebs_event_constraints;@@ -8269,7 +8392,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_glc (&pmu->pmu); +intel_pmu_init_glc_hybrid (&pmu->pmu);if (cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) { pmu->cntr_mask64 <<=2 ; pmu->cntr_mask64 |=0x3 ;@@ -8326,7 +8449,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_glc (&pmu->pmu); +intel_pmu_init_glc_hybrid (&pmu->pmu); pmu->extra_regs = intel_rwc_extra_regs;/* Initialize Atom core specific PerfMon capabilities.*/ arch/x86/events/intel/ds.c +1
-1@@ -1292,7 +1292,7 @@ struct event_constraint intel_glm_pebs_event_constraints[] = {struct event_constraint intel_grt_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0x3 ), -INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xf ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0x3f ),EVENT_CONSTRAINT_END };
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor ADL
In reply to Dapeng MiThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 4ef863352bcde482d65722ed721c3fd3967a67d6 Gitweb: https://git.kernel.org/tip/4ef863352bcde482d65722ed721c3fd3967a67d6 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:36 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:03 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor ADL
Update perf hard-coded event constraints and cache_extra_regs[] for Alderlake according to the latest ADL perfmon events (V1.39).
One important note is that ADL has differences on the L3/node related OCR events although it shares same uarch with SPR server, e.g., ADL has different extra MSR values and no node events. So some variants of structures and functions are introduced to reflect these differences, like adl_glc_hw_cache_event_ids[], adl_glc_hw_cache_extra_regs[] and intel_pmu_init_glc_hybrid(), etc.
Please note these changes would temporarily impact other platforms like MTL/ARL-U which shares hard-coded event structures, but it would be fixed soon in subsequent patches.
ADL perfmon events:
https://github.com/intel/perfmon/blob/main/ADL/events/alderlake_goldencove_core.json
https://github.com/intel/perfmon/blob/main/ADL/events/alderlake_gracemont_core.json
--- arch/x86/events/intel/core.c | 137 ++++++++++++++++++++++++++++++++-- arch/x86/events/intel/ds.c | 2 +- 2 files changed, 131 insertions(+), 8 deletions(-)
arch/x86/events/intel/core.c +130 -7
@@ -215,8 +215,10 @@ static struct event_constraint intel_slm_event_constraints[] __read_mostly =static struct event_constraint intel_grt_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ EVENT_CONSTRAINT_END };
@@ -713,6 +715,80 @@ static __initconst const u64 glc_hw_cache_event_ids }, }; +/* ADL P-core (Golden cove) specific event code. */ +static __initconst const u64 adl_glc_hw_cache_event_ids + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (L1D ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe124 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + }, + }, + [C (L1I ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_MISS ) ] =0xe424 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x12a , + [C (RESULT_MISS ) ] =0x12a , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x12a , + [C (RESULT_MISS ) ] =0x12a , + }, + }, + [C (DTLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x81d0 , + [C (RESULT_MISS ) ] =0xe12 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x82d0 , + [C (RESULT_MISS ) ] =0xe13 , + }, + }, + [C (ITLB ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =0xe11 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, + [C (BPU ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x4c4 , + [C (RESULT_MISS ) ] =0x4c5 , + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + [C (OP_PREFETCH ) ] = { + [C (RESULT_ACCESS ) ] =-1 , + [C (RESULT_MISS ) ] =-1 , + }, + }, +}; +static __initconst const u64 glc_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -736,6 +812,24 @@ static __initconst const u64 glc_hw_cache_extra_regs }, }; +/* ADL P-core (Golden cove) specific extra regs value. */ +static __initconst const u64 adl_glc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x3fbfc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2384,6 +2478,23 @@ static __initconst const u64 tnt_hw_cache_extra_regs }, }; +static __initconst const u64 grt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3F84400001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3F84400002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; + +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2434,9 +2545,12 @@ static struct attribute *grt_mem_attrs[] = { };static struct extra_reg intel_grt_extra_regs[]__read_mostly = { -/* must define OFFCORE_RSP_X first, see intel_fixup_er() */ -INTEL_UEVENT_EXTRA_REG (0x01b7 ,MSR_OFFCORE_RSP_0 ,0x3fffffffffull ,RSP_0 ), -INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OFFCORE_RSP_1 ,0x3fffffffffull ,RSP_1 ), +/* +* Must define OFFCORE_RSP_X first, see intel_fixup_er(). +* Bit 63 only valid on OFFCORE_RSP_0 MSR. +*/ +INTEL_UEVENT_EXTRA_REG (0x01b7 ,MSR_OFFCORE_RSP_0 ,0x8003f03fffffffffull ,RSP_0 ), +INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OFFCORE_RSP_1 ,0x3f03fffffffffull ,RSP_1 ),INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x5d0 ),EVENT_EXTRA_END };
@@ -7533,6 +7647,15 @@ static __always_inline void intel_pmu_init_glc(struct pmu *pmu)intel_pmu_ref_cycles_ext (); } +static __always_inline void intel_pmu_init_glc_hybrid(struct pmu *pmu) +{ +intel_pmu_init_glc (pmu); + +/* ADL has different extra MSR values from Server for the L3 or node OCR/OMR events. */ +memcpy (hybrid_var (pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids,sizeof (hw_cache_event_ids)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), adl_glc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_grt(struct pmu *pmu) { x86_pmu.mid_ack = true;
@@ -7545,7 +7668,7 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu) x86_pmu.flags |=PMU_FL_INSTR_LATENCY ;memcpy (hybrid_var (pmu, hw_cache_event_ids), glp_hw_cache_event_ids,sizeof (hw_cache_event_ids)); -memcpy (hybrid_var (pmu, hw_cache_extra_regs), tnt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), grt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));hybrid_var (pmu, hw_cache_event_ids)[C (ITLB )][C (OP_READ )][C (RESULT_ACCESS )] =-1 ;hybrid (pmu, event_constraints) = intel_grt_event_constraints;hybrid (pmu, pebs_constraints) = intel_grt_pebs_event_constraints;
@@ -8304,7 +8427,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_glc (&pmu->pmu); +intel_pmu_init_glc_hybrid (&pmu->pmu);if (cpu_feature_enabled (X86_FEATURE_HYBRID_CPU )) { pmu->cntr_mask64 <<=2 ; pmu->cntr_mask64 |=0x3 ;
@@ -8361,7 +8484,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_glc (&pmu->pmu); +intel_pmu_init_glc_hybrid (&pmu->pmu); pmu->extra_regs = intel_rwc_extra_regs;/* Initialize Atom core specific PerfMon capabilities.*/
arch/x86/events/intel/ds.c +1 -1
@@ -1292,7 +1292,7 @@ struct event_constraint intel_glm_pebs_event_constraints[] = {struct event_constraint intel_grt_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0x3 ), -INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xf ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0x3f ),EVENT_CONSTRAINT_END };
PATCH 5/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for MTL
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Meteor Lake according to the latest MTL perfmon events (V1.21).
MTL P-core (redwoodcove) inherits same perf events list from previous generation (Goldencove), but the E-core (Crestmont) brings some difference on the perf event list comparing with Gracemont. So apply the changes for Crestmont core.
MTL perfmon events:
https://github.com/intel/perfmon/blob/main/MTL/events/meteorlake_redwoodcove_core.json
https://github.com/intel/perfmon/blob/main/MTL/events/meteorlake_crestmont_core.json
--- arch/x86/events/intel/core.c | 27 +++++++++++++++++++++++++-- arch/x86/events/intel/ds.c | 7 +++++++ arch/x86/events/perf_event.h | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-)
arch/x86/events/intel/core.c +25 -2
@@ -2494,6 +2494,21 @@ static __initconst const u64 grt_hw_cache_extra_regs }, }; +static __initconst const u64 cmt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3fbfc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +};static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ]
@@ -7643,6 +7658,15 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu)intel_pmu_ref_cycles_ext (); } +static __always_inline void intel_pmu_init_cmt(struct pmu *pmu) +{ +intel_pmu_init_grt (pmu); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + cmt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +hybrid (pmu, pebs_constraints) = intel_cmt_pebs_event_constraints; +hybrid (pmu, extra_regs) = intel_cmt_extra_regs; +} + static __always_inline void intel_pmu_init_lnc(struct pmu *pmu) {intel_pmu_init_glc (pmu);
@@ -8454,8 +8478,7 @@ __init int intel_pmu_init(void)/* Initialize Atom core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; -intel_pmu_init_grt (&pmu->pmu); - pmu->extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (&pmu->pmu);intel_pmu_pebs_data_source_mtl ();pr_cont ("Meteorlake Hybrid events, " );
arch/x86/events/intel/ds.c +7 -0
@@ -1296,6 +1296,13 @@ struct event_constraint intel_grt_pebs_event_constraints[] = {EVENT_CONSTRAINT_END }; +struct event_constraint intel_cmt_pebs_event_constraints[] = { +/* Allow all events as PEBS with no flags */ +INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0x3 ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xff ), +EVENT_CONSTRAINT_END +}; +struct event_constraint intel_arw_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ),
arch/x86/events/perf_event.h +2 -0
@@ -1702,6 +1702,8 @@ extern struct event_constraint intel_glp_pebs_event_constraints[];extern struct event_constraint intel_grt_pebs_event_constraints[]; +extern struct event_constraint intel_cmt_pebs_event_constraints[]; +extern struct event_constraint intel_arw_pebs_event_constraints[];extern struct event_constraint intel_nehalem_pebs_event_constraints[];
Signature · 1 line
2.34.1
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor MTL
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: e99fb45436eaa4ac1b72a8e4af56381f59759b0c Gitweb: https://git.kernel.org/tip/e99fb45436eaa4ac1b72a8e4af56381f59759b0c Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:37 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:03 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor MTL
Update perf hard-coded event constraints and cache_extra_regs[] for Meteor Lake according to the latest MTL perfmon events (V1.21).
MTL P-core (redwoodcove) inherits same perf events list from previous generation (Goldencove), but the E-core (Crestmont) brings some difference on the perf event list comparing with Gracemont. So apply the changes for Crestmont core.
MTL perfmon events:
https://github.com/intel/perfmon/blob/main/MTL/events/meteorlake_redwoodcove_core.json
https://github.com/intel/perfmon/blob/main/MTL/events/meteorlake_crestmont_core.json
--- arch/x86/events/intel/core.c | 27 +++++++++++++++++++++++++-- arch/x86/events/intel/ds.c | 7 +++++++ arch/x86/events/perf_event.h | 2 ++ 3 files changed, 34 insertions(+), 2 deletions(-)
arch/x86/events/intel/core.c +25 -2
@@ -2494,6 +2494,21 @@ static __initconst const u64 grt_hw_cache_extra_regs }, }; +static __initconst const u64 cmt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3fbfc00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x3fbfc00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +};static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ]
@@ -7677,6 +7692,15 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu)intel_pmu_ref_cycles_ext (); } +static __always_inline void intel_pmu_init_cmt(struct pmu *pmu) +{ +intel_pmu_init_grt (pmu); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + cmt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +hybrid (pmu, pebs_constraints) = intel_cmt_pebs_event_constraints; +hybrid (pmu, extra_regs) = intel_cmt_extra_regs; +} + static __always_inline void intel_pmu_init_lnc(struct pmu *pmu) {intel_pmu_init_glc (pmu);
@@ -8489,8 +8513,7 @@ __init int intel_pmu_init(void)/* Initialize Atom core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; -intel_pmu_init_grt (&pmu->pmu); - pmu->extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (&pmu->pmu);intel_pmu_pebs_data_source_mtl ();pr_cont ("Meteorlake Hybrid events, " );
arch/x86/events/intel/ds.c +7 -0
@@ -1296,6 +1296,13 @@ struct event_constraint intel_grt_pebs_event_constraints[] = {EVENT_CONSTRAINT_END }; +struct event_constraint intel_cmt_pebs_event_constraints[] = { +/* Allow all events as PEBS with no flags */ +INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0x3 ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xff ), +EVENT_CONSTRAINT_END +}; +struct event_constraint intel_arw_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ),
arch/x86/events/perf_event.h +2 -0
@@ -1710,6 +1710,8 @@ extern struct event_constraint intel_glp_pebs_event_constraints[];extern struct event_constraint intel_grt_pebs_event_constraints[]; +extern struct event_constraint intel_cmt_pebs_event_constraints[]; +extern struct event_constraint intel_arw_pebs_event_constraints[];extern struct event_constraint intel_nehalem_pebs_event_constraints[];
PATCH 6/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for LNL
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Lunarlake according to the latest LNL perfmon events (V1.22).
LNL introduces new extra register values for the OCR L3 cache events, so introduce lnc_hw_cache_extra_regs[] and skt_hw_cache_extra_regs[] to reflect the changes.
LNL perfmon events:
https://github.com/intel/perfmon/blob/main/LNL/events/lunarlake_lioncove_core.json
https://github.com/intel/perfmon/blob/main/LNL/events/lunarlake_skymont_core.json
--- arch/x86/events/intel/core.c | 62 +++++++++++++++++++++++++++++------- arch/x86/events/intel/ds.c | 8 +++++ 2 files changed, 59 insertions(+), 11 deletions(-)
arch/x86/events/intel/core.c +51 -11
@@ -225,12 +225,17 @@ static struct event_constraint intel_grt_event_constraints[] __read_mostly = {static struct event_constraint intel_skt_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ FIXED_EVENT_CONSTRAINT (0x0073 ,4 ),/* TOPDOWN_BAD_SPECULATION.ALL */ +FIXED_EVENT_CONSTRAINT (0x0500 ,4 ),/* pseudo TOPDOWN_BAD_SPECULATION.ALL */ FIXED_EVENT_CONSTRAINT (0x019c ,5 ),/* TOPDOWN_FE_BOUND.ALL */ +FIXED_EVENT_CONSTRAINT (0x0600 ,5 ),/* pseudo TOPDOWN_FE_BOUND.ALL */ FIXED_EVENT_CONSTRAINT (0x02c2 ,6 ),/* TOPDOWN_RETIRING.ALL */ +FIXED_EVENT_CONSTRAINT (0x0700 ,6 ),/* pseudo TOPDOWN_RETIRING.ALL */ EVENT_CONSTRAINT_END };
@@ -415,11 +420,12 @@ static struct extra_reg intel_rwc_extra_regs[] __read_mostly = {static struct event_constraint intel_lnc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -431,8 +437,6 @@ static struct event_constraint intel_lnc_event_constraints[] = {INTEL_EVENT_CONSTRAINT (0x20 ,0xf ), -INTEL_UEVENT_CONSTRAINT (0x012a ,0xf ), -INTEL_UEVENT_CONSTRAINT (0x012b ,0xf ),INTEL_UEVENT_CONSTRAINT (0x0148 ,0x4 ), INTEL_UEVENT_CONSTRAINT(0x0175, 0x4),
@@ -443,15 +447,14 @@ static struct event_constraint intel_lnc_event_constraints[] = {INTEL_UEVENT_CONSTRAINT (0x0ca3 ,0x4 ),INTEL_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x08a4 ,0x1 ), -INTEL_UEVENT_CONSTRAINT (0x10a4 ,0x1 ), +INTEL_UEVENT_CONSTRAINT (0x10a4 ,0x8 ),INTEL_UEVENT_CONSTRAINT (0x01b1 ,0x8 ),INTEL_UEVENT_CONSTRAINT (0x01cd ,0x3fc ),INTEL_UEVENT_CONSTRAINT (0x02cd ,0x3 ), +INTEL_UEVENT_CONSTRAINT (0x87d0 ,0x3ff ),INTEL_EVENT_CONSTRAINT_RANGE (0xd0 ,0xdf ,0xf ), -INTEL_UEVENT_CONSTRAINT (0x00e0 ,0xf ), -EVENT_CONSTRAINT_END };
@@ -830,6 +833,23 @@ static __initconst const u64 adl_glc_hw_cache_extra_regs }, }; +static __initconst const u64 lnc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x9E7FA000001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x9E7FA000002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2510,6 +2530,22 @@ static __initconst const u64 cmt_hw_cache_extra_regs }, }; +static __initconst const u64 skt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x13FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x13FBFC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -7673,6 +7709,9 @@ static __always_inline void intel_pmu_init_lnc(struct pmu *pmu)hybrid (pmu, event_constraints) = intel_lnc_event_constraints;hybrid (pmu, pebs_constraints) = intel_lnc_pebs_event_constraints;hybrid (pmu, extra_regs) = intel_lnc_extra_regs; + +memcpy (hybrid_var (pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids,sizeof (hw_cache_event_ids)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); } static __always_inline void intel_pmu_init_pnc(struct pmu *pmu)
@@ -7691,9 +7730,10 @@ static __always_inline void intel_pmu_init_pnc(struct pmu *pmu) static __always_inline void intel_pmu_init_skt(struct pmu *pmu) { -intel_pmu_init_grt (pmu); +intel_pmu_init_cmt (pmu);hybrid (pmu, event_constraints) = intel_skt_event_constraints; -hybrid (pmu, extra_regs) = intel_cmt_extra_regs; +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + skt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); }
arch/x86/events/intel/ds.c +8 -0
@@ -1507,6 +1507,13 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = {INTEL_FLAGS_UEVENT_CONSTRAINT (0x100 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ INTEL_FLAGS_UEVENT_CONSTRAINT (0x0400 ,0x800000000ULL ), +INTEL_FLAGS_UEVENT_CONSTRAINT (0x012a ,0x1 ),/* OCR.* events */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x012b ,0x1 ),/* OCR.* events */ + +INTEL_FLAGS_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),/* TOPDOWN.BAD_SPEC_SLOTS */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x08a4 ,0x1 ),/* TOPDOWN.BR_MISPREDICT_SLOTS */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x10a4 ,0x8 ),/* TOPDOWN.MEMORY_BOUND_SLOTS */ +INTEL_HYBRID_LDLAT_CONSTRAINT (0x1cd ,0x3fc ),INTEL_HYBRID_STLAT_CONSTRAINT (0x2cd ,0x3 ), INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */
@@ -1516,6 +1523,7 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = {INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST (0x42d0 ,0xf ),/* MEM_INST_RETIRED.SPLIT_STORES */ INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD (0x81d0 ,0xf ),/* MEM_INST_RETIRED.ALL_LOADS */ INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST (0x82d0 ,0xf ),/* MEM_INST_RETIRED.ALL_STORES */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x87d0 ,0x3ff ),/* MEM_INST_RETIRED.ANY */ INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf),
Signature · 1 line
2.34.1
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor LNL
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 331c3e4fa39a87560c09bdd878652090ae040b69 Gitweb: https://git.kernel.org/tip/331c3e4fa39a87560c09bdd878652090ae040b69 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:38 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:04 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor LNL
Update perf hard-coded event constraints and cache_extra_regs[] for Lunarlake according to the latest LNL perfmon events (V1.22).
LNL introduces new extra register values for the OCR L3 cache events, so introduce lnc_hw_cache_extra_regs[] and skt_hw_cache_extra_regs[] to reflect the changes.
LNL perfmon events:
https://github.com/intel/perfmon/blob/main/LNL/events/lunarlake_lioncove_core.json
https://github.com/intel/perfmon/blob/main/LNL/events/lunarlake_skymont_core.json
--- arch/x86/events/intel/core.c | 62 ++++++++++++++++++++++++++++------- arch/x86/events/intel/ds.c | 8 +++++- 2 files changed, 59 insertions(+), 11 deletions(-)
arch/x86/events/intel/core.c +51 -11
@@ -225,12 +225,17 @@ static struct event_constraint intel_grt_event_constraints[] __read_mostly = {static struct event_constraint intel_skt_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ FIXED_EVENT_CONSTRAINT (0x0073 ,4 ),/* TOPDOWN_BAD_SPECULATION.ALL */ +FIXED_EVENT_CONSTRAINT (0x0500 ,4 ),/* pseudo TOPDOWN_BAD_SPECULATION.ALL */ FIXED_EVENT_CONSTRAINT (0x019c ,5 ),/* TOPDOWN_FE_BOUND.ALL */ +FIXED_EVENT_CONSTRAINT (0x0600 ,5 ),/* pseudo TOPDOWN_FE_BOUND.ALL */ FIXED_EVENT_CONSTRAINT (0x02c2 ,6 ),/* TOPDOWN_RETIRING.ALL */ +FIXED_EVENT_CONSTRAINT (0x0700 ,6 ),/* pseudo TOPDOWN_RETIRING.ALL */ EVENT_CONSTRAINT_END };
@@ -415,11 +420,12 @@ static struct extra_reg intel_rwc_extra_regs[] __read_mostly = {static struct event_constraint intel_lnc_event_constraints[] = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ -FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* INST_RETIRED.PREC_DIST */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ -FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* SLOTS */ +FIXED_EVENT_CONSTRAINT (0x0400 ,3 ),/* pseudo TOPDOWN.SLOTS */ METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_RETIRING ,0 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_BAD_SPEC ,1 ),METRIC_EVENT_CONSTRAINT (INTEL_TD_METRIC_FE_BOUND ,2 ),
@@ -431,8 +437,6 @@ static struct event_constraint intel_lnc_event_constraints[] = {INTEL_EVENT_CONSTRAINT (0x20 ,0xf ), -INTEL_UEVENT_CONSTRAINT (0x012a ,0xf ), -INTEL_UEVENT_CONSTRAINT (0x012b ,0xf ),INTEL_UEVENT_CONSTRAINT (0x0148 ,0x4 ), INTEL_UEVENT_CONSTRAINT(0x0175, 0x4),
@@ -443,15 +447,14 @@ static struct event_constraint intel_lnc_event_constraints[] = {INTEL_UEVENT_CONSTRAINT (0x0ca3 ,0x4 ),INTEL_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x08a4 ,0x1 ), -INTEL_UEVENT_CONSTRAINT (0x10a4 ,0x1 ), +INTEL_UEVENT_CONSTRAINT (0x10a4 ,0x8 ),INTEL_UEVENT_CONSTRAINT (0x01b1 ,0x8 ),INTEL_UEVENT_CONSTRAINT (0x01cd ,0x3fc ),INTEL_UEVENT_CONSTRAINT (0x02cd ,0x3 ), +INTEL_UEVENT_CONSTRAINT (0x87d0 ,0x3ff ),INTEL_EVENT_CONSTRAINT_RANGE (0xd0 ,0xdf ,0xf ), -INTEL_UEVENT_CONSTRAINT (0x00e0 ,0xf ), -EVENT_CONSTRAINT_END };
@@ -830,6 +833,23 @@ static __initconst const u64 adl_glc_hw_cache_extra_regs }, }; +static __initconst const u64 lnc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x9E7FA000001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0x9E7FA000002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -2510,6 +2530,22 @@ static __initconst const u64 cmt_hw_cache_extra_regs }, }; +static __initconst const u64 skt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x13FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x13FBFC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -7707,6 +7743,9 @@ static __always_inline void intel_pmu_init_lnc(struct pmu *pmu)hybrid (pmu, event_constraints) = intel_lnc_event_constraints;hybrid (pmu, pebs_constraints) = intel_lnc_pebs_event_constraints;hybrid (pmu, extra_regs) = intel_lnc_extra_regs; + +memcpy (hybrid_var (pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids,sizeof (hw_cache_event_ids)); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); } static __always_inline void intel_pmu_init_pnc(struct pmu *pmu)
@@ -7726,9 +7765,10 @@ static __always_inline void intel_pmu_init_pnc(struct pmu *pmu) static __always_inline void intel_pmu_init_skt(struct pmu *pmu) { -intel_pmu_init_grt (pmu); +intel_pmu_init_cmt (pmu);hybrid (pmu, event_constraints) = intel_skt_event_constraints; -hybrid (pmu, extra_regs) = intel_cmt_extra_regs; +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + skt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); }
arch/x86/events/intel/ds.c +8 -0
@@ -1507,6 +1507,13 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = {INTEL_FLAGS_UEVENT_CONSTRAINT (0x100 ,0x100000000ULL ),/* INST_RETIRED.PREC_DIST */ INTEL_FLAGS_UEVENT_CONSTRAINT (0x0400 ,0x800000000ULL ), +INTEL_FLAGS_UEVENT_CONSTRAINT (0x012a ,0x1 ),/* OCR.* events */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x012b ,0x1 ),/* OCR.* events */ + +INTEL_FLAGS_UEVENT_CONSTRAINT (0x04a4 ,0x1 ),/* TOPDOWN.BAD_SPEC_SLOTS */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x08a4 ,0x1 ),/* TOPDOWN.BR_MISPREDICT_SLOTS */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x10a4 ,0x8 ),/* TOPDOWN.MEMORY_BOUND_SLOTS */ +INTEL_HYBRID_LDLAT_CONSTRAINT (0x1cd ,0x3fc ),INTEL_HYBRID_STLAT_CONSTRAINT (0x2cd ,0x3 ), INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */
@@ -1516,6 +1523,7 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = {INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST (0x42d0 ,0xf ),/* MEM_INST_RETIRED.SPLIT_STORES */ INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD (0x81d0 ,0xf ),/* MEM_INST_RETIRED.ALL_LOADS */ INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST (0x82d0 ,0xf ),/* MEM_INST_RETIRED.ALL_STORES */ +INTEL_FLAGS_UEVENT_CONSTRAINT (0x87d0 ,0x3ff ),/* MEM_INST_RETIRED.ANY */ INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf),
PATCH 7/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for ARL
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Arrowlake according to the latest ARL perfmon events (V1.17).
ARL shares almost same event constraints and extra MSR configuration with LNL except 2 differences.
- ARL P-core has different extra MSR value for OCR.DEMAND_DATA_RD.L3_MISS and OCR.DEMAND_RFO.L3_MISS. So introduce arl_lnc_hw_cache_extra_regs[] to reflect the difference.
- ARL-H has extra LPE cores which use crestmont architectures. Add crestmont specific event constraints and hw_cache_extra_regs[] for LPE cores.
ARL perfmon events:
https://github.com/intel/perfmon/blob/main/ARL/events/arrowlake_lioncove_core.json
https://github.com/intel/perfmon/blob/main/ARL/events/arrowlake_skymont_core.json
https://github.com/intel/perfmon/blob/main/ARL/events/arrowlake_crestmont_core.json
--- arch/x86/events/intel/core.c | 56 ++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 8 deletions(-)
arch/x86/events/intel/core.c +48 -8
@@ -850,6 +850,24 @@ static __initconst const u64 lnc_hw_cache_extra_regs }, }; +/* ARL specific lioncove hw_cache_extra_regs[] variant. */ +static __initconst const u64 arl_lnc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFE7F8000001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFE7F8000002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -8529,16 +8547,41 @@ __init int intel_pmu_init(void)case INTEL_WILDCATLAKE_L :pr_cont ("Pantherlake Hybrid events, " ); name ="pantherlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); + goto lnl_common; -case INTEL_LUNARLAKE_M :case INTEL_ARROWLAKE : +pr_cont ("Arrowlake Hybrid events, " ); + name ="arrowlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); +memcpy (hybrid_var (&pmu->pmu, hw_cache_extra_regs), + arl_lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); + + goto lnl_common; + +case INTEL_LUNARLAKE_M :pr_cont ("Lunarlake Hybrid events, " ); name ="lunarlake_hybrid" ; - lnl_common:intel_pmu_init_hybrid (hybrid_big_small); +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); + + lnl_common: + x86_pmu.pebs_latency_data = lnl_latency_data; x86_pmu.get_event_constraints = mtl_get_event_constraints; x86_pmu.hw_config = adl_hw_config;
@@ -8549,10 +8592,6 @@ __init int intel_pmu_init(void) extra_attr =boot_cpu_has (X86_FEATURE_RTM ) ? mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr; -/* Initialize big core specific PerfMon capabilities.*/ - pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_lnc (&pmu->pmu); -/* Initialize Atom core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ];intel_pmu_init_skt (&pmu->pmu);
@@ -8576,6 +8615,8 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities. */ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ];intel_pmu_init_lnc (&pmu->pmu); +memcpy (hybrid_var (&pmu->pmu, hw_cache_extra_regs), + arl_lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));/* Initialize Atom core specific PerfMon capabilities. */ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ];
@@ -8583,8 +8624,7 @@ __init int intel_pmu_init(void)/* Initialize Lower Power Atom specific PerfMon capabilities. */ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_TINY_IDX ]; -intel_pmu_init_grt (&pmu->pmu); - pmu->extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (&pmu->pmu);intel_pmu_pebs_data_source_arl_h ();pr_cont ("ArrowLake-H Hybrid events, " );
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH 07/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ARL
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Unhandled memory allocation failure in intel_pmu_init_hybrid() leads to a NULL pointer…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unhandled memory allocation failure in intel_pmu_init_hybrid() leads to a NULL pointer dereference. --
commit e86d9a7a48c7a21c02757243f3a40ac6b6e47297
Author: Dapeng Mi <[email protected]>
perf/x86/intel: Update event constraints and cache_extra_regs[] for ARL
Updates perf hard-coded event constraints and cache_extra_regs[] for Arrowlake. Introduces ARL-specific arl_lnc_hw_cache_extra_regs and adds crestmont specific constraints for LPE cores.
Quoted 3 lines
arch/x86/events/intel/core.c +0
-0
[ ... ]
Quoted 13 lines
arch/x86/events/intel/core.c +7
-0@@ -8529,16 +8547,41 @@ __init int intel_pmu_init(void)case INTEL_WILDCATLAKE_L :pr_cont ("Pantherlake Hybrid events, " ); name ="pantherlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); + goto lnl_common;
arch/x86/events/intel/core.c __init int intel_pmu_init(void) · line 8567
Quoted 10 lines
arch/x86/events/intel/core.c +8
-1-case INTEL_LUNARLAKE_M :case INTEL_ARROWLAKE : +pr_cont ("Arrowlake Hybrid events, " ); + name ="arrowlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu);
Does this code risk a NULL pointer dereference if the memory allocation in intel_pmu_init_hybrid() fails?
Looking at intel_pmu_init_hybrid(), it allocates x86_pmu.hybrid_pmu and returns -ENOMEM if kzalloc_objs() fails.
If that allocation fails here, the return value is ignored. The code immediately proceeds to calculate the pmu pointer using x86_pmu.hybrid_pmu and passes it to intel_pmu_init_lnc(), which would dereference it.
While this pattern existed before this patch, it is being propagated into the new Pantherlake and Arrowlake initialization blocks. Could we add error handling here to catch the allocation failure before accessing the array?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
Re: [PATCH 07/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for ARL
Quoted 47 lines · On 5/15/2026 2:40 PM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unhandled memory allocation failure inintel_pmu_init_hybrid()leads to a NULL pointer dereference. --commit
e86d9a7a48c7a21c02757243f3a40ac6b6e47297
Author: Dapeng Mi <[email protected]>perf/x86/intel: Update event constraints and cache_extra_regs[] for ARL
Updates perf hard-coded event constraints and cache_extra_regs[] for Arrowlake. Introduces ARL-specific
arl_lnc_hw_cache_extra_regsand adds crestmont specific constraints for LPE cores.Quoted 3 lines
arch/x86/events/intel/core.c +0
-0[ ... ]
Quoted 13 lines
arch/x86/events/intel/core.c +7
-0@@ -8529,16 +8547,41 @@ __init int intel_pmu_init(void)case INTEL_WILDCATLAKE_L :pr_cont ("Pantherlake Hybrid events, " ); name ="pantherlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); + goto lnl_common;arch/x86/events/intel/core.c __init int intel_pmu_init(void) · line 8567
Quoted 10 lines
arch/x86/events/intel/core.c +8
-1-case INTEL_LUNARLAKE_M :case INTEL_ARROWLAKE : +pr_cont ("Arrowlake Hybrid events, " ); + name ="arrowlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu);Does this code risk a NULL pointer dereference if the memory allocation in
intel_pmu_init_hybrid()fails?Looking at
intel_pmu_init_hybrid(), it allocates x86_pmu.hybrid_pmu and returns-ENOMEMifkzalloc_objs()fails.
Quoted 7 lines
If that allocation fails here, the return value is ignored. The code immediately proceeds to calculate the pmu pointer using x86_pmu.hybrid_pmu and passes it to
intel_pmu_init_lnc(), which would dereference it.While this pattern existed before this patch, it is being propagated into the new Pantherlake and Arrowlake initialization blocks. Could we add error handling here to catch the allocation failure before accessing the array?
Yes, it's a known issue and it would be fixed in separate patch later. Thanks.
Quoted 1 line
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor ARL
In reply to Dapeng MiThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 0073ed169226f4ed65e339f770118f54ce4e1370 Gitweb: https://git.kernel.org/tip/0073ed169226f4ed65e339f770118f54ce4e1370 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:39 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:04 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor ARL
Update perf hard-coded event constraints and cache_extra_regs[] for Arrowlake according to the latest ARL perfmon events (V1.17).
ARL shares almost same event constraints and extra MSR configuration with LNL except 2 differences.
- ARL P-core has different extra MSR value for OCR.DEMAND_DATA_RD.L3_MISS and OCR.DEMAND_RFO.L3_MISS. So introduce arl_lnc_hw_cache_extra_regs[] to reflect the difference.
- ARL-H has extra LPE cores which use crestmont architectures. Add crestmont specific event constraints and hw_cache_extra_regs[] for LPE cores.
ARL perfmon events:
https://github.com/intel/perfmon/blob/main/ARL/events/arrowlake_lioncove_core.json
https://github.com/intel/perfmon/blob/main/ARL/events/arrowlake_skymont_core.json
https://github.com/intel/perfmon/blob/main/ARL/events/arrowlake_crestmont_core.json
--- arch/x86/events/intel/core.c | 56 ++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 8 deletions(-)
arch/x86/events/intel/core.c +48 -8
@@ -850,6 +850,24 @@ static __initconst const u64 lnc_hw_cache_extra_regs }, }; +/* ARL specific lioncove hw_cache_extra_regs[] variant. */ +static __initconst const u64 arl_lnc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFE7F8000001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFE7F8000002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 pnc_hw_cache_event_ids [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -8564,16 +8582,41 @@ __init int intel_pmu_init(void)case INTEL_WILDCATLAKE_L :pr_cont ("Pantherlake Hybrid events, " ); name ="pantherlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); + goto lnl_common; -case INTEL_LUNARLAKE_M :case INTEL_ARROWLAKE : +pr_cont ("Arrowlake Hybrid events, " ); + name ="arrowlake_hybrid" ; + +intel_pmu_init_hybrid (hybrid_big_small); + +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); +memcpy (hybrid_var (&pmu->pmu, hw_cache_extra_regs), + arl_lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); + + goto lnl_common; + +case INTEL_LUNARLAKE_M :pr_cont ("Lunarlake Hybrid events, " ); name ="lunarlake_hybrid" ; - lnl_common:intel_pmu_init_hybrid (hybrid_big_small); +/* Initialize big core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; +intel_pmu_init_lnc (&pmu->pmu); + + lnl_common: + x86_pmu.pebs_latency_data = lnl_latency_data; x86_pmu.get_event_constraints = mtl_get_event_constraints; x86_pmu.hw_config = adl_hw_config;
@@ -8584,10 +8627,6 @@ __init int intel_pmu_init(void) extra_attr =boot_cpu_has (X86_FEATURE_RTM ) ? mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr; -/* Initialize big core specific PerfMon capabilities.*/ - pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_lnc (&pmu->pmu); -/* Initialize Atom core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ];intel_pmu_init_skt (&pmu->pmu);
@@ -8611,6 +8650,8 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities. */ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ];intel_pmu_init_lnc (&pmu->pmu); +memcpy (hybrid_var (&pmu->pmu, hw_cache_extra_regs), + arl_lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));/* Initialize Atom core specific PerfMon capabilities. */ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ];
@@ -8618,8 +8659,7 @@ __init int intel_pmu_init(void)/* Initialize Lower Power Atom specific PerfMon capabilities. */ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_TINY_IDX ]; -intel_pmu_init_grt (&pmu->pmu); - pmu->extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (&pmu->pmu);intel_pmu_pebs_data_source_arl_h ();pr_cont ("ArrowLake-H Hybrid events, " );
PATCH 8/11 perf/x86/intel: Update event constraints for PTL
In reply to Dapeng MiUpdate perf hard-coded event constraints for Pantherlake according to the latest PTL perfmon events (V1.05).
PTL has almost same perf event list as LNL except some PEBS event constraints of E-core (exactly same on P-core). Define intel_dkt_pebs_event_constraints[] to reflect the PTL E-core specific PEBS event constraints.
PTL perfmon events:
https://github.com/intel/perfmon/blob/main/PTL/events/pantherlake_cougarcove_core.json
https://github.com/intel/perfmon/blob/main/PTL/events/pantherlake_darkmont_core.json
--- arch/x86/events/intel/core.c | 20 ++++++++++++++++---- arch/x86/events/intel/ds.c | 7 +++++++ arch/x86/events/perf_event.h | 2 ++ 3 files changed, 25 insertions(+), 4 deletions(-)
arch/x86/events/intel/core.c +16 -4
@@ -7755,6 +7755,13 @@ static __always_inline void intel_pmu_init_skt(struct pmu *pmu)static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); } +/* Hybrid client variant. */ +static __always_inline void intel_pmu_init_dkt_hybrid(struct pmu *pmu) +{ +intel_pmu_init_skt (pmu); +hybrid (pmu, pebs_constraints) = intel_dkt_pebs_event_constraints; +} + static __always_inline void intel_pmu_init_arw(struct pmu *pmu) {intel_pmu_init_grt (pmu);
@@ -8553,6 +8560,9 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ];intel_pmu_init_lnc (&pmu->pmu); +/* Initialize Atom core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; +intel_pmu_init_dkt_hybrid (&pmu->pmu); goto lnl_common;
@@ -8567,6 +8577,9 @@ __init int intel_pmu_init(void)intel_pmu_init_lnc (&pmu->pmu);memcpy (hybrid_var (&pmu->pmu, hw_cache_extra_regs), arl_lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +/* Initialize Atom core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; +intel_pmu_init_skt (&pmu->pmu); goto lnl_common;
@@ -8579,6 +8592,9 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ];intel_pmu_init_lnc (&pmu->pmu); +/* Initialize Atom core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; +intel_pmu_init_skt (&pmu->pmu); lnl_common:
@@ -8592,10 +8608,6 @@ __init int intel_pmu_init(void) extra_attr =boot_cpu_has (X86_FEATURE_RTM ) ? mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr; -/* Initialize Atom core specific PerfMon capabilities.*/ - pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; -intel_pmu_init_skt (&pmu->pmu); -intel_pmu_pebs_data_source_lnl ();break ;
arch/x86/events/intel/ds.c +7 -0
@@ -1303,6 +1303,13 @@ struct event_constraint intel_cmt_pebs_event_constraints[] = {EVENT_CONSTRAINT_END }; +struct event_constraint intel_dkt_pebs_event_constraints[] = { +/* Allow all events as PEBS with no flags */ +INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xff ), +EVENT_CONSTRAINT_END +}; +struct event_constraint intel_arw_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ),
arch/x86/events/perf_event.h +2 -0
@@ -1704,6 +1704,8 @@ extern struct event_constraint intel_grt_pebs_event_constraints[];extern struct event_constraint intel_cmt_pebs_event_constraints[]; +extern struct event_constraint intel_dkt_pebs_event_constraints[]; +extern struct event_constraint intel_arw_pebs_event_constraints[];extern struct event_constraint intel_nehalem_pebs_event_constraints[];
Signature · 1 line
2.34.1
[tip: perf/core] perf/x86/intel: Update event constraints for PTL
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 65fd435095bb299b9c50d3285d4e6569b79b86e2 Gitweb: https://git.kernel.org/tip/65fd435095bb299b9c50d3285d4e6569b79b86e2 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:40 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:04 +02:00
perf/x86/intel: Update event constraints for PTL
Update perf hard-coded event constraints for Pantherlake according to the latest PTL perfmon events (V1.05).
PTL has almost same perf event list as LNL except some PEBS event constraints of E-core (exactly same on P-core). Define intel_dkt_pebs_event_constraints[] to reflect the PTL E-core specific PEBS event constraints.
PTL perfmon events:
https://github.com/intel/perfmon/blob/main/PTL/events/pantherlake_cougarcove_core.json
https://github.com/intel/perfmon/blob/main/PTL/events/pantherlake_darkmont_core.json
--- arch/x86/events/intel/core.c | 20 ++++++++++++++++---- arch/x86/events/intel/ds.c | 7 +++++++ arch/x86/events/perf_event.h | 2 ++ 3 files changed, 25 insertions(+), 4 deletions(-)
arch/x86/events/intel/core.c +16 -4
@@ -7790,6 +7790,13 @@ static __always_inline void intel_pmu_init_skt(struct pmu *pmu)static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); } +/* Hybrid client variant. */ +static __always_inline void intel_pmu_init_dkt_hybrid(struct pmu *pmu) +{ +intel_pmu_init_skt (pmu); +hybrid (pmu, pebs_constraints) = intel_dkt_pebs_event_constraints; +} + static __always_inline void intel_pmu_init_arw(struct pmu *pmu) {intel_pmu_init_grt (pmu);
@@ -8588,6 +8595,9 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ];intel_pmu_init_lnc (&pmu->pmu); +/* Initialize Atom core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; +intel_pmu_init_dkt_hybrid (&pmu->pmu); goto lnl_common;
@@ -8602,6 +8612,9 @@ __init int intel_pmu_init(void)intel_pmu_init_lnc (&pmu->pmu);memcpy (hybrid_var (&pmu->pmu, hw_cache_extra_regs), arl_lnc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +/* Initialize Atom core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; +intel_pmu_init_skt (&pmu->pmu); goto lnl_common;
@@ -8614,6 +8627,9 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ];intel_pmu_init_lnc (&pmu->pmu); +/* Initialize Atom core specific PerfMon capabilities.*/ + pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; +intel_pmu_init_skt (&pmu->pmu); lnl_common:
@@ -8627,10 +8643,6 @@ __init int intel_pmu_init(void) extra_attr =boot_cpu_has (X86_FEATURE_RTM ) ? mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr; -/* Initialize Atom core specific PerfMon capabilities.*/ - pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ]; -intel_pmu_init_skt (&pmu->pmu); -intel_pmu_pebs_data_source_lnl ();break ;
arch/x86/events/intel/ds.c +7 -0
@@ -1303,6 +1303,13 @@ struct event_constraint intel_cmt_pebs_event_constraints[] = {EVENT_CONSTRAINT_END }; +struct event_constraint intel_dkt_pebs_event_constraints[] = { +/* Allow all events as PEBS with no flags */ +INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ), +INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xff ), +EVENT_CONSTRAINT_END +}; +struct event_constraint intel_arw_pebs_event_constraints[] = {/* Allow all events as PEBS with no flags */ INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ),
arch/x86/events/perf_event.h +2 -0
@@ -1712,6 +1712,8 @@ extern struct event_constraint intel_grt_pebs_event_constraints[];extern struct event_constraint intel_cmt_pebs_event_constraints[]; +extern struct event_constraint intel_dkt_pebs_event_constraints[]; +extern struct event_constraint intel_arw_pebs_event_constraints[];extern struct event_constraint intel_nehalem_pebs_event_constraints[];
PATCH 9/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for NVL
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Novalake according to the latest NVL perfmon events.
The 4 PRECISE_OMR events (0xd4) are broken on Arcticwolf and would be removed from upcoming released event list, so delete them from event constraints and extra_regs array accordingly.
--- arch/x86/events/intel/core.c | 55 +++++++++++++++++++++++------------- arch/x86/events/intel/ds.c | 11 -------- arch/x86/events/perf_event.h | 2 -- 3 files changed, 36 insertions(+), 32 deletions(-)
arch/x86/events/intel/core.c +36 -19
@@ -241,20 +241,21 @@ static struct event_constraint intel_skt_event_constraints[] __read_mostly = {static struct event_constraint intel_arw_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ FIXED_EVENT_CONSTRAINT (0x0073 ,4 ),/* TOPDOWN_BAD_SPECULATION.ALL */ +FIXED_EVENT_CONSTRAINT (0x0500 ,4 ),/* pseudo TOPDOWN_BAD_SPECULATION.ALL */ FIXED_EVENT_CONSTRAINT (0x019c ,5 ),/* TOPDOWN_FE_BOUND.ALL */ +FIXED_EVENT_CONSTRAINT (0x0600 ,5 ),/* pseudo TOPDOWN_FE_BOUND.ALL */ FIXED_EVENT_CONSTRAINT (0x02c2 ,6 ),/* TOPDOWN_RETIRING.ALL */ +FIXED_EVENT_CONSTRAINT (0x0700 ,6 ),/* pseudo TOPDOWN_RETIRING.ALL */ INTEL_UEVENT_CONSTRAINT (0x01b7 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x02b7 ,0x2 ),INTEL_UEVENT_CONSTRAINT (0x04b7 ,0x4 ),INTEL_UEVENT_CONSTRAINT (0x08b7 ,0x8 ), -INTEL_UEVENT_CONSTRAINT (0x01d4 ,0x1 ), -INTEL_UEVENT_CONSTRAINT (0x02d4 ,0x2 ), -INTEL_UEVENT_CONSTRAINT (0x04d4 ,0x4 ), -INTEL_UEVENT_CONSTRAINT (0x08d4 ,0x8 ),INTEL_UEVENT_CONSTRAINT (0x0175 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x0275 ,0x2 ),INTEL_UEVENT_CONSTRAINT (0x21d3 ,0x1 ),
@@ -964,6 +965,23 @@ static __initconst const u64 pnc_hw_cache_extra_regs }, }; +static __initconst const u64 cyc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x4000000000000001 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFF03F000000001 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x4000000000000002 ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFF03F000000002 ,/* OMR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +/* * Notes on the events: * - data reads do not include code reads (comparable to earlier tables)
@@ -2570,16 +2588,12 @@ static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { [C (LL )] = { [C (OP_READ )] = { - [C (RESULT_ACCESS )] =0x4000000000000001 , - [C (RESULT_MISS )] =0xFFFFF000000001 , + [C (RESULT_ACCESS )] =0x4000000000000009 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0xFF03F000000009 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE )] = { - [C (RESULT_ACCESS )] =0x4000000000000002 , - [C (RESULT_MISS )] =0xFFFFF000000002 , - }, - [C (OP_PREFETCH )] = { - [C (RESULT_ACCESS )] =0x0 , - [C (RESULT_MISS )] =0x0 , + [C (RESULT_ACCESS )] =0x400000000000000A ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0xFF03F00000000A ,/* OMR.DEMAND_RFO.L3_MISS */ }, }, };
@@ -2651,10 +2665,6 @@ static struct extra_reg intel_arw_extra_regs[] __read_mostly = {INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OMR_1 ,0xc0ffffffffffffffull ,OMR_1 ),INTEL_UEVENT_EXTRA_REG (0x04b7 ,MSR_OMR_2 ,0xc0ffffffffffffffull ,OMR_2 ),INTEL_UEVENT_EXTRA_REG (0x08b7 ,MSR_OMR_3 ,0xc0ffffffffffffffull ,OMR_3 ), -INTEL_UEVENT_EXTRA_REG (0x01d4 ,MSR_OMR_0 ,0xc0ffffffffffffffull ,OMR_0 ), -INTEL_UEVENT_EXTRA_REG (0x02d4 ,MSR_OMR_1 ,0xc0ffffffffffffffull ,OMR_1 ), -INTEL_UEVENT_EXTRA_REG (0x04d4 ,MSR_OMR_2 ,0xc0ffffffffffffffull ,OMR_2 ), -INTEL_UEVENT_EXTRA_REG (0x08d4 ,MSR_OMR_3 ,0xc0ffffffffffffffull ,OMR_3 ),INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x5d0 ),INTEL_UEVENT_EXTRA_REG (0x0127 ,MSR_SNOOP_RSP_0 ,0xffffffffffffffffull ,SNOOP_0 ), INTEL_UEVENT_EXTRA_REG(0x0227, MSR_SNOOP_RSP_1, 0xffffffffffffffffull, SNOOP_1),
@@ -7746,6 +7756,13 @@ static __always_inline void intel_pmu_init_pnc(struct pmu *pmu)hybrid (pmu, extra_regs) = intel_pnc_extra_regs; } +static __always_inline void intel_pmu_init_cyc(struct pmu *pmu) +{ +intel_pmu_init_pnc (pmu); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + cyc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_skt(struct pmu *pmu) {intel_pmu_init_cmt (pmu);
@@ -7770,7 +7787,7 @@ static __always_inline void intel_pmu_init_arw(struct pmu *pmu)memcpy (hybrid_var (pmu, hw_cache_extra_regs), arw_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));hybrid (pmu, event_constraints) = intel_arw_event_constraints; -hybrid (pmu, pebs_constraints) = intel_arw_pebs_event_constraints; +hybrid (pmu, pebs_constraints) = intel_dkt_pebs_event_constraints;hybrid (pmu, extra_regs) = intel_arw_extra_regs;static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); }
@@ -8661,7 +8678,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_pnc (&pmu->pmu); +intel_pmu_init_cyc (&pmu->pmu);/* Initialize Atom core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ];
arch/x86/events/intel/ds.c +0 -11
@@ -1310,17 +1310,6 @@ struct event_constraint intel_dkt_pebs_event_constraints[] = {EVENT_CONSTRAINT_END }; -struct event_constraint intel_arw_pebs_event_constraints[] = { -/* Allow all events as PEBS with no flags */ -INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ), -INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xff ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x01d4 ,0x1 ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x02d4 ,0x2 ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x04d4 ,0x4 ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x08d4 ,0x8 ), -EVENT_CONSTRAINT_END -}; -struct event_constraint intel_nehalem_pebs_event_constraints[] = {INTEL_PLD_CONSTRAINT (0x100b ,0xf ),/* MEM_INST_RETIRED.* */ INTEL_FLAGS_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */
arch/x86/events/perf_event.h +0 -2
@@ -1706,8 +1706,6 @@ extern struct event_constraint intel_cmt_pebs_event_constraints[];extern struct event_constraint intel_dkt_pebs_event_constraints[]; -extern struct event_constraint intel_arw_pebs_event_constraints[]; -extern struct event_constraint intel_nehalem_pebs_event_constraints[];extern struct event_constraint intel_westmere_pebs_event_constraints[];
Signature · 1 line
2.34.1
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor NVL
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 42f47511d9795dd4ddeca7145e171f75a1a7b8eb Gitweb: https://git.kernel.org/tip/42f47511d9795dd4ddeca7145e171f75a1a7b8eb Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:41 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:04 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor NVL
Update perf hard-coded event constraints and cache_extra_regs[] for Novalake according to the latest NVL perfmon events.
The 4 PRECISE_OMR events (0xd4) are broken on Arcticwolf and would be removed from upcoming released event list, so delete them from event constraints and extra_regs array accordingly.
--- arch/x86/events/intel/core.c | 55 ++++++++++++++++++++++------------- arch/x86/events/intel/ds.c | 11 +------- arch/x86/events/perf_event.h | 2 +- 3 files changed, 36 insertions(+), 32 deletions(-)
arch/x86/events/intel/core.c +36 -19
@@ -241,20 +241,21 @@ static struct event_constraint intel_skt_event_constraints[] __read_mostly = {static struct event_constraint intel_arw_event_constraints[]__read_mostly = {FIXED_EVENT_CONSTRAINT (0x00c0 ,0 ),/* INST_RETIRED.ANY */ +FIXED_EVENT_CONSTRAINT (0x0100 ,0 ),/* pseudo INST_RETIRED.ANY */ FIXED_EVENT_CONSTRAINT (0x003c ,1 ),/* CPU_CLK_UNHALTED.CORE */ -FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF */ +FIXED_EVENT_CONSTRAINT (0x0200 ,1 ),/* pseudo CPU_CLK_UNHALTED.THREAD */ +FIXED_EVENT_CONSTRAINT (0x0300 ,2 ),/* pseudo CPU_CLK_UNHALTED.REF_TSC */ FIXED_EVENT_CONSTRAINT (0x013c ,2 ),/* CPU_CLK_UNHALTED.REF_TSC_P */ FIXED_EVENT_CONSTRAINT (0x0073 ,4 ),/* TOPDOWN_BAD_SPECULATION.ALL */ +FIXED_EVENT_CONSTRAINT (0x0500 ,4 ),/* pseudo TOPDOWN_BAD_SPECULATION.ALL */ FIXED_EVENT_CONSTRAINT (0x019c ,5 ),/* TOPDOWN_FE_BOUND.ALL */ +FIXED_EVENT_CONSTRAINT (0x0600 ,5 ),/* pseudo TOPDOWN_FE_BOUND.ALL */ FIXED_EVENT_CONSTRAINT (0x02c2 ,6 ),/* TOPDOWN_RETIRING.ALL */ +FIXED_EVENT_CONSTRAINT (0x0700 ,6 ),/* pseudo TOPDOWN_RETIRING.ALL */ INTEL_UEVENT_CONSTRAINT (0x01b7 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x02b7 ,0x2 ),INTEL_UEVENT_CONSTRAINT (0x04b7 ,0x4 ),INTEL_UEVENT_CONSTRAINT (0x08b7 ,0x8 ), -INTEL_UEVENT_CONSTRAINT (0x01d4 ,0x1 ), -INTEL_UEVENT_CONSTRAINT (0x02d4 ,0x2 ), -INTEL_UEVENT_CONSTRAINT (0x04d4 ,0x4 ), -INTEL_UEVENT_CONSTRAINT (0x08d4 ,0x8 ),INTEL_UEVENT_CONSTRAINT (0x0175 ,0x1 ),INTEL_UEVENT_CONSTRAINT (0x0275 ,0x2 ),INTEL_UEVENT_CONSTRAINT (0x21d3 ,0x1 ),
@@ -964,6 +965,23 @@ static __initconst const u64 pnc_hw_cache_extra_regs }, }; +static __initconst const u64 cyc_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = +{ + [C (LL ) ] = { + [C (OP_READ ) ] = { + [C (RESULT_ACCESS ) ] =0x4000000000000001 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFF03F000000001 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE ) ] = { + [C (RESULT_ACCESS ) ] =0x4000000000000002 ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS ) ] =0xFF03F000000002 ,/* OMR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +/* * Notes on the events: * - data reads do not include code reads (comparable to earlier tables)
@@ -2570,16 +2588,12 @@ static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { [C (LL )] = { [C (OP_READ )] = { - [C (RESULT_ACCESS )] =0x4000000000000001 , - [C (RESULT_MISS )] =0xFFFFF000000001 , + [C (RESULT_ACCESS )] =0x4000000000000009 ,/* OMR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0xFF03F000000009 ,/* OMR.DEMAND_DATA_RD.L3_MISS */ }, [C (OP_WRITE )] = { - [C (RESULT_ACCESS )] =0x4000000000000002 , - [C (RESULT_MISS )] =0xFFFFF000000002 , - }, - [C (OP_PREFETCH )] = { - [C (RESULT_ACCESS )] =0x0 , - [C (RESULT_MISS )] =0x0 , + [C (RESULT_ACCESS )] =0x400000000000000A ,/* OMR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0xFF03F00000000A ,/* OMR.DEMAND_RFO.L3_MISS */ }, }, };
@@ -2651,10 +2665,6 @@ static struct extra_reg intel_arw_extra_regs[] __read_mostly = {INTEL_UEVENT_EXTRA_REG (0x02b7 ,MSR_OMR_1 ,0xc0ffffffffffffffull ,OMR_1 ),INTEL_UEVENT_EXTRA_REG (0x04b7 ,MSR_OMR_2 ,0xc0ffffffffffffffull ,OMR_2 ),INTEL_UEVENT_EXTRA_REG (0x08b7 ,MSR_OMR_3 ,0xc0ffffffffffffffull ,OMR_3 ), -INTEL_UEVENT_EXTRA_REG (0x01d4 ,MSR_OMR_0 ,0xc0ffffffffffffffull ,OMR_0 ), -INTEL_UEVENT_EXTRA_REG (0x02d4 ,MSR_OMR_1 ,0xc0ffffffffffffffull ,OMR_1 ), -INTEL_UEVENT_EXTRA_REG (0x04d4 ,MSR_OMR_2 ,0xc0ffffffffffffffull ,OMR_2 ), -INTEL_UEVENT_EXTRA_REG (0x08d4 ,MSR_OMR_3 ,0xc0ffffffffffffffull ,OMR_3 ),INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG (0x5d0 ),INTEL_UEVENT_EXTRA_REG (0x0127 ,MSR_SNOOP_RSP_0 ,0xffffffffffffffffull ,SNOOP_0 ), INTEL_UEVENT_EXTRA_REG(0x0227, MSR_SNOOP_RSP_1, 0xffffffffffffffffull, SNOOP_1),
@@ -7781,6 +7791,13 @@ static __always_inline void intel_pmu_init_pnc(struct pmu *pmu)static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); } +static __always_inline void intel_pmu_init_cyc(struct pmu *pmu) +{ +intel_pmu_init_pnc (pmu); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + cyc_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_skt(struct pmu *pmu) {intel_pmu_init_cmt (pmu);
@@ -7805,7 +7822,7 @@ static __always_inline void intel_pmu_init_arw(struct pmu *pmu)memcpy (hybrid_var (pmu, hw_cache_extra_regs), arw_hw_cache_extra_regs,sizeof (hw_cache_extra_regs));hybrid (pmu, event_constraints) = intel_arw_event_constraints; -hybrid (pmu, pebs_constraints) = intel_arw_pebs_event_constraints; +hybrid (pmu, pebs_constraints) = intel_dkt_pebs_event_constraints;hybrid (pmu, extra_regs) = intel_arw_extra_regs;static_call_update (intel_pmu_enable_acr_event, intel_pmu_enable_acr); }
@@ -8696,7 +8713,7 @@ __init int intel_pmu_init(void)/* Initialize big core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX ]; -intel_pmu_init_pnc (&pmu->pmu); +intel_pmu_init_cyc (&pmu->pmu);/* Initialize Atom core specific PerfMon capabilities.*/ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX ];
arch/x86/events/intel/ds.c +0 -11
@@ -1310,17 +1310,6 @@ struct event_constraint intel_dkt_pebs_event_constraints[] = {EVENT_CONSTRAINT_END }; -struct event_constraint intel_arw_pebs_event_constraints[] = { -/* Allow all events as PEBS with no flags */ -INTEL_HYBRID_LAT_CONSTRAINT (0x5d0 ,0xff ), -INTEL_HYBRID_LAT_CONSTRAINT (0x6d0 ,0xff ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x01d4 ,0x1 ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x02d4 ,0x2 ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x04d4 ,0x4 ), -INTEL_FLAGS_UEVENT_CONSTRAINT (0x08d4 ,0x8 ), -EVENT_CONSTRAINT_END -}; -struct event_constraint intel_nehalem_pebs_event_constraints[] = {INTEL_PLD_CONSTRAINT (0x100b ,0xf ),/* MEM_INST_RETIRED.* */ INTEL_FLAGS_EVENT_CONSTRAINT (0x0f ,0xf ),/* MEM_UNCORE_RETIRED.* */
arch/x86/events/perf_event.h +0 -2
@@ -1714,8 +1714,6 @@ extern struct event_constraint intel_cmt_pebs_event_constraints[];extern struct event_constraint intel_dkt_pebs_event_constraints[]; -extern struct event_constraint intel_arw_pebs_event_constraints[]; -extern struct event_constraint intel_nehalem_pebs_event_constraints[];extern struct event_constraint intel_westmere_pebs_event_constraints[];
PATCH 10/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for SRF
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Sierra Forest according to the latest SRF perfmon events (V1.17).
SRF has same uarch (crestmont) as MTL E-core and shares same perf events, so directly apply the crestmont perf events.
SRF perfmon events:
https://github.com/intel/perfmon/blob/main/SRF/events/sierraforest_core.json
--- arch/x86/events/intel/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/events/intel/core.c +1 -2
@@ -8101,8 +8101,7 @@ __init int intel_pmu_init(void)case INTEL_ATOM_CRESTMONT :case INTEL_ATOM_CRESTMONT_X : -intel_pmu_init_grt (NULL ); - x86_pmu.extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (NULL );intel_pmu_pebs_data_source_cmt (); x86_pmu.pebs_latency_data = cmt_latency_data; x86_pmu.get_event_constraints = cmt_get_event_constraints;
Signature · 1 line
2.34.1
Re: [PATCH 10/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for SRF
Quoted 5 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Sierra Forest according to the latest SRF perfmon events (V1.17).
SRF has same uarch (crestmont) as MTL E-core and shares same perf events, so directly apply the crestmont perf events.
Nit: Crestmont.
Quoted 5 lines
SRF perfmon events:
https://github.com/intel/perfmon/blob/main/SRF/events/sierraforest_core.jsonSigned-off-by Dapeng Mi <[email protected]>---
Quoted 17 lines
arch/x86/events/intel/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/x86/events/intel/core.c +1
-2@@ -8101,8 +8101,7 @@ __init int intel_pmu_init(void)case INTEL_ATOM_CRESTMONT :case INTEL_ATOM_CRESTMONT_X : -intel_pmu_init_grt (NULL ); - x86_pmu.extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (NULL );intel_pmu_pebs_data_source_cmt (); x86_pmu.pebs_latency_data = cmt_latency_data; x86_pmu.get_event_constraints = cmt_get_event_constraints;
Re: [PATCH 10/11] perf/x86/intel: Update event constraints and cache_extra_regs[] for SRF
Quoted 8 lines · Zide
Quoted 5 lines · Dapeng Mi
Update perf hard-coded event constraints and cache_extra_regs[] for Sierra Forest according to the latest SRF perfmon events (V1.17).
SRF has same uarch (crestmont) as MTL E-core and shares same perf events, so directly apply the crestmont perf events.
Nit: Crestmont.
Sure. Thanks.
Quoted 24 lines
Quoted 5 lines
SRF perfmon events:
https://github.com/intel/perfmon/blob/main/SRF/events/sierraforest_core.jsonSigned-off-by Dapeng Mi <[email protected]>---
Reviewed-by [email protected]Quoted 17 lines
arch/x86/events/intel/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)arch/x86/events/intel/core.c +1
-2@@ -8101,8 +8101,7 @@ __init int intel_pmu_init(void)case INTEL_ATOM_CRESTMONT :case INTEL_ATOM_CRESTMONT_X : -intel_pmu_init_grt (NULL ); - x86_pmu.extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (NULL );intel_pmu_pebs_data_source_cmt (); x86_pmu.pebs_latency_data = cmt_latency_data; x86_pmu.get_event_constraints = cmt_get_event_constraints;
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor SRF
In reply to Dapeng MiThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 7ae5f58517a6604ea86ae2b34cc7252d13d37180 Gitweb: https://git.kernel.org/tip/7ae5f58517a6604ea86ae2b34cc7252d13d37180 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:42 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:05 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor SRF
Update perf hard-coded event constraints and cache_extra_regs[] for Sierra Forest according to the latest SRF perfmon events (V1.17).
SRF has same uarch (crestmont) as MTL E-core and shares same perf events, so directly apply the crestmont perf events.
SRF perfmon events:
https://github.com/intel/perfmon/blob/main/SRF/events/sierraforest_core.json
--- arch/x86/events/intel/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/events/intel/core.c +1 -2
@@ -8136,8 +8136,7 @@ __init int intel_pmu_init(void)case INTEL_ATOM_CRESTMONT :case INTEL_ATOM_CRESTMONT_X : -intel_pmu_init_grt (NULL ); - x86_pmu.extra_regs = intel_cmt_extra_regs; +intel_pmu_init_cmt (NULL );intel_pmu_pebs_data_source_cmt (); x86_pmu.pebs_latency_data = cmt_latency_data; x86_pmu.get_event_constraints = cmt_get_event_constraints;
PATCH 11/11 perf/x86/intel: Update event constraints and cache_extra_regs[] for CWF
In reply to Dapeng MiUpdate perf hard-coded event constraints and cache_extra_regs[] for Clearwater Forest according to the latest CWF perfmon events (V1.02).
An important difference is that CWF introduce new extra register values for the L3 cache OCR events, so define darkmont specific dkt_hw_cache_extra_regs[] array.
CWF perfmon events:
https://github.com/intel/perfmon/blob/main/CWF/events/clearwaterforest_core.json
--- arch/x86/events/intel/core.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +29 -1
@@ -2582,6 +2582,22 @@ static __initconst const u64 skt_hw_cache_extra_regs }, }; +static __initconst const u64 dkt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x33FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x33FBFC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -7779,6 +7795,18 @@ static __always_inline void intel_pmu_init_dkt_hybrid(struct pmu *pmu)hybrid (pmu, pebs_constraints) = intel_dkt_pebs_event_constraints; } +/* +* Darkmont is used by the CWF and PTL E-cores, but their L3 OCR +* events require different extra MSR values. Keep a separate init +* function for the non-hybrid server variant. +*/ +static __always_inline void intel_pmu_init_dkt(struct pmu *pmu) +{ +intel_pmu_init_dkt_hybrid (pmu); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + dkt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_arw(struct pmu *pmu) {intel_pmu_init_grt (pmu);
@@ -8113,7 +8141,7 @@ __init int intel_pmu_init(void)break ;case INTEL_ATOM_DARKMONT_X : -intel_pmu_init_skt (NULL ); +intel_pmu_init_dkt (NULL );intel_pmu_pebs_data_source_cmt (); x86_pmu.pebs_latency_data = cmt_latency_data; x86_pmu.get_event_constraints = cmt_get_event_constraints;
Signature · 1 line
2.34.1
[tip: perf/core] perf/x86/intel: Update event constraints and cache_extra_regsfor CWF
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 66cc29745f2f5815482587bb9fbc1e8a3e6fcf00 Gitweb: https://git.kernel.org/tip/66cc29745f2f5815482587bb9fbc1e8a3e6fcf00 Author: Dapeng Mi <[email protected]> AuthorDate: Fri, 15 May 2026 14:11:43 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 19 May 2026 13:49:05 +02:00
perf/x86/intel: Update event constraints and cache_extra_regsfor CWF
Update perf hard-coded event constraints and cache_extra_regs[] for Clearwater Forest according to the latest CWF perfmon events (V1.02).
An important difference is that CWF introduce new extra register values for the L3 cache OCR events, so define darkmont specific dkt_hw_cache_extra_regs[] array.
CWF perfmon events:
https://github.com/intel/perfmon/blob/main/CWF/events/clearwaterforest_core.json
--- arch/x86/events/intel/core.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
arch/x86/events/intel/core.c +29 -1
@@ -2582,6 +2582,22 @@ static __initconst const u64 skt_hw_cache_extra_regs }, }; +static __initconst const u64 dkt_hw_cache_extra_regs + [PERF_COUNT_HW_CACHE_MAX ] + [PERF_COUNT_HW_CACHE_OP_MAX ] + [PERF_COUNT_HW_CACHE_RESULT_MAX ] = { + [C (LL )] = { + [C (OP_READ )] = { + [C (RESULT_ACCESS )] =0x10001 ,/* OCR.DEMAND_DATA_RD.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x33FBFC00001 ,/* OCR.DEMAND_DATA_RD.L3_MISS */ + }, + [C (OP_WRITE )] = { + [C (RESULT_ACCESS )] =0x10002 ,/* OCR.DEMAND_RFO.ANY_RESPONSE */ + [C (RESULT_MISS )] =0x33FBFC00002 ,/* OCR.DEMAND_RFO.L3_MISS */ + }, + }, +}; +static __initconst const u64 arw_hw_cache_extra_regs [PERF_COUNT_HW_CACHE_MAX ] [PERF_COUNT_HW_CACHE_OP_MAX ]
@@ -7814,6 +7830,18 @@ static __always_inline void intel_pmu_init_dkt_hybrid(struct pmu *pmu)hybrid (pmu, pebs_constraints) = intel_dkt_pebs_event_constraints; } +/* +* Darkmont is used by the CWF and PTL E-cores, but their L3 OCR +* events require different extra MSR values. Keep a separate init +* function for the non-hybrid server variant. +*/ +static __always_inline void intel_pmu_init_dkt(struct pmu *pmu) +{ +intel_pmu_init_dkt_hybrid (pmu); +memcpy (hybrid_var (pmu, hw_cache_extra_regs), + dkt_hw_cache_extra_regs,sizeof (hw_cache_extra_regs)); +} + static __always_inline void intel_pmu_init_arw(struct pmu *pmu) {intel_pmu_init_grt (pmu);
@@ -8148,7 +8176,7 @@ __init int intel_pmu_init(void)break ;case INTEL_ATOM_DARKMONT_X : -intel_pmu_init_skt (NULL ); +intel_pmu_init_dkt (NULL );intel_pmu_pebs_data_source_cmt (); x86_pmu.pebs_latency_data = cmt_latency_data; x86_pmu.get_event_constraints = cmt_get_event_constraints;