Skip to content

Commit b372359

Browse files
committed
Merge tag 'perf-urgent-2025-04-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 perf event fixes from Ingo Molnar: "Miscellaneous fixes and a hardware-enabling change: - Fix Intel uncore PMU IIO free running counters on SPR, ICX and SNR systems - Fix Intel PEBS buffer overflow handling - Fix skid in Intel PEBS sampling of user-space general purpose registers - Enable Panther Lake PMU support - similar to Lunar Lake" * tag 'perf-urgent-2025-04-18' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/intel: Add Panther Lake support perf/x86/intel: Allow to update user space GPRs from PEBS records perf/x86/intel: Don't clear perf metrics overflow bit unconditionally perf/x86/intel/uncore: Fix the scale of IIO free running counters on SPR perf/x86/intel/uncore: Fix the scale of IIO free running counters on ICX perf/x86/intel/uncore: Fix the scale of IIO free running counters on SNR
2 parents b0c3bc3 + 7950de1 commit b372359

File tree

3 files changed

+35
-104
lines changed

3 files changed

+35
-104
lines changed

arch/x86/events/intel/core.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,6 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
30493049
struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
30503050
int bit;
30513051
int handled = 0;
3052-
u64 intel_ctrl = hybrid(cpuc->pmu, intel_ctrl);
30533052

30543053
inc_irq_stat(apic_perf_irqs);
30553054

@@ -3093,7 +3092,6 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
30933092
handled++;
30943093
x86_pmu_handle_guest_pebs(regs, &data);
30953094
static_call(x86_pmu_drain_pebs)(regs, &data);
3096-
status &= intel_ctrl | GLOBAL_STATUS_TRACE_TOPAPMI;
30973095

30983096
/*
30993097
* PMI throttle may be triggered, which stops the PEBS event.
@@ -3104,6 +3102,15 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
31043102
*/
31053103
if (pebs_enabled != cpuc->pebs_enabled)
31063104
wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
3105+
3106+
/*
3107+
* Above PEBS handler (PEBS counters snapshotting) has updated fixed
3108+
* counter 3 and perf metrics counts if they are in counter group,
3109+
* unnecessary to update again.
3110+
*/
3111+
if (cpuc->events[INTEL_PMC_IDX_FIXED_SLOTS] &&
3112+
is_pebs_counter_event_group(cpuc->events[INTEL_PMC_IDX_FIXED_SLOTS]))
3113+
status &= ~GLOBAL_STATUS_PERF_METRICS_OVF_BIT;
31073114
}
31083115

31093116
/*
@@ -3123,6 +3130,8 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
31233130
static_call(intel_pmu_update_topdown_event)(NULL, NULL);
31243131
}
31253132

3133+
status &= hybrid(cpuc->pmu, intel_ctrl);
3134+
31263135
/*
31273136
* Checkpointed counters can lead to 'spurious' PMIs because the
31283137
* rollback caused by the PMI will have cleared the overflow status
@@ -7305,8 +7314,17 @@ __init int intel_pmu_init(void)
73057314
name = "meteorlake_hybrid";
73067315
break;
73077316

7317+
case INTEL_PANTHERLAKE_L:
7318+
pr_cont("Pantherlake Hybrid events, ");
7319+
name = "pantherlake_hybrid";
7320+
goto lnl_common;
7321+
73087322
case INTEL_LUNARLAKE_M:
73097323
case INTEL_ARROWLAKE:
7324+
pr_cont("Lunarlake Hybrid events, ");
7325+
name = "lunarlake_hybrid";
7326+
7327+
lnl_common:
73107328
intel_pmu_init_hybrid(hybrid_big_small);
73117329

73127330
x86_pmu.pebs_latency_data = lnl_latency_data;
@@ -7328,8 +7346,6 @@ __init int intel_pmu_init(void)
73287346
intel_pmu_init_skt(&pmu->pmu);
73297347

73307348
intel_pmu_pebs_data_source_lnl();
7331-
pr_cont("Lunarlake Hybrid events, ");
7332-
name = "lunarlake_hybrid";
73337349
break;
73347350

73357351
case INTEL_ARROWLAKE_H:

arch/x86/events/intel/ds.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,8 +1399,10 @@ static u64 pebs_update_adaptive_cfg(struct perf_event *event)
13991399
* + precise_ip < 2 for the non event IP
14001400
* + For RTM TSX weight we need GPRs for the abort code.
14011401
*/
1402-
gprs = (sample_type & PERF_SAMPLE_REGS_INTR) &&
1403-
(attr->sample_regs_intr & PEBS_GP_REGS);
1402+
gprs = ((sample_type & PERF_SAMPLE_REGS_INTR) &&
1403+
(attr->sample_regs_intr & PEBS_GP_REGS)) ||
1404+
((sample_type & PERF_SAMPLE_REGS_USER) &&
1405+
(attr->sample_regs_user & PEBS_GP_REGS));
14041406

14051407
tsx_weight = (sample_type & PERF_SAMPLE_WEIGHT_TYPE) &&
14061408
((attr->config & INTEL_ARCH_EVENT_MASK) ==
@@ -2123,7 +2125,7 @@ static void setup_pebs_adaptive_sample_data(struct perf_event *event,
21232125
regs->flags &= ~PERF_EFLAGS_EXACT;
21242126
}
21252127

2126-
if (sample_type & PERF_SAMPLE_REGS_INTR)
2128+
if (sample_type & (PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER))
21272129
adaptive_pebs_save_regs(regs, gprs);
21282130
}
21292131

arch/x86/events/intel/uncore_snbep.c

Lines changed: 10 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4891,28 +4891,28 @@ static struct uncore_event_desc snr_uncore_iio_freerunning_events[] = {
48914891
INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"),
48924892
/* Free-Running IIO BANDWIDTH IN Counters */
48934893
INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"),
4894-
INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"),
4894+
INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.0517578125e-5"),
48954895
INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"),
48964896
INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"),
4897-
INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"),
4897+
INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.0517578125e-5"),
48984898
INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"),
48994899
INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"),
4900-
INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"),
4900+
INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.0517578125e-5"),
49014901
INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"),
49024902
INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"),
4903-
INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"),
4903+
INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.0517578125e-5"),
49044904
INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"),
49054905
INTEL_UNCORE_EVENT_DESC(bw_in_port4, "event=0xff,umask=0x24"),
4906-
INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.814697266e-6"),
4906+
INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.0517578125e-5"),
49074907
INTEL_UNCORE_EVENT_DESC(bw_in_port4.unit, "MiB"),
49084908
INTEL_UNCORE_EVENT_DESC(bw_in_port5, "event=0xff,umask=0x25"),
4909-
INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.814697266e-6"),
4909+
INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.0517578125e-5"),
49104910
INTEL_UNCORE_EVENT_DESC(bw_in_port5.unit, "MiB"),
49114911
INTEL_UNCORE_EVENT_DESC(bw_in_port6, "event=0xff,umask=0x26"),
4912-
INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.814697266e-6"),
4912+
INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.0517578125e-5"),
49134913
INTEL_UNCORE_EVENT_DESC(bw_in_port6.unit, "MiB"),
49144914
INTEL_UNCORE_EVENT_DESC(bw_in_port7, "event=0xff,umask=0x27"),
4915-
INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.814697266e-6"),
4915+
INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.0517578125e-5"),
49164916
INTEL_UNCORE_EVENT_DESC(bw_in_port7.unit, "MiB"),
49174917
{ /* end: all zeroes */ },
49184918
};
@@ -5485,45 +5485,14 @@ static struct freerunning_counters icx_iio_freerunning[] = {
54855485
[ICX_IIO_MSR_BW_IN] = { 0xaa0, 0x1, 0x10, 8, 48, icx_iio_bw_freerunning_box_offsets },
54865486
};
54875487

5488-
static struct uncore_event_desc icx_uncore_iio_freerunning_events[] = {
5489-
/* Free-Running IIO CLOCKS Counter */
5490-
INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"),
5491-
/* Free-Running IIO BANDWIDTH IN Counters */
5492-
INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"),
5493-
INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"),
5494-
INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"),
5495-
INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"),
5496-
INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"),
5497-
INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"),
5498-
INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"),
5499-
INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"),
5500-
INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"),
5501-
INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"),
5502-
INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"),
5503-
INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"),
5504-
INTEL_UNCORE_EVENT_DESC(bw_in_port4, "event=0xff,umask=0x24"),
5505-
INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.814697266e-6"),
5506-
INTEL_UNCORE_EVENT_DESC(bw_in_port4.unit, "MiB"),
5507-
INTEL_UNCORE_EVENT_DESC(bw_in_port5, "event=0xff,umask=0x25"),
5508-
INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.814697266e-6"),
5509-
INTEL_UNCORE_EVENT_DESC(bw_in_port5.unit, "MiB"),
5510-
INTEL_UNCORE_EVENT_DESC(bw_in_port6, "event=0xff,umask=0x26"),
5511-
INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.814697266e-6"),
5512-
INTEL_UNCORE_EVENT_DESC(bw_in_port6.unit, "MiB"),
5513-
INTEL_UNCORE_EVENT_DESC(bw_in_port7, "event=0xff,umask=0x27"),
5514-
INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.814697266e-6"),
5515-
INTEL_UNCORE_EVENT_DESC(bw_in_port7.unit, "MiB"),
5516-
{ /* end: all zeroes */ },
5517-
};
5518-
55195488
static struct intel_uncore_type icx_uncore_iio_free_running = {
55205489
.name = "iio_free_running",
55215490
.num_counters = 9,
55225491
.num_boxes = 6,
55235492
.num_freerunning_types = ICX_IIO_FREERUNNING_TYPE_MAX,
55245493
.freerunning = icx_iio_freerunning,
55255494
.ops = &skx_uncore_iio_freerunning_ops,
5526-
.event_descs = icx_uncore_iio_freerunning_events,
5495+
.event_descs = snr_uncore_iio_freerunning_events,
55275496
.format_group = &skx_uncore_iio_freerunning_format_group,
55285497
};
55295498

@@ -6320,69 +6289,13 @@ static struct freerunning_counters spr_iio_freerunning[] = {
63206289
[SPR_IIO_MSR_BW_OUT] = { 0x3808, 0x1, 0x10, 8, 48 },
63216290
};
63226291

6323-
static struct uncore_event_desc spr_uncore_iio_freerunning_events[] = {
6324-
/* Free-Running IIO CLOCKS Counter */
6325-
INTEL_UNCORE_EVENT_DESC(ioclk, "event=0xff,umask=0x10"),
6326-
/* Free-Running IIO BANDWIDTH IN Counters */
6327-
INTEL_UNCORE_EVENT_DESC(bw_in_port0, "event=0xff,umask=0x20"),
6328-
INTEL_UNCORE_EVENT_DESC(bw_in_port0.scale, "3.814697266e-6"),
6329-
INTEL_UNCORE_EVENT_DESC(bw_in_port0.unit, "MiB"),
6330-
INTEL_UNCORE_EVENT_DESC(bw_in_port1, "event=0xff,umask=0x21"),
6331-
INTEL_UNCORE_EVENT_DESC(bw_in_port1.scale, "3.814697266e-6"),
6332-
INTEL_UNCORE_EVENT_DESC(bw_in_port1.unit, "MiB"),
6333-
INTEL_UNCORE_EVENT_DESC(bw_in_port2, "event=0xff,umask=0x22"),
6334-
INTEL_UNCORE_EVENT_DESC(bw_in_port2.scale, "3.814697266e-6"),
6335-
INTEL_UNCORE_EVENT_DESC(bw_in_port2.unit, "MiB"),
6336-
INTEL_UNCORE_EVENT_DESC(bw_in_port3, "event=0xff,umask=0x23"),
6337-
INTEL_UNCORE_EVENT_DESC(bw_in_port3.scale, "3.814697266e-6"),
6338-
INTEL_UNCORE_EVENT_DESC(bw_in_port3.unit, "MiB"),
6339-
INTEL_UNCORE_EVENT_DESC(bw_in_port4, "event=0xff,umask=0x24"),
6340-
INTEL_UNCORE_EVENT_DESC(bw_in_port4.scale, "3.814697266e-6"),
6341-
INTEL_UNCORE_EVENT_DESC(bw_in_port4.unit, "MiB"),
6342-
INTEL_UNCORE_EVENT_DESC(bw_in_port5, "event=0xff,umask=0x25"),
6343-
INTEL_UNCORE_EVENT_DESC(bw_in_port5.scale, "3.814697266e-6"),
6344-
INTEL_UNCORE_EVENT_DESC(bw_in_port5.unit, "MiB"),
6345-
INTEL_UNCORE_EVENT_DESC(bw_in_port6, "event=0xff,umask=0x26"),
6346-
INTEL_UNCORE_EVENT_DESC(bw_in_port6.scale, "3.814697266e-6"),
6347-
INTEL_UNCORE_EVENT_DESC(bw_in_port6.unit, "MiB"),
6348-
INTEL_UNCORE_EVENT_DESC(bw_in_port7, "event=0xff,umask=0x27"),
6349-
INTEL_UNCORE_EVENT_DESC(bw_in_port7.scale, "3.814697266e-6"),
6350-
INTEL_UNCORE_EVENT_DESC(bw_in_port7.unit, "MiB"),
6351-
/* Free-Running IIO BANDWIDTH OUT Counters */
6352-
INTEL_UNCORE_EVENT_DESC(bw_out_port0, "event=0xff,umask=0x30"),
6353-
INTEL_UNCORE_EVENT_DESC(bw_out_port0.scale, "3.814697266e-6"),
6354-
INTEL_UNCORE_EVENT_DESC(bw_out_port0.unit, "MiB"),
6355-
INTEL_UNCORE_EVENT_DESC(bw_out_port1, "event=0xff,umask=0x31"),
6356-
INTEL_UNCORE_EVENT_DESC(bw_out_port1.scale, "3.814697266e-6"),
6357-
INTEL_UNCORE_EVENT_DESC(bw_out_port1.unit, "MiB"),
6358-
INTEL_UNCORE_EVENT_DESC(bw_out_port2, "event=0xff,umask=0x32"),
6359-
INTEL_UNCORE_EVENT_DESC(bw_out_port2.scale, "3.814697266e-6"),
6360-
INTEL_UNCORE_EVENT_DESC(bw_out_port2.unit, "MiB"),
6361-
INTEL_UNCORE_EVENT_DESC(bw_out_port3, "event=0xff,umask=0x33"),
6362-
INTEL_UNCORE_EVENT_DESC(bw_out_port3.scale, "3.814697266e-6"),
6363-
INTEL_UNCORE_EVENT_DESC(bw_out_port3.unit, "MiB"),
6364-
INTEL_UNCORE_EVENT_DESC(bw_out_port4, "event=0xff,umask=0x34"),
6365-
INTEL_UNCORE_EVENT_DESC(bw_out_port4.scale, "3.814697266e-6"),
6366-
INTEL_UNCORE_EVENT_DESC(bw_out_port4.unit, "MiB"),
6367-
INTEL_UNCORE_EVENT_DESC(bw_out_port5, "event=0xff,umask=0x35"),
6368-
INTEL_UNCORE_EVENT_DESC(bw_out_port5.scale, "3.814697266e-6"),
6369-
INTEL_UNCORE_EVENT_DESC(bw_out_port5.unit, "MiB"),
6370-
INTEL_UNCORE_EVENT_DESC(bw_out_port6, "event=0xff,umask=0x36"),
6371-
INTEL_UNCORE_EVENT_DESC(bw_out_port6.scale, "3.814697266e-6"),
6372-
INTEL_UNCORE_EVENT_DESC(bw_out_port6.unit, "MiB"),
6373-
INTEL_UNCORE_EVENT_DESC(bw_out_port7, "event=0xff,umask=0x37"),
6374-
INTEL_UNCORE_EVENT_DESC(bw_out_port7.scale, "3.814697266e-6"),
6375-
INTEL_UNCORE_EVENT_DESC(bw_out_port7.unit, "MiB"),
6376-
{ /* end: all zeroes */ },
6377-
};
6378-
63796292
static struct intel_uncore_type spr_uncore_iio_free_running = {
63806293
.name = "iio_free_running",
63816294
.num_counters = 17,
63826295
.num_freerunning_types = SPR_IIO_FREERUNNING_TYPE_MAX,
63836296
.freerunning = spr_iio_freerunning,
63846297
.ops = &skx_uncore_iio_freerunning_ops,
6385-
.event_descs = spr_uncore_iio_freerunning_events,
6298+
.event_descs = snr_uncore_iio_freerunning_events,
63866299
.format_group = &skx_uncore_iio_freerunning_format_group,
63876300
};
63886301

0 commit comments

Comments
 (0)