History

Merge tag 'perf-core-2026-06-14' of gitolite.kernel.org:pub/scm/linux/kernel/git/tip/tip

Pull performance events updates from Ingo Molnar: "Core perf code updates: - Reveal PMU type in fdinfo (Chun-Tse Shao) Intel CPU PMU driver updates: - Fix various inaccurate hard-coded event configurations (Dapeng Mi) Intel uncore PMU driver updates (Zide Chen): - Fix discovery unit lookup bug for multi-die systems - Guard against invalid box control address - Fix PCI device refcount leak in UPI discovery - Defer ADL global PMON enable to enable_box() to save power - Fix uncore_die_to_cpu() for offline dies - Implement global init callback for GNR uncore AMD CPU PMU driver updates: - Always use the NMI latency mitigation (Sandipan Das) AMD uncore PMU driver updates: - Use Node ID to identify DF and UMC domains (Sandipan Das)" * tag 'perf-core-2026-06-14' of gitolite.kernel.org:pub/scm/linux/kernel/git/tip/tip: (22 commits) perf/x86/amd/uncore: Use Node ID to identify DF and UMC domains perf: Reveal PMU type in fdinfo perf/x86/intel/uncore: Implement global init callback for GNR uncore perf/x86/intel/uncore: Fix uncore_die_to_cpu() for offline dies perf/x86/intel/uncore: Move die_to_cpu() to uncore.c perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box() perf/x86/intel/uncore: Fix PCI device refcount leak in UPI discovery perf/x86/intel/uncore: Guard against invalid box control address perf/x86/intel/uncore: Fix discovery unit lookup for multi-die systems perf/x86/amd/core: Always use the NMI latency mitigation perf/x86/intel: Update event constraints and cache_extra_regsfor CWF perf/x86/intel: Update event constraints and cache_extra_regsfor SRF perf/x86/intel: Update event constraints and cache_extra_regsfor NVL perf/x86/intel: Update event constraints for PTL perf/x86/intel: Update event constraints and cache_extra_regsfor ARL perf/x86/intel: Update event constraints and cache_extra_regsfor LNL perf/x86/intel: Update event constraints and cache_extra_regsfor MTL perf/x86/intel: Update event constraints and cache_extra_regsfor ADL perf/x86/intel: Update event constraints for DMR perf/x86/intel: Update event constraints and cache_extra_regsfor SPR ...

Linus Torvalds committed 5 months ago

Commit 0bcc2dc2 parents d8d706a 67d277211 files · +540 −145Browse files

Unified · Split

11 files
  1. arch/x86/events/amd/core.c +3 −3
  2. arch/x86/events/amd/uncore.c +3 −3
  3. arch/x86/events/intel/core.c +408 −81
  4. arch/x86/events/intel/ds.c +17 −6
  5. arch/x86/events/intel/uncore.c +31 −1
  6. arch/x86/events/intel/uncore.h +2 −1
  7. arch/x86/events/intel/uncore_discovery.c +31 −15
  8. arch/x86/events/intel/uncore_snb.c +0 −7
  9. arch/x86/events/intel/uncore_snbep.c +12 −24
  10. arch/x86/events/perf_event.h +4 −4
  11. kernel/events/core.c +29 −0
arch/x86/events/amd/core.c+3−3
@@ -1412,12 +1412,12 @@ static int __init amd_core_pmu_init(void) · 1411 unmodified lines
14121412 u64 even_ctr_mask = 0ULL;
14131413 int i;
14141414
1415− if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
1416− return 0;
1417−
14181415 /* Avoid calculating the value each time in the NMI handler */
14191416 perf_nmi_window = msecs_to_jiffies(100);
14201417
1418+ if (!boot_cpu_has(X86_FEATURE_PERFCTR_CORE))
1419+ return 0;
1420+
14211421 /*
14221422 * If core performance counter extensions exists, we must use
14231423 * MSR_F15H_PERF_CTL/MSR_F15H_PERF_CTR msrs. See also
arch/x86/events/amd/uncore.c+3−3
@@ -700,7 +700,7 @@ void amd_uncore_df_ctx_scan(struct amd_uncore *uncore, unsigned int cpu) · 699 unmodified lines
700700 info.split.aux_data = 0;
701701 info.split.num_pmcs = NUM_COUNTERS_NB;
702702 info.split.gid = 0;
703− info.split.cid = topology_logical_package_id(cpu);
703+ info.split.cid = topology_amd_node_id(cpu);
704704
705705 if (pmu_version >= 2) {
706706 ebx.full = cpuid_ebx(EXT_PERFMON_DEBUG_FEATURES);
@@ -999,8 +999,8 @@ void amd_uncore_umc_ctx_scan(struct amd_uncore *uncore, unsigned int cpu) · 292 unmodified lines
999999 cpuid(EXT_PERFMON_DEBUG_FEATURES, &eax, &ebx.full, &ecx, &edx);
10001000 info.split.aux_data = ecx; /* stash active mask */
10011001 info.split.num_pmcs = ebx.split.num_umc_pmc;
1002− info.split.gid = topology_logical_package_id(cpu);
1003− info.split.cid = topology_logical_package_id(cpu);
1002+ info.split.gid = topology_amd_node_id(cpu);
1003+ info.split.cid = topology_amd_node_id(cpu);
10041004 *per_cpu_ptr(uncore->info, cpu) = info;
10051005 }
10061006
arch/x86/events/intel/core.c+408−81
@@ -215,39 +215,47 @@ static struct event_constraint intel_slm_event_constraints[] __read_mostly = · 214 unmodified lines
215215
216216 static struct event_constraint intel_grt_event_constraints[] __read_mostly = {
217217 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
218+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
218219 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
219− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
220+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
221+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
220222 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF_TSC_P */
221223 EVENT_CONSTRAINT_END
222224 };
223225
224226 static struct event_constraint intel_skt_event_constraints[] __read_mostly = {
225227 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
228+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
226229 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
227− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
230+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
231+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
228232 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF_TSC_P */
229233 FIXED_EVENT_CONSTRAINT(0x0073, 4), /* TOPDOWN_BAD_SPECULATION.ALL */
234+ FIXED_EVENT_CONSTRAINT(0x0500, 4), /* pseudo TOPDOWN_BAD_SPECULATION.ALL */
230235 FIXED_EVENT_CONSTRAINT(0x019c, 5), /* TOPDOWN_FE_BOUND.ALL */
236+ FIXED_EVENT_CONSTRAINT(0x0600, 5), /* pseudo TOPDOWN_FE_BOUND.ALL */
231237 FIXED_EVENT_CONSTRAINT(0x02c2, 6), /* TOPDOWN_RETIRING.ALL */
238+ FIXED_EVENT_CONSTRAINT(0x0700, 6), /* pseudo TOPDOWN_RETIRING.ALL */
232239 EVENT_CONSTRAINT_END
233240 };
234241
235242 static struct event_constraint intel_arw_event_constraints[] __read_mostly = {
236243 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
244+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
237245 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
238− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF */
246+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
247+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
239248 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF_TSC_P */
240249 FIXED_EVENT_CONSTRAINT(0x0073, 4), /* TOPDOWN_BAD_SPECULATION.ALL */
250+ FIXED_EVENT_CONSTRAINT(0x0500, 4), /* pseudo TOPDOWN_BAD_SPECULATION.ALL */
241251 FIXED_EVENT_CONSTRAINT(0x019c, 5), /* TOPDOWN_FE_BOUND.ALL */
252+ FIXED_EVENT_CONSTRAINT(0x0600, 5), /* pseudo TOPDOWN_FE_BOUND.ALL */
242253 FIXED_EVENT_CONSTRAINT(0x02c2, 6), /* TOPDOWN_RETIRING.ALL */
254+ FIXED_EVENT_CONSTRAINT(0x0700, 6), /* pseudo TOPDOWN_RETIRING.ALL */
243255 INTEL_UEVENT_CONSTRAINT(0x01b7, 0x1),
244256 INTEL_UEVENT_CONSTRAINT(0x02b7, 0x2),
245257 INTEL_UEVENT_CONSTRAINT(0x04b7, 0x4),
246258 INTEL_UEVENT_CONSTRAINT(0x08b7, 0x8),
247− INTEL_UEVENT_CONSTRAINT(0x01d4, 0x1),
248− INTEL_UEVENT_CONSTRAINT(0x02d4, 0x2),
249− INTEL_UEVENT_CONSTRAINT(0x04d4, 0x4),
250− INTEL_UEVENT_CONSTRAINT(0x08d4, 0x8),
251259 INTEL_UEVENT_CONSTRAINT(0x0175, 0x1),
252260 INTEL_UEVENT_CONSTRAINT(0x0275, 0x2),
253261 INTEL_UEVENT_CONSTRAINT(0x21d3, 0x1),
@@ -310,10 +318,11 @@ static struct extra_reg intel_skl_extra_regs[] __read_mostly = { · 56 unmodified lines
310318 static struct event_constraint intel_icl_event_constraints[] = {
311319 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
312320 FIXED_EVENT_CONSTRAINT(0x01c0, 0), /* old INST_RETIRED.PREC_DIST */
313− FIXED_EVENT_CONSTRAINT(0x0100, 0), /* INST_RETIRED.PREC_DIST */
321+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
314322 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
315− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */
316− FIXED_EVENT_CONSTRAINT(0x0400, 3), /* SLOTS */
323+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
324+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
325+ FIXED_EVENT_CONSTRAINT(0x0400, 3), /* pseudo TOPDOWN.SLOTS */
317326 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_RETIRING, 0),
318327 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_BAD_SPEC, 1),
319328 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_FE_BOUND, 2),
@@ -355,11 +364,12 @@ static struct extra_reg intel_glc_extra_regs[] __read_mostly = { · 35 unmodified lines
355364
356365 static struct event_constraint intel_glc_event_constraints[] = {
357366 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
358− FIXED_EVENT_CONSTRAINT(0x0100, 0), /* INST_RETIRED.PREC_DIST */
367+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
359368 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
360− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */
369+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
370+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
361371 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF_TSC_P */
362− FIXED_EVENT_CONSTRAINT(0x0400, 3), /* SLOTS */
372+ FIXED_EVENT_CONSTRAINT(0x0400, 3), /* pseudo TOPDOWN.SLOTS */
363373 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_RETIRING, 0),
364374 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_BAD_SPEC, 1),
365375 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_FE_BOUND, 2),
@@ -379,9 +389,13 @@ static struct event_constraint intel_glc_event_constraints[] = { · 13 unmodified lines
379389
380390 INTEL_UEVENT_CONSTRAINT(0x01a3, 0xf),
381391 INTEL_UEVENT_CONSTRAINT(0x02a3, 0xf),
392+ INTEL_UEVENT_CONSTRAINT(0x05a3, 0xf),
393+ INTEL_UEVENT_CONSTRAINT(0x06a3, 0xf),
382394 INTEL_UEVENT_CONSTRAINT(0x08a3, 0xf),
395+ INTEL_UEVENT_CONSTRAINT(0x0ca3, 0xf),
383396 INTEL_UEVENT_CONSTRAINT(0x04a4, 0x1),
384397 INTEL_UEVENT_CONSTRAINT(0x08a4, 0x1),
398+ INTEL_UEVENT_CONSTRAINT(0x01cd, 0xfe),
385399 INTEL_UEVENT_CONSTRAINT(0x02cd, 0x1),
386400 INTEL_EVENT_CONSTRAINT(0xce, 0x1),
387401 INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xdf, 0xf),
@@ -407,11 +421,12 @@ static struct extra_reg intel_rwc_extra_regs[] __read_mostly = { · 19 unmodified lines
407421
408422 static struct event_constraint intel_lnc_event_constraints[] = {
409423 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
410− FIXED_EVENT_CONSTRAINT(0x0100, 0), /* INST_RETIRED.PREC_DIST */
424+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
411425 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
412− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */
426+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
427+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
413428 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF_TSC_P */
414− FIXED_EVENT_CONSTRAINT(0x0400, 3), /* SLOTS */
429+ FIXED_EVENT_CONSTRAINT(0x0400, 3), /* pseudo TOPDOWN.SLOTS */
415430 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_RETIRING, 0),
416431 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_BAD_SPEC, 1),
417432 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_FE_BOUND, 2),
@@ -423,8 +438,6 @@ static struct event_constraint intel_lnc_event_constraints[] = { · 5 unmodified lines
423438
424439 INTEL_EVENT_CONSTRAINT(0x20, 0xf),
425440
426− INTEL_UEVENT_CONSTRAINT(0x012a, 0xf),
427− INTEL_UEVENT_CONSTRAINT(0x012b, 0xf),
428441 INTEL_UEVENT_CONSTRAINT(0x0148, 0x4),
429442 INTEL_UEVENT_CONSTRAINT(0x0175, 0x4),
430443
@@ -435,15 +448,14 @@ static struct event_constraint intel_lnc_event_constraints[] = { · 4 unmodified lines
435448 INTEL_UEVENT_CONSTRAINT(0x0ca3, 0x4),
436449 INTEL_UEVENT_CONSTRAINT(0x04a4, 0x1),
437450 INTEL_UEVENT_CONSTRAINT(0x08a4, 0x1),
438− INTEL_UEVENT_CONSTRAINT(0x10a4, 0x1),
451+ INTEL_UEVENT_CONSTRAINT(0x10a4, 0x8),
439452 INTEL_UEVENT_CONSTRAINT(0x01b1, 0x8),
440453 INTEL_UEVENT_CONSTRAINT(0x01cd, 0x3fc),
441454 INTEL_UEVENT_CONSTRAINT(0x02cd, 0x3),
442455
456+ INTEL_UEVENT_CONSTRAINT(0x87d0, 0x3ff),
443457 INTEL_EVENT_CONSTRAINT_RANGE(0xd0, 0xdf, 0xf),
444458
445− INTEL_UEVENT_CONSTRAINT(0x00e0, 0xf),
446−
447459 EVENT_CONSTRAINT_END
448460 };
449461
@@ -460,11 +472,12 @@ static struct extra_reg intel_lnc_extra_regs[] __read_mostly = { · 10 unmodified lines
460472
461473 static struct event_constraint intel_pnc_event_constraints[] = {
462474 FIXED_EVENT_CONSTRAINT(0x00c0, 0), /* INST_RETIRED.ANY */
463− FIXED_EVENT_CONSTRAINT(0x0100, 0), /* INST_RETIRED.PREC_DIST */
475+ FIXED_EVENT_CONSTRAINT(0x0100, 0), /* pseudo INST_RETIRED.ANY */
464476 FIXED_EVENT_CONSTRAINT(0x003c, 1), /* CPU_CLK_UNHALTED.CORE */
465− FIXED_EVENT_CONSTRAINT(0x0300, 2), /* CPU_CLK_UNHALTED.REF */
477+ FIXED_EVENT_CONSTRAINT(0x0200, 1), /* pseudo CPU_CLK_UNHALTED.THREAD */
478+ FIXED_EVENT_CONSTRAINT(0x0300, 2), /* pseudo CPU_CLK_UNHALTED.REF_TSC */
466479 FIXED_EVENT_CONSTRAINT(0x013c, 2), /* CPU_CLK_UNHALTED.REF_TSC_P */
467− FIXED_EVENT_CONSTRAINT(0x0400, 3), /* SLOTS */
480+ FIXED_EVENT_CONSTRAINT(0x0400, 3), /* pseudo TOPDOWN.SLOTS */
468481 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_RETIRING, 0),
469482 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_BAD_SPEC, 1),
470483 METRIC_EVENT_CONSTRAINT(INTEL_TD_METRIC_FE_BOUND, 2),
@@ -706,6 +719,80 @@ static __initconst const u64 glc_hw_cache_event_ids · 235 unmodified lines
706719 },
707720 };
708721
722+/* ADL P-core (Golden cove) specific event code. */
723+static __initconst const u64 adl_glc_hw_cache_event_ids
724+ [PERF_COUNT_HW_CACHE_MAX]
725+ [PERF_COUNT_HW_CACHE_OP_MAX]
726+ [PERF_COUNT_HW_CACHE_RESULT_MAX] =
727+{
728+ [ C(L1D ) ] = {
729+ [ C(OP_READ) ] = {
730+ [ C(RESULT_ACCESS) ] = 0x81d0,
731+ [ C(RESULT_MISS) ] = 0xe124,
732+ },
733+ [ C(OP_WRITE) ] = {
734+ [ C(RESULT_ACCESS) ] = 0x82d0,
735+ },
736+ },
737+ [ C(L1I ) ] = {
738+ [ C(OP_READ) ] = {
739+ [ C(RESULT_MISS) ] = 0xe424,
740+ },
741+ [ C(OP_WRITE) ] = {
742+ [ C(RESULT_ACCESS) ] = -1,
743+ [ C(RESULT_MISS) ] = -1,
744+ },
745+ },
746+ [ C(LL ) ] = {
747+ [ C(OP_READ) ] = {
748+ [ C(RESULT_ACCESS) ] = 0x12a,
749+ [ C(RESULT_MISS) ] = 0x12a,
750+ },
751+ [ C(OP_WRITE) ] = {
752+ [ C(RESULT_ACCESS) ] = 0x12a,
753+ [ C(RESULT_MISS) ] = 0x12a,
754+ },
755+ },
756+ [ C(DTLB) ] = {
757+ [ C(OP_READ) ] = {
758+ [ C(RESULT_ACCESS) ] = 0x81d0,
759+ [ C(RESULT_MISS) ] = 0xe12,
760+ },
761+ [ C(OP_WRITE) ] = {
762+ [ C(RESULT_ACCESS) ] = 0x82d0,
763+ [ C(RESULT_MISS) ] = 0xe13,
764+ },
765+ },
766+ [ C(ITLB) ] = {
767+ [ C(OP_READ) ] = {
768+ [ C(RESULT_ACCESS) ] = -1,
769+ [ C(RESULT_MISS) ] = 0xe11,
770+ },
771+ [ C(OP_WRITE) ] = {
772+ [ C(RESULT_ACCESS) ] = -1,
773+ [ C(RESULT_MISS) ] = -1,
774+ },
775+ [ C(OP_PREFETCH) ] = {
776+ [ C(RESULT_ACCESS) ] = -1,
777+ [ C(RESULT_MISS) ] = -1,
778+ },
779+ },
780+ [ C(BPU ) ] = {
781+ [ C(OP_READ) ] = {
782+ [ C(RESULT_ACCESS) ] = 0x4c4,
783+ [ C(RESULT_MISS) ] = 0x4c5,
784+ },
785+ [ C(OP_WRITE) ] = {
786+ [ C(RESULT_ACCESS) ] = -1,
787+ [ C(RESULT_MISS) ] = -1,
788+ },
789+ [ C(OP_PREFETCH) ] = {
790+ [ C(RESULT_ACCESS) ] = -1,
791+ [ C(RESULT_MISS) ] = -1,
792+ },
793+ },
794+};
795+
709796 static __initconst const u64 glc_hw_cache_extra_regs
710797 [PERF_COUNT_HW_CACHE_MAX]
711798 [PERF_COUNT_HW_CACHE_OP_MAX]
@@ -713,18 +800,71 @@ static __initconst const u64 glc_hw_cache_extra_regs · 1 unmodified line
713800 {
714801 [ C(LL ) ] = {
715802 [ C(OP_READ) ] = {
716− [ C(RESULT_ACCESS) ] = 0x10001,
717− [ C(RESULT_MISS) ] = 0x3fbfc00001,
803+ [ C(RESULT_ACCESS) ] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
804+ [ C(RESULT_MISS) ] = 0x3fbfc00001, /* OCR.DEMAND_DATA_RD.L3_MISS */
718805 },
719806 [ C(OP_WRITE) ] = {
720− [ C(RESULT_ACCESS) ] = 0x3f3ffc0002,
721− [ C(RESULT_MISS) ] = 0x3f3fc00002,
807+ [ C(RESULT_ACCESS) ] = 0x3f3ffc0002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
808+ [ C(RESULT_MISS) ] = 0x3f3fc00002, /* OCR.DEMAND_RFO.L3_MISS */
722809 },
723810 },
724811 [ C(NODE) ] = {
725812 [ C(OP_READ) ] = {
726− [ C(RESULT_ACCESS) ] = 0x10c000001,
727− [ C(RESULT_MISS) ] = 0x3fb3000001,
813+ [ C(RESULT_ACCESS) ] = 0x104000001, /* OCR.DEMAND_DATA_RD.LOCAL_DRAM */
814+ [ C(RESULT_MISS) ] = 0x730000001, /* OCR.DEMAND_DATA_RD.REMOTE_DRAM */
815+ },
816+ },
817+};
818+
819+/* ADL P-core (Golden cove) specific extra regs value. */
820+static __initconst const u64 adl_glc_hw_cache_extra_regs
821+ [PERF_COUNT_HW_CACHE_MAX]
822+ [PERF_COUNT_HW_CACHE_OP_MAX]
823+ [PERF_COUNT_HW_CACHE_RESULT_MAX] =
824+{
825+ [ C(LL ) ] = {
826+ [ C(OP_READ) ] = {
827+ [ C(RESULT_ACCESS) ] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
828+ [ C(RESULT_MISS) ] = 0x3fbfc00001, /* OCR.DEMAND_DATA_RD.L3_MISS */
829+ },
830+ [ C(OP_WRITE) ] = {
831+ [ C(RESULT_ACCESS) ] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
832+ [ C(RESULT_MISS) ] = 0x3fbfc00002, /* OCR.DEMAND_RFO.L3_MISS */
833+ },
834+ },
835+};
836+
837+static __initconst const u64 lnc_hw_cache_extra_regs
838+ [PERF_COUNT_HW_CACHE_MAX]
839+ [PERF_COUNT_HW_CACHE_OP_MAX]
840+ [PERF_COUNT_HW_CACHE_RESULT_MAX] =
841+{
842+ [ C(LL ) ] = {
843+ [ C(OP_READ) ] = {
844+ [ C(RESULT_ACCESS) ] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
845+ [ C(RESULT_MISS) ] = 0x9E7FA000001, /* OCR.DEMAND_DATA_RD.L3_MISS */
846+ },
847+ [ C(OP_WRITE) ] = {
848+ [ C(RESULT_ACCESS) ] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
849+ [ C(RESULT_MISS) ] = 0x9E7FA000002, /* OCR.DEMAND_RFO.L3_MISS */
850+ },
851+ },
852+};
853+
854+/* ARL specific lioncove hw_cache_extra_regs[] variant. */
855+static __initconst const u64 arl_lnc_hw_cache_extra_regs
856+ [PERF_COUNT_HW_CACHE_MAX]
857+ [PERF_COUNT_HW_CACHE_OP_MAX]
858+ [PERF_COUNT_HW_CACHE_RESULT_MAX] =
859+{
860+ [ C(LL ) ] = {
861+ [ C(OP_READ) ] = {
862+ [ C(RESULT_ACCESS) ] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
863+ [ C(RESULT_MISS) ] = 0xFE7F8000001, /* OCR.DEMAND_DATA_RD.L3_MISS */
864+ },
865+ [ C(OP_WRITE) ] = {
866+ [ C(RESULT_ACCESS) ] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
867+ [ C(RESULT_MISS) ] = 0xFE7F8000002, /* OCR.DEMAND_RFO.L3_MISS */
728868 },
729869 },
730870 };
@@ -815,12 +955,29 @@ static __initconst const u64 pnc_hw_cache_extra_regs · 84 unmodified lines
815955 {
816956 [ C(LL ) ] = {
817957 [ C(OP_READ) ] = {
818− [ C(RESULT_ACCESS) ] = 0x4000000000000001,
819− [ C(RESULT_MISS) ] = 0xFFFFF000000001,
958+ [ C(RESULT_ACCESS) ] = 0x4000000000000001, /* OMR.DEMAND_DATA_RD.ANY_RESPONSE */
959+ [ C(RESULT_MISS) ] = 0xFFFFF000000001, /* OMR.DEMAND_DATA_RD.L3_MISS */
820960 },
821961 [ C(OP_WRITE) ] = {
822− [ C(RESULT_ACCESS) ] = 0x4000000000000002,
823− [ C(RESULT_MISS) ] = 0xFFFFF000000002,
962+ [ C(RESULT_ACCESS) ] = 0x4000000000000002, /* OMR.DEMAND_RFO.ANY_RESPONSE */
963+ [ C(RESULT_MISS) ] = 0xFFFFF000000002, /* OMR.DEMAND_RFO.L3_MISS */
964+ },
965+ },
966+};
967+
968+static __initconst const u64 cyc_hw_cache_extra_regs
969+ [PERF_COUNT_HW_CACHE_MAX]
970+ [PERF_COUNT_HW_CACHE_OP_MAX]
971+ [PERF_COUNT_HW_CACHE_RESULT_MAX] =
972+{
973+ [ C(LL ) ] = {
974+ [ C(OP_READ) ] = {
975+ [ C(RESULT_ACCESS) ] = 0x4000000000000001, /* OMR.DEMAND_DATA_RD.ANY_RESPONSE */
976+ [ C(RESULT_MISS) ] = 0xFF03F000000001, /* OMR.DEMAND_DATA_RD.L3_MISS */
977+ },
978+ [ C(OP_WRITE) ] = {
979+ [ C(RESULT_ACCESS) ] = 0x4000000000000002, /* OMR.DEMAND_RFO.ANY_RESPONSE */
980+ [ C(RESULT_MISS) ] = 0xFF03F000000002, /* OMR.DEMAND_RFO.L3_MISS */
824981 },
825982 },
826983 };
@@ -1019,6 +1176,41 @@ static __initconst const u64 skl_hw_cache_extra_regs · 192 unmodified lines
10191176 },
10201177 };
10211178
1179+static __initconst const u64 snc_hw_cache_extra_regs
1180+ [PERF_COUNT_HW_CACHE_MAX]
1181+ [PERF_COUNT_HW_CACHE_OP_MAX]
1182+ [PERF_COUNT_HW_CACHE_RESULT_MAX] =
1183+{
1184+ [ C(LL ) ] = {
1185+ [ C(OP_READ) ] = {
1186+ [ C(RESULT_ACCESS) ] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
1187+ [ C(RESULT_MISS) ] = 0x3FBFC00001, /* OCR.DEMAND_DATA_RD.L3_MISS */
1188+ },
1189+ [ C(OP_WRITE) ] = {
1190+ [ C(RESULT_ACCESS) ] = 0x3F3FFC0002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
1191+ [ C(RESULT_MISS) ] = 0x3F3FC00002, /* OCR.DEMAND_RFO.L3_MISS */
1192+ },
1193+ [ C(OP_PREFETCH) ] = {
1194+ [ C(RESULT_ACCESS) ] = 0x0,
1195+ [ C(RESULT_MISS) ] = 0x0,
1196+ },
1197+ },
1198+ [ C(NODE) ] = {
1199+ [ C(OP_READ) ] = {
1200+ [ C(RESULT_ACCESS) ] = 0x104000001, /* OCR.DEMAND_DATA_RD.LOCAL_DRAM */
1201+ [ C(RESULT_MISS) ] = 0x730000001, /* OCR.DEMAND_DATA_RD.REMOTE_DRAM */
1202+ },
1203+ [ C(OP_WRITE) ] = {
1204+ [ C(RESULT_ACCESS) ] = 0x104000002, /* OCR.DEMAND_RFO.LOCAL_DRAM */
1205+ [ C(RESULT_MISS) ] = 0x730000002, /* OCR.DEMAND_RFO.REMOTE_DRAM */
1206+ },
1207+ [ C(OP_PREFETCH) ] = {
1208+ [ C(RESULT_ACCESS) ] = 0x0,
1209+ [ C(RESULT_MISS) ] = 0x0,
1210+ },
1211+ },
1212+};
1213+
10221214 #define SNB_DMND_DATA_RD (1ULL << 0)
10231215 #define SNB_DMND_RFO (1ULL << 1)
10241216 #define SNB_DMND_IFETCH (1ULL << 2)
@@ -2342,22 +2534,82 @@ static __initconst const u64 tnt_hw_cache_extra_regs · 1317 unmodified lines
23422534 },
23432535 };
23442536
2345−static __initconst const u64 arw_hw_cache_extra_regs
2537+static __initconst const u64 grt_hw_cache_extra_regs
23462538 [PERF_COUNT_HW_CACHE_MAX]
23472539 [PERF_COUNT_HW_CACHE_OP_MAX]
23482540 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
23492541 [C(LL)] = {
23502542 [C(OP_READ)] = {
2351− [C(RESULT_ACCESS)] = 0x4000000000000001,
2352− [C(RESULT_MISS)] = 0xFFFFF000000001,
2543+ [C(RESULT_ACCESS)] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
2544+ [C(RESULT_MISS)] = 0x3F84400001, /* OCR.DEMAND_DATA_RD.L3_MISS */
23532545 },
23542546 [C(OP_WRITE)] = {
2355− [C(RESULT_ACCESS)] = 0x4000000000000002,
2356− [C(RESULT_MISS)] = 0xFFFFF000000002,
2547+ [C(RESULT_ACCESS)] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
2548+ [C(RESULT_MISS)] = 0x3F84400002, /* OCR.DEMAND_RFO.L3_MISS */
23572549 },
2358− [C(OP_PREFETCH)] = {
2359− [C(RESULT_ACCESS)] = 0x0,
2360− [C(RESULT_MISS)] = 0x0,
2550+ },
2551+};
2552+
2553+static __initconst const u64 cmt_hw_cache_extra_regs
2554+ [PERF_COUNT_HW_CACHE_MAX]
2555+ [PERF_COUNT_HW_CACHE_OP_MAX]
2556+ [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
2557+ [C(LL)] = {
2558+ [C(OP_READ)] = {
2559+ [C(RESULT_ACCESS)] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
2560+ [C(RESULT_MISS)] = 0x3fbfc00001, /* OCR.DEMAND_DATA_RD.L3_MISS */
2561+ },
2562+ [C(OP_WRITE)] = {
2563+ [C(RESULT_ACCESS)] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
2564+ [C(RESULT_MISS)] = 0x3fbfc00002, /* OCR.DEMAND_RFO.L3_MISS */
2565+ },
2566+ },
2567+};
2568+
2569+static __initconst const u64 skt_hw_cache_extra_regs
2570+ [PERF_COUNT_HW_CACHE_MAX]
2571+ [PERF_COUNT_HW_CACHE_OP_MAX]
2572+ [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
2573+ [C(LL)] = {
2574+ [C(OP_READ)] = {
2575+ [C(RESULT_ACCESS)] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
2576+ [C(RESULT_MISS)] = 0x13FBFC00001, /* OCR.DEMAND_DATA_RD.L3_MISS */
2577+ },
2578+ [C(OP_WRITE)] = {
2579+ [C(RESULT_ACCESS)] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
2580+ [C(RESULT_MISS)] = 0x13FBFC00002, /* OCR.DEMAND_RFO.L3_MISS */
2581+ },
2582+ },
2583+};
2584+
2585+static __initconst const u64 dkt_hw_cache_extra_regs
2586+ [PERF_COUNT_HW_CACHE_MAX]
2587+ [PERF_COUNT_HW_CACHE_OP_MAX]
2588+ [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
2589+ [C(LL)] = {
2590+ [C(OP_READ)] = {
2591+ [C(RESULT_ACCESS)] = 0x10001, /* OCR.DEMAND_DATA_RD.ANY_RESPONSE */
2592+ [C(RESULT_MISS)] = 0x33FBFC00001, /* OCR.DEMAND_DATA_RD.L3_MISS */
2593+ },
2594+ [C(OP_WRITE)] = {
2595+ [C(RESULT_ACCESS)] = 0x10002, /* OCR.DEMAND_RFO.ANY_RESPONSE */
2596+ [C(RESULT_MISS)] = 0x33FBFC00002, /* OCR.DEMAND_RFO.L3_MISS */
2597+ },
2598+ },
2599+};
2600+
2601+static __initconst const u64 arw_hw_cache_extra_regs
2602+ [PERF_COUNT_HW_CACHE_MAX]
2603+ [PERF_COUNT_HW_CACHE_OP_MAX]
2604+ [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
2605+ [C(LL)] = {
2606+ [C(OP_READ)] = {
2607+ [C(RESULT_ACCESS)] = 0x4000000000000009, /* OMR.DEMAND_DATA_RD.ANY_RESPONSE */
2608+ [C(RESULT_MISS)] = 0xFF03F000000009, /* OMR.DEMAND_DATA_RD.L3_MISS */
2609+ },
2610+ [C(OP_WRITE)] = {
2611+ [C(RESULT_ACCESS)] = 0x400000000000000A, /* OMR.DEMAND_RFO.ANY_RESPONSE */
2612+ [C(RESULT_MISS)] = 0xFF03F00000000A, /* OMR.DEMAND_RFO.L3_MISS */
23612613 },
23622614 },
23632615 };
@@ -2392,9 +2644,12 @@ static struct attribute *grt_mem_attrs[] = { · 28 unmodified lines
23922644 };
23932645
23942646 static struct extra_reg intel_grt_extra_regs[] __read_mostly = {
2395− /* must define OFFCORE_RSP_X first, see intel_fixup_er() */
2396− INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x3fffffffffull, RSP_0),
2397− INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OFFCORE_RSP_1, 0x3fffffffffull, RSP_1),
2647+ /*
2648+ * Must define OFFCORE_RSP_X first, see intel_fixup_er().
2649+ * Bit 63 only valid on OFFCORE_RSP_0 MSR.
2650+ */
2651+ INTEL_UEVENT_EXTRA_REG(0x01b7, MSR_OFFCORE_RSP_0, 0x8003f03fffffffffull, RSP_0),
2652+ INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OFFCORE_RSP_1, 0x3f03fffffffffull, RSP_1),
23982653 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x5d0),
23992654 EVENT_EXTRA_END
24002655 };
@@ -2426,10 +2681,6 @@ static struct extra_reg intel_arw_extra_regs[] __read_mostly = { · 25 unmodified lines
24262681 INTEL_UEVENT_EXTRA_REG(0x02b7, MSR_OMR_1, 0xc0ffffffffffffffull, OMR_1),
24272682 INTEL_UEVENT_EXTRA_REG(0x04b7, MSR_OMR_2, 0xc0ffffffffffffffull, OMR_2),
24282683 INTEL_UEVENT_EXTRA_REG(0x08b7, MSR_OMR_3, 0xc0ffffffffffffffull, OMR_3),
2429− INTEL_UEVENT_EXTRA_REG(0x01d4, MSR_OMR_0, 0xc0ffffffffffffffull, OMR_0),
2430− INTEL_UEVENT_EXTRA_REG(0x02d4, MSR_OMR_1, 0xc0ffffffffffffffull, OMR_1),
2431− INTEL_UEVENT_EXTRA_REG(0x04d4, MSR_OMR_2, 0xc0ffffffffffffffull, OMR_2),
2432− INTEL_UEVENT_EXTRA_REG(0x08d4, MSR_OMR_3, 0xc0ffffffffffffffull, OMR_3),
24332684 INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x5d0),
24342685 INTEL_UEVENT_EXTRA_REG(0x0127, MSR_SNOOP_RSP_0, 0xffffffffffffffffull, SNOOP_0),
24352686 INTEL_UEVENT_EXTRA_REG(0x0227, MSR_SNOOP_RSP_1, 0xffffffffffffffffull, SNOOP_1),
@@ -3169,10 +3420,10 @@ static void intel_pmu_config_acr(int idx, u64 mask, u32 reload) · 733 unmodified lines
31693420 wrmsrl(msr_b + msr_offset, mask);
31703421 cpuc->acr_cfg_b[idx] = mask;
31713422 }
3172− /* Only need to update the reload value when there is a valid config value. */
3173− if (mask && cpuc->acr_cfg_c[idx] != reload) {
3423+ /* Only update CFG_C reload when ACR is actively enabled (mask != 0) */
3424+ if (mask && ((cpuc->cfg_c_val[idx] & ARCH_PEBS_RELOAD) != reload)) {
31743425 wrmsrl(msr_c + msr_offset, reload);
3175− cpuc->acr_cfg_c[idx] = reload;
3426+ cpuc->cfg_c_val[idx] = reload;
31763427 }
31773428 }
31783429
@@ -3198,14 +3449,15 @@ static void intel_pmu_enable_event_ext(struct perf_event *event) · 19 unmodified lines
31983449 {
31993450 struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
32003451 struct hw_perf_event *hwc = &event->hw;
3201− union arch_pebs_index old, new;
3202− struct arch_pebs_cap cap;
32033452 u64 ext = 0;
32043453
3205− cap = hybrid(cpuc->pmu, arch_pebs_cap);
3454+ if (is_acr_event_group(event))
3455+ ext |= (-hwc->sample_period) & ARCH_PEBS_RELOAD;
32063456
32073457 if (event->attr.precise_ip) {
32083458 u64 pebs_data_cfg = intel_get_arch_pebs_data_config(event);
3459+ struct arch_pebs_cap cap = hybrid(cpuc->pmu, arch_pebs_cap);
3460+ union arch_pebs_index old, new;
32093461
32103462 ext |= ARCH_PEBS_EN;
32113463 if (hwc->flags & PERF_X86_EVENT_AUTO_RELOAD)
@@ -7490,6 +7742,15 @@ static __always_inline void intel_pmu_init_glc(struct pmu *pmu) · 4278 unmodified lines
74907742 intel_pmu_ref_cycles_ext();
74917743 }
74927744
7745+static __always_inline void intel_pmu_init_glc_hybrid(struct pmu *pmu)
7746+{
7747+ intel_pmu_init_glc(pmu);
7748+
7749+ /* ADL has different extra MSR values from Server for the L3 or node OCR/OMR events. */
7750+ memcpy(hybrid_var(pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids, sizeof(hw_cache_event_ids));
7751+ memcpy(hybrid_var(pmu, hw_cache_extra_regs), adl_glc_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
7752+}
7753+
74937754 static __always_inline void intel_pmu_init_grt(struct pmu *pmu)
74947755 {
74957756 x86_pmu.mid_ack = true;
@@ -7502,7 +7763,7 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu) · 6 unmodified lines
75027763 x86_pmu.flags |= PMU_FL_INSTR_LATENCY;
75037764
75047765 memcpy(hybrid_var(pmu, hw_cache_event_ids), glp_hw_cache_event_ids, sizeof(hw_cache_event_ids));
7505− memcpy(hybrid_var(pmu, hw_cache_extra_regs), tnt_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
7766+ memcpy(hybrid_var(pmu, hw_cache_extra_regs), grt_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
75067767 hybrid_var(pmu, hw_cache_event_ids)[C(ITLB)][C(OP_READ)][C(RESULT_ACCESS)] = -1;
75077768 hybrid(pmu, event_constraints) = intel_grt_event_constraints;
75087769 hybrid(pmu, pebs_constraints) = intel_grt_pebs_event_constraints;
@@ -7511,12 +7772,24 @@ static __always_inline void intel_pmu_init_grt(struct pmu *pmu) · 2 unmodified lines
75117772 intel_pmu_ref_cycles_ext();
75127773 }
75137774
7775+static __always_inline void intel_pmu_init_cmt(struct pmu *pmu)
7776+{
7777+ intel_pmu_init_grt(pmu);
7778+ memcpy(hybrid_var(pmu, hw_cache_extra_regs),
7779+ cmt_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
7780+ hybrid(pmu, pebs_constraints) = intel_cmt_pebs_event_constraints;
7781+ hybrid(pmu, extra_regs) = intel_cmt_extra_regs;
7782+}
7783+
75147784 static __always_inline void intel_pmu_init_lnc(struct pmu *pmu)
75157785 {
75167786 intel_pmu_init_glc(pmu);
75177787 hybrid(pmu, event_constraints) = intel_lnc_event_constraints;
75187788 hybrid(pmu, pebs_constraints) = intel_lnc_pebs_event_constraints;
75197789 hybrid(pmu, extra_regs) = intel_lnc_extra_regs;
7790+
7791+ memcpy(hybrid_var(pmu, hw_cache_event_ids), adl_glc_hw_cache_event_ids, sizeof(hw_cache_event_ids));
7792+ memcpy(hybrid_var(pmu, hw_cache_extra_regs), lnc_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
75207793 }
75217794
75227795 static __always_inline void intel_pmu_init_pnc(struct pmu *pmu)
@@ -7534,14 +7807,41 @@ static __always_inline void intel_pmu_init_pnc(struct pmu *pmu) · 11 unmodified lines
75347807 static_call_update(intel_pmu_enable_acr_event, intel_pmu_enable_acr);
75357808 }
75367809
7810+static __always_inline void intel_pmu_init_cyc(struct pmu *pmu)
7811+{
7812+ intel_pmu_init_pnc(pmu);
7813+ memcpy(hybrid_var(pmu, hw_cache_extra_regs),
7814+ cyc_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
7815+}
7816+
75377817 static __always_inline void intel_pmu_init_skt(struct pmu *pmu)
75387818 {
7539− intel_pmu_init_grt(pmu);
7819+ intel_pmu_init_cmt(pmu);
75407820 hybrid(pmu, event_constraints) = intel_skt_event_constraints;
7541− hybrid(pmu, extra_regs) = intel_cmt_extra_regs;
7821+ memcpy(hybrid_var(pmu, hw_cache_extra_regs),
7822+ skt_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
75427823 static_call_update(intel_pmu_enable_acr_event, intel_pmu_enable_acr);
75437824 }
75447825
7826+/* Hybrid client variant. */
7827+static __always_inline void intel_pmu_init_dkt_hybrid(struct pmu *pmu)
7828+{
7829+ intel_pmu_init_skt(pmu);
7830+ hybrid(pmu, pebs_constraints) = intel_dkt_pebs_event_constraints;
7831+}
7832+
7833+/*
7834+ * Darkmont is used by the CWF and PTL E-cores, but their L3 OCR
7835+ * events require different extra MSR values. Keep a separate init
7836+ * function for the non-hybrid server variant.
7837+ */
7838+static __always_inline void intel_pmu_init_dkt(struct pmu *pmu)
7839+{
7840+ intel_pmu_init_dkt_hybrid(pmu);
7841+ memcpy(hybrid_var(pmu, hw_cache_extra_regs),
7842+ dkt_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
7843+}
7844+
75457845 static __always_inline void intel_pmu_init_arw(struct pmu *pmu)
75467846 {
75477847 intel_pmu_init_grt(pmu);
@@ -7550,7 +7850,7 @@ static __always_inline void intel_pmu_init_arw(struct pmu *pmu) · 2 unmodified lines
75507850 memcpy(hybrid_var(pmu, hw_cache_extra_regs),
75517851 arw_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
75527852 hybrid(pmu, event_constraints) = intel_arw_event_constraints;
7553− hybrid(pmu, pebs_constraints) = intel_arw_pebs_event_constraints;
7853+ hybrid(pmu, pebs_constraints) = intel_dkt_pebs_event_constraints;
75547854 hybrid(pmu, extra_regs) = intel_arw_extra_regs;
75557855 static_call_update(intel_pmu_enable_acr_event, intel_pmu_enable_acr);
75567856 }
@@ -7864,8 +8164,7 @@ __init int intel_pmu_init(void) · 307 unmodified lines
78648164
78658165 case INTEL_ATOM_CRESTMONT:
78668166 case INTEL_ATOM_CRESTMONT_X:
7867− intel_pmu_init_grt(NULL);
7868− x86_pmu.extra_regs = intel_cmt_extra_regs;
8167+ intel_pmu_init_cmt(NULL);
78698168 intel_pmu_pebs_data_source_cmt();
78708169 x86_pmu.pebs_latency_data = cmt_latency_data;
78718170 x86_pmu.get_event_constraints = cmt_get_event_constraints;
@@ -7877,7 +8176,7 @@ __init int intel_pmu_init(void) · 5 unmodified lines
78778176 break;
78788177
78798178 case INTEL_ATOM_DARKMONT_X:
7880− intel_pmu_init_skt(NULL);
8179+ intel_pmu_init_dkt(NULL);
78818180 intel_pmu_pebs_data_source_cmt();
78828181 x86_pmu.pebs_latency_data = cmt_latency_data;
78838182 x86_pmu.get_event_constraints = cmt_get_event_constraints;
@@ -8153,17 +8452,19 @@ __init int intel_pmu_init(void) · 269 unmodified lines
81538452
81548453 case INTEL_ICELAKE_X:
81558454 case INTEL_ICELAKE_D:
8455+ memcpy(hw_cache_extra_regs, snc_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
81568456 x86_pmu.pebs_ept = 1;
81578457 pmem = true;
8158− fallthrough;
8458+ goto snc_common;
81598459 case INTEL_ICELAKE_L:
81608460 case INTEL_ICELAKE:
81618461 case INTEL_TIGERLAKE_L:
81628462 case INTEL_TIGERLAKE:
81638463 case INTEL_ROCKETLAKE:
8464+ memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
8465+ snc_common:
81648466 x86_pmu.late_ack = true;
81658467 memcpy(hw_cache_event_ids, skl_hw_cache_event_ids, sizeof(hw_cache_event_ids));
8166− memcpy(hw_cache_extra_regs, skl_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
81678468 hw_cache_event_ids[C(ITLB)][C(OP_READ)][C(RESULT_ACCESS)] = -1;
81688469 intel_pmu_lbr_init_skl();
81698470
@@ -8259,7 +8560,7 @@ __init int intel_pmu_init(void) · 89 unmodified lines
82598560
82608561 /* Initialize big core specific PerfMon capabilities.*/
82618562 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8262− intel_pmu_init_glc(&pmu->pmu);
8563+ intel_pmu_init_glc_hybrid(&pmu->pmu);
82638564 if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) {
82648565 pmu->cntr_mask64 <<= 2;
82658566 pmu->cntr_mask64 |= 0x3;
@@ -8316,13 +8617,12 @@ __init int intel_pmu_init(void) · 50 unmodified lines
83168617
83178618 /* Initialize big core specific PerfMon capabilities.*/
83188619 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8319− intel_pmu_init_glc(&pmu->pmu);
8620+ intel_pmu_init_glc_hybrid(&pmu->pmu);
83208621 pmu->extra_regs = intel_rwc_extra_regs;
83218622
83228623 /* Initialize Atom core specific PerfMon capabilities.*/
83238624 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
8324− intel_pmu_init_grt(&pmu->pmu);
8325− pmu->extra_regs = intel_cmt_extra_regs;
8625+ intel_pmu_init_cmt(&pmu->pmu);
83268626
83278627 intel_pmu_pebs_data_source_mtl();
83288628 pr_cont("Meteorlake Hybrid events, ");
@@ -8333,16 +8633,50 @@ __init int intel_pmu_init(void) · 4 unmodified lines
83338633 case INTEL_WILDCATLAKE_L:
83348634 pr_cont("Pantherlake Hybrid events, ");
83358635 name = "pantherlake_hybrid";
8636+
8637+ intel_pmu_init_hybrid(hybrid_big_small);
8638+
8639+ /* Initialize big core specific PerfMon capabilities.*/
8640+ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8641+ intel_pmu_init_lnc(&pmu->pmu);
8642+ /* Initialize Atom core specific PerfMon capabilities.*/
8643+ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
8644+ intel_pmu_init_dkt_hybrid(&pmu->pmu);
8645+
83368646 goto lnl_common;
83378647
8338− case INTEL_LUNARLAKE_M:
83398648 case INTEL_ARROWLAKE:
8649+ pr_cont("Arrowlake Hybrid events, ");
8650+ name = "arrowlake_hybrid";
8651+
8652+ intel_pmu_init_hybrid(hybrid_big_small);
8653+
8654+ /* Initialize big core specific PerfMon capabilities.*/
8655+ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8656+ intel_pmu_init_lnc(&pmu->pmu);
8657+ memcpy(hybrid_var(&pmu->pmu, hw_cache_extra_regs),
8658+ arl_lnc_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
8659+ /* Initialize Atom core specific PerfMon capabilities.*/
8660+ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
8661+ intel_pmu_init_skt(&pmu->pmu);
8662+
8663+ goto lnl_common;
8664+
8665+ case INTEL_LUNARLAKE_M:
83408666 pr_cont("Lunarlake Hybrid events, ");
83418667 name = "lunarlake_hybrid";
83428668
8343− lnl_common:
83448669 intel_pmu_init_hybrid(hybrid_big_small);
83458670
8671+ /* Initialize big core specific PerfMon capabilities.*/
8672+ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8673+ intel_pmu_init_lnc(&pmu->pmu);
8674+ /* Initialize Atom core specific PerfMon capabilities.*/
8675+ pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
8676+ intel_pmu_init_skt(&pmu->pmu);
8677+
8678+ lnl_common:
8679+
83468680 x86_pmu.pebs_latency_data = lnl_latency_data;
83478681 x86_pmu.get_event_constraints = mtl_get_event_constraints;
83488682 x86_pmu.hw_config = adl_hw_config;
@@ -8353,14 +8687,6 @@ __init int intel_pmu_init(void) · 4 unmodified lines
83538687 extra_attr = boot_cpu_has(X86_FEATURE_RTM) ?
83548688 mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr;
83558689
8356− /* Initialize big core specific PerfMon capabilities.*/
8357− pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8358− intel_pmu_init_lnc(&pmu->pmu);
8359−
8360− /* Initialize Atom core specific PerfMon capabilities.*/
8361− pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
8362− intel_pmu_init_skt(&pmu->pmu);
8363−
83648690 intel_pmu_pebs_data_source_lnl();
83658691 break;
83668692
@@ -8380,6 +8706,8 @@ __init int intel_pmu_init(void) · 13 unmodified lines
83808706 /* Initialize big core specific PerfMon capabilities. */
83818707 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
83828708 intel_pmu_init_lnc(&pmu->pmu);
8709+ memcpy(hybrid_var(&pmu->pmu, hw_cache_extra_regs),
8710+ arl_lnc_hw_cache_extra_regs, sizeof(hw_cache_extra_regs));
83838711
83848712 /* Initialize Atom core specific PerfMon capabilities. */
83858713 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
@@ -8387,8 +8715,7 @@ __init int intel_pmu_init(void) · 1 unmodified line
83878715
83888716 /* Initialize Lower Power Atom specific PerfMon capabilities. */
83898717 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_TINY_IDX];
8390− intel_pmu_init_grt(&pmu->pmu);
8391− pmu->extra_regs = intel_cmt_extra_regs;
8718+ intel_pmu_init_cmt(&pmu->pmu);
83928719
83938720 intel_pmu_pebs_data_source_arl_h();
83948721 pr_cont("ArrowLake-H Hybrid events, ");
@@ -8413,7 +8740,7 @@ __init int intel_pmu_init(void) · 18 unmodified lines
84138740
84148741 /* Initialize big core specific PerfMon capabilities.*/
84158742 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX];
8416− intel_pmu_init_pnc(&pmu->pmu);
8743+ intel_pmu_init_cyc(&pmu->pmu);
84178744
84188745 /* Initialize Atom core specific PerfMon capabilities.*/
84198746 pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX];
arch/x86/events/intel/ds.c+17−6
@@ -1292,18 +1292,21 @@ struct event_constraint intel_glm_pebs_event_constraints[] = { · 1291 unmodified lines
12921292 struct event_constraint intel_grt_pebs_event_constraints[] = {
12931293 /* Allow all events as PEBS with no flags */
12941294 INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0x3),
1295− INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xf),
1295+ INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0x3f),
12961296 EVENT_CONSTRAINT_END
12971297 };
12981298
1299−struct event_constraint intel_arw_pebs_event_constraints[] = {
1299+struct event_constraint intel_cmt_pebs_event_constraints[] = {
1300+ /* Allow all events as PEBS with no flags */
1301+ INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0x3),
1302+ INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xff),
1303+ EVENT_CONSTRAINT_END
1304+};
1305+
1306+struct event_constraint intel_dkt_pebs_event_constraints[] = {
13001307 /* Allow all events as PEBS with no flags */
13011308 INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0xff),
13021309 INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xff),
1303− INTEL_FLAGS_UEVENT_CONSTRAINT(0x01d4, 0x1),
1304− INTEL_FLAGS_UEVENT_CONSTRAINT(0x02d4, 0x2),
1305− INTEL_FLAGS_UEVENT_CONSTRAINT(0x04d4, 0x4),
1306− INTEL_FLAGS_UEVENT_CONSTRAINT(0x08d4, 0x8),
13071310 EVENT_CONSTRAINT_END
13081311 };
13091312
@@ -1500,6 +1503,13 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = { · 190 unmodified lines
15001503 INTEL_FLAGS_UEVENT_CONSTRAINT(0x100, 0x100000000ULL), /* INST_RETIRED.PREC_DIST */
15011504 INTEL_FLAGS_UEVENT_CONSTRAINT(0x0400, 0x800000000ULL),
15021505
1506+ INTEL_FLAGS_UEVENT_CONSTRAINT(0x012a, 0x1), /* OCR.* events */
1507+ INTEL_FLAGS_UEVENT_CONSTRAINT(0x012b, 0x1), /* OCR.* events */
1508+
1509+ INTEL_FLAGS_UEVENT_CONSTRAINT(0x04a4, 0x1), /* TOPDOWN.BAD_SPEC_SLOTS */
1510+ INTEL_FLAGS_UEVENT_CONSTRAINT(0x08a4, 0x1), /* TOPDOWN.BR_MISPREDICT_SLOTS */
1511+ INTEL_FLAGS_UEVENT_CONSTRAINT(0x10a4, 0x8), /* TOPDOWN.MEMORY_BOUND_SLOTS */
1512+
15031513 INTEL_HYBRID_LDLAT_CONSTRAINT(0x1cd, 0x3fc),
15041514 INTEL_HYBRID_STLAT_CONSTRAINT(0x2cd, 0x3),
15051515 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */
@@ -1509,6 +1519,7 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = { · 3 unmodified lines
15091519 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */
15101520 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */
15111521 INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */
1522+ INTEL_FLAGS_UEVENT_CONSTRAINT(0x87d0, 0x3ff), /* MEM_INST_RETIRED.ANY */
15121523
15131524 INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf),
15141525
arch/x86/events/intel/uncore.c+31−1
@@ -83,6 +83,25 @@ int uncore_device_to_die(struct pci_dev *dev) · 82 unmodified lines
8383 return -1;
8484 }
8585
86+/*
87+ * Using cpus_read_lock() to ensure cpu is not going down between
88+ * looking at cpu_online_mask.
89+ *
90+ * The lock must be held by the caller.
91+ */
92+int uncore_die_to_cpu(int die)
93+{
94+ int res = -1, cpu;
95+
96+ for_each_online_cpu(cpu) {
97+ if (topology_logical_die_id(cpu) == die) {
98+ res = cpu;
99+ break;
100+ }
101+ }
102+ return res;
103+}
104+
86105 static void uncore_free_pcibus_map(void)
87106 {
88107 struct pci2phy_map *map, *tmp;
@@ -1697,7 +1716,7 @@ err: · 1608 unmodified lines
16971716 return ret;
16981717 }
16991718
1700−static int uncore_mmio_global_init(u64 ctl)
1719+static int uncore_mmio_global_init(int die, u64 ctl)
17011720 {
17021721 void __iomem *io_addr;
17031722
@@ -1712,6 +1731,16 @@ static int uncore_mmio_global_init(u64 ctl) · 8 unmodified lines
17121731 return 0;
17131732 }
17141733
1734+static int uncore_msr_global_init(int die, u64 msr)
1735+{
1736+ int cpu = uncore_die_to_cpu(die);
1737+
1738+ if (cpu == -1)
1739+ return -ENODEV;
1740+
1741+ return wrmsrq_on_cpu(cpu, msr, 0);
1742+}
1743+
17151744 static const struct uncore_plat_init nhm_uncore_init __initconst = {
17161745 .cpu_init = nhm_uncore_cpu_init,
17171746 };
@@ -1852,6 +1881,7 @@ static const struct uncore_plat_init gnr_uncore_init __initconst = { · 134 unmodified lines
18521881 .domain[0].base_is_pci = true,
18531882 .domain[0].discovery_base = UNCORE_DISCOVERY_TABLE_DEVICE,
18541883 .domain[0].units_ignore = gnr_uncore_units_ignore,
1884+ .domain[0].global_init = uncore_msr_global_init,
18551885 };
18561886
18571887 static const struct uncore_plat_init dmr_uncore_init __initconst = {
arch/x86/events/intel/uncore.h+2−1
@@ -53,7 +53,7 @@ struct uncore_discovery_domain { · 52 unmodified lines
5353 /* MSR address or PCI device used as the discovery base */
5454 u32 discovery_base;
5555 bool base_is_pci;
56− int (*global_init)(u64 ctl);
56+ int (*global_init)(int die, u64 ctl);
5757
5858 /* The units in the discovery table should be ignored. */
5959 int *units_ignore;
@@ -235,6 +235,7 @@ struct pci2phy_map *__find_pci2phy_map(int segment); · 175 unmodified lines
235235 int uncore_pcibus_to_dieid(struct pci_bus *bus);
236236 int uncore_die_to_segment(int die);
237237 int uncore_device_to_die(struct pci_dev *dev);
238+int uncore_die_to_cpu(int die);
238239
239240 ssize_t uncore_event_show(struct device *dev,
240241 struct device_attribute *attr, char *buf);
arch/x86/events/intel/uncore_discovery.c+31−15
@@ -287,7 +287,7 @@ static int __parse_discovery_table(struct uncore_discovery_domain *domain, · 286 unmodified lines
287287 if (!io_addr)
288288 return -ENOMEM;
289289
290− if (domain->global_init && domain->global_init(global.ctl)) {
290+ if (domain->global_init && domain->global_init(die, global.ctl)) {
291291 ret = -ENODEV;
292292 goto out;
293293 }
@@ -399,7 +399,6 @@ static bool uncore_discovery_msr(struct uncore_discovery_domain *domain) · 105 unmodified lines
399399 if (!die_mask)
400400 return false;
401401
402− cpus_read_lock();
403402 for_each_online_cpu(cpu) {
404403 die = topology_logical_die_id(cpu);
405404 if (__test_and_set_bit(die, die_mask))
@@ -414,8 +413,6 @@ static bool uncore_discovery_msr(struct uncore_discovery_domain *domain) · 8 unmodified lines
414413 __parse_discovery_table(domain, base, die, &parsed);
415414 }
416415
417− cpus_read_unlock();
418−
419416 kfree(die_mask);
420417 return parsed;
421418 }
@@ -429,10 +426,14 @@ bool uncore_discovery(struct uncore_plat_init *init) · 7 unmodified lines
429426 for (i = 0; i < UNCORE_DISCOVERY_DOMAINS; i++) {
430427 domain = &init->domain[i];
431428 if (domain->discovery_base) {
429+ cpus_read_lock();
430+
432431 if (!domain->base_is_pci)
433432 ret |= uncore_discovery_msr(domain);
434433 else
435434 ret |= uncore_discovery_pci(domain);
435+
436+ cpus_read_unlock();
436437 }
437438 }
438439
@@ -481,8 +482,8 @@ static u64 intel_generic_uncore_box_ctl(struct intel_uncore_box *box) · 42 unmodified lines
481482 struct intel_uncore_discovery_unit *unit;
482483
483484 unit = intel_uncore_find_discovery_unit(box->pmu->type->boxes,
484− -1, box->pmu->pmu_idx);
485− if (WARN_ON_ONCE(!unit))
485+ box->dieid, box->pmu->pmu_idx);
486+ if (!unit)
486487 return 0;
487488
488489 return unit->addr;
@@ -490,17 +491,28 @@ static u64 intel_generic_uncore_box_ctl(struct intel_uncore_box *box) · 1 unmodified line
490491
491492 void intel_generic_uncore_msr_init_box(struct intel_uncore_box *box)
492493 {
493− wrmsrq(intel_generic_uncore_box_ctl(box), GENERIC_PMON_BOX_CTL_INT);
494+ u64 box_ctl = intel_generic_uncore_box_ctl(box);
495+
496+ if (!box_ctl)
497+ return;
498+
499+ wrmsrq(box_ctl, GENERIC_PMON_BOX_CTL_INT);
494500 }
495501
496502 void intel_generic_uncore_msr_disable_box(struct intel_uncore_box *box)
497503 {
498− wrmsrq(intel_generic_uncore_box_ctl(box), GENERIC_PMON_BOX_CTL_FRZ);
504+ u64 box_ctl = intel_generic_uncore_box_ctl(box);
505+
506+ if (box_ctl)
507+ wrmsrq(box_ctl, GENERIC_PMON_BOX_CTL_FRZ);
499508 }
500509
501510 void intel_generic_uncore_msr_enable_box(struct intel_uncore_box *box)
502511 {
503− wrmsrq(intel_generic_uncore_box_ctl(box), 0);
512+ u64 box_ctl = intel_generic_uncore_box_ctl(box);
513+
514+ if (box_ctl)
515+ wrmsrq(box_ctl, 0);
504516 }
505517
506518 static void intel_generic_uncore_msr_enable_event(struct intel_uncore_box *box,
@@ -549,6 +561,7 @@ bool intel_generic_uncore_assign_hw_event(struct perf_event *event, · 42 unmodified lines
549561
550562 if (box->pci_dev) {
551563 box_ctl = UNCORE_DISCOVERY_PCI_BOX_CTRL(box_ctl);
564+
552565 hwc->config_base = box_ctl + uncore_pci_event_ctl(box, hwc->idx);
553566 hwc->event_base = box_ctl + uncore_pci_perf_ctr(box, hwc->idx);
554567 return true;
@@ -567,27 +580,30 @@ static inline int intel_pci_uncore_box_ctl(struct intel_uncore_box *box) · 12 unmodified lines
567580
568581 void intel_generic_uncore_pci_init_box(struct intel_uncore_box *box)
569582 {
570− struct pci_dev *pdev = box->pci_dev;
571583 int box_ctl = intel_pci_uncore_box_ctl(box);
572584
585+ if (!box_ctl)
586+ return;
587+
573588 __set_bit(UNCORE_BOX_FLAG_CTL_OFFS8, &box->flags);
574− pci_write_config_dword(pdev, box_ctl, GENERIC_PMON_BOX_CTL_INT);
589+ pci_write_config_dword(box->pci_dev, box_ctl, GENERIC_PMON_BOX_CTL_INT);
575590 }
576591
577592 void intel_generic_uncore_pci_disable_box(struct intel_uncore_box *box)
578593 {
579− struct pci_dev *pdev = box->pci_dev;
580594 int box_ctl = intel_pci_uncore_box_ctl(box);
581595
582− pci_write_config_dword(pdev, box_ctl, GENERIC_PMON_BOX_CTL_FRZ);
596+ if (box_ctl)
597+ pci_write_config_dword(box->pci_dev, box_ctl,
598+ GENERIC_PMON_BOX_CTL_FRZ);
583599 }
584600
585601 void intel_generic_uncore_pci_enable_box(struct intel_uncore_box *box)
586602 {
587− struct pci_dev *pdev = box->pci_dev;
588603 int box_ctl = intel_pci_uncore_box_ctl(box);
589604
590− pci_write_config_dword(pdev, box_ctl, 0);
605+ if (box_ctl)
606+ pci_write_config_dword(box->pci_dev, box_ctl, 0);
591607 }
592608
593609 static void intel_generic_uncore_pci_enable_event(struct intel_uncore_box *box,
arch/x86/events/intel/uncore_snb.c+0−7
@@ -563,12 +563,6 @@ void tgl_uncore_cpu_init(void) · 562 unmodified lines
563563 skl_uncore_msr_ops.init_box = rkl_uncore_msr_init_box;
564564 }
565565
566−static void adl_uncore_msr_init_box(struct intel_uncore_box *box)
567−{
568− if (box->pmu->pmu_idx == 0)
569− wrmsrq(ADL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN);
570−}
571−
572566 static void adl_uncore_msr_enable_box(struct intel_uncore_box *box)
573567 {
574568 wrmsrq(ADL_UNC_PERF_GLOBAL_CTL, SNB_UNC_GLOBAL_CTL_EN);
@@ -587,7 +581,6 @@ static void adl_uncore_msr_exit_box(struct intel_uncore_box *box) · 12 unmodified lines
587581 }
588582
589583 static struct intel_uncore_ops adl_uncore_msr_ops = {
590− .init_box = adl_uncore_msr_init_box,
591584 .enable_box = adl_uncore_msr_enable_box,
592585 .disable_box = adl_uncore_msr_disable_box,
593586 .exit_box = adl_uncore_msr_exit_box,
arch/x86/events/intel/uncore_snbep.c+12−24
@@ -3704,25 +3704,6 @@ static int skx_msr_cpu_bus_read(int cpu, u64 *topology) · 3703 unmodified lines
37043704 return 0;
37053705 }
37063706
3707−static int die_to_cpu(int die)
3708−{
3709− int res = 0, cpu, current_die;
3710− /*
3711− * Using cpus_read_lock() to ensure cpu is not going down between
3712− * looking at cpu_online_mask.
3713− */
3714− cpus_read_lock();
3715− for_each_online_cpu(cpu) {
3716− current_die = topology_logical_die_id(cpu);
3717− if (current_die == die) {
3718− res = cpu;
3719− break;
3720− }
3721− }
3722− cpus_read_unlock();
3723− return res;
3724−}
3725−
37263707 enum {
37273708 IIO_TOPOLOGY_TYPE,
37283709 UPI_TOPOLOGY_TYPE,
@@ -3791,11 +3772,17 @@ static void pmu_free_topology(struct intel_uncore_type *type) · 62 unmodified lines
37913772 static int skx_pmu_get_topology(struct intel_uncore_type *type,
37923773 int (*topology_cb)(struct intel_uncore_type*, int, int, u64))
37933774 {
3794− int die, ret = -EPERM;
3775+ int die, ret = -ENODEV;
37953776 u64 cpu_bus_msr;
3777+ int cpu;
37963778
3779+ cpus_read_lock();
37973780 for (die = 0; die < uncore_max_dies(); die++) {
3798− ret = skx_msr_cpu_bus_read(die_to_cpu(die), &cpu_bus_msr);
3781+ cpu = uncore_die_to_cpu(die);
3782+ if (cpu == -1)
3783+ continue;
3784+
3785+ ret = skx_msr_cpu_bus_read(cpu, &cpu_bus_msr);
37993786 if (ret)
38003787 break;
38013788
@@ -3807,6 +3794,7 @@ static int skx_pmu_get_topology(struct intel_uncore_type *type, · 5 unmodified lines
38073794 if (ret)
38083795 break;
38093796 }
3797+ cpus_read_unlock();
38103798
38113799 return ret;
38123800 }
@@ -4261,7 +4249,7 @@ err: · 448 unmodified lines
42614249 static int skx_upi_topology_cb(struct intel_uncore_type *type, int segment,
42624250 int die, u64 cpu_bus_msr)
42634251 {
4264− int idx, ret;
4252+ int idx, ret = 0;
42654253 struct intel_uncore_topology *upi;
42664254 unsigned int devfn;
42674255 struct pci_dev *dev = NULL;
@@ -4274,12 +4262,12 @@ static int skx_upi_topology_cb(struct intel_uncore_type *type, int segment, · 6 unmodified lines
42744262 dev = pci_get_domain_bus_and_slot(segment, bus, devfn);
42754263 if (dev) {
42764264 ret = upi_fill_topology(dev, upi, idx);
4265+ pci_dev_put(dev);
42774266 if (ret)
42784267 break;
42794268 }
42804269 }
42814270
4282− pci_dev_put(dev);
42834271 return ret;
42844272 }
42854273
@@ -5499,6 +5487,7 @@ static int discover_upi_topology(struct intel_uncore_type *type, int ubox_did, i · 1213 unmodified lines
54995487 devfn);
55005488 if (dev) {
55015489 ret = upi_fill_topology(dev, upi, idx);
5490+ pci_dev_put(dev);
55025491 if (ret)
55035492 goto err;
55045493 }
@@ -5506,7 +5495,6 @@ static int discover_upi_topology(struct intel_uncore_type *type, int ubox_did, i · 1 unmodified line
55065495 }
55075496 err:
55085497 pci_dev_put(ubox);
5509− pci_dev_put(dev);
55105498 return ret;
55115499 }
55125500
arch/x86/events/perf_event.h+4−4
@@ -322,10 +322,8 @@ struct cpu_hw_events { · 321 unmodified lines
322322 u64 fixed_ctrl_val;
323323 u64 active_fixed_ctrl_val;
324324
325− /* Intel ACR configuration */
325+ /* Intel ACR/arch-PEBS configuration */
326326 u64 acr_cfg_b[X86_PMC_IDX_MAX];
327− u64 acr_cfg_c[X86_PMC_IDX_MAX];
328− /* Cached CFG_C values */
329327 u64 cfg_c_val[X86_PMC_IDX_MAX];
330328
331329 /*
@@ -1712,7 +1710,9 @@ extern struct event_constraint intel_glp_pebs_event_constraints[]; · 1380 unmodified lines
17121710
17131711 extern struct event_constraint intel_grt_pebs_event_constraints[];
17141712
1715−extern struct event_constraint intel_arw_pebs_event_constraints[];
1713+extern struct event_constraint intel_cmt_pebs_event_constraints[];
1714+
1715+extern struct event_constraint intel_dkt_pebs_event_constraints[];
17161716
17171717 extern struct event_constraint intel_nehalem_pebs_event_constraints[];
17181718
kernel/events/core.c+29−0
@@ -58,6 +58,7 @@ · 57 unmodified lines
5858 #include <linux/percpu-rwsem.h>
5959 #include <linux/unwind_deferred.h>
6060 #include <linux/kvm_types.h>
61+#include <linux/seq_file.h>
6162
6263 #include "internal.h"
6364
@@ -7546,6 +7547,33 @@ static int perf_fasync(int fd, struct file *filp, int on) · 7482 unmodified lines
75467547 return 0;
75477548 }
75487549
7550+static void perf_show_fdinfo(struct seq_file *m, struct file *f)
7551+{
7552+ struct perf_event *event = f->private_data;
7553+ struct perf_event_context *ctx;
7554+ struct mutex *child_mutex;
7555+
7556+ ctx = perf_event_ctx_lock(event);
7557+ child_mutex = event->parent ? &event->parent->child_mutex : &event->child_mutex;
7558+ mutex_lock(child_mutex);
7559+
7560+ seq_printf(m, "perf_event_attr.type:\t%u\n", event->orig_type);
7561+ if (event->pmu)
7562+ seq_printf(m, "pmu_type:\t%u\n", event->pmu->type);
7563+ seq_printf(m, "perf_event_attr.config:\t0x%llx\n", (unsigned long long)event->attr.config);
7564+ seq_printf(m, "perf_event_attr.config1:\t0x%llx\n",
7565+ (unsigned long long)event->attr.config1);
7566+ seq_printf(m, "perf_event_attr.config2:\t0x%llx\n",
7567+ (unsigned long long)event->attr.config2);
7568+ seq_printf(m, "perf_event_attr.config3:\t0x%llx\n",
7569+ (unsigned long long)event->attr.config3);
7570+ seq_printf(m, "perf_event_attr.config4:\t0x%llx\n",
7571+ (unsigned long long)event->attr.config4);
7572+
7573+ mutex_unlock(child_mutex);
7574+ perf_event_ctx_unlock(event, ctx);
7575+}
7576+
75497577 static const struct file_operations perf_fops = {
75507578 .release = perf_release,
75517579 .read = perf_read,
@@ -7554,6 +7582,7 @@ static const struct file_operations perf_fops = { · 2 unmodified lines
75547582 .compat_ioctl = perf_compat_ioctl,
75557583 .mmap = perf_mmap,
75567584 .fasync = perf_fasync,
7585+ .show_fdinfo = perf_show_fdinfo,
75577586 };
75587587
75597588 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t