Skip to content

Commit 1ddeb0e

Browse files
committed
Merge tag 'perf-urgent-2024-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 perf fixes from Thomas Gleixner: - Move the smp_processor_id() invocation back into the non-preemtible region, so that the result is valid to use - Add the missing package C2 residency counters for Sierra Forest CPUs to make the newly added support actually useful * tag 'perf-urgent-2024-08-04' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86: Fix smp_processor_id()-in-preemptible warnings perf/x86/intel/cstate: Add pkg C2 residency counter for Sierra Forest
2 parents 953f776 + f73cefa commit 1ddeb0e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

arch/x86/events/core.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -1520,20 +1520,23 @@ static void x86_pmu_start(struct perf_event *event, int flags)
15201520
void perf_event_print_debug(void)
15211521
{
15221522
u64 ctrl, status, overflow, pmc_ctrl, pmc_count, prev_left, fixed;
1523+
unsigned long *cntr_mask, *fixed_cntr_mask;
1524+
struct event_constraint *pebs_constraints;
1525+
struct cpu_hw_events *cpuc;
15231526
u64 pebs, debugctl;
1524-
int cpu = smp_processor_id();
1525-
struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
1526-
unsigned long *cntr_mask = hybrid(cpuc->pmu, cntr_mask);
1527-
unsigned long *fixed_cntr_mask = hybrid(cpuc->pmu, fixed_cntr_mask);
1528-
struct event_constraint *pebs_constraints = hybrid(cpuc->pmu, pebs_constraints);
1529-
unsigned long flags;
1530-
int idx;
1527+
int cpu, idx;
1528+
1529+
guard(irqsave)();
1530+
1531+
cpu = smp_processor_id();
1532+
cpuc = &per_cpu(cpu_hw_events, cpu);
1533+
cntr_mask = hybrid(cpuc->pmu, cntr_mask);
1534+
fixed_cntr_mask = hybrid(cpuc->pmu, fixed_cntr_mask);
1535+
pebs_constraints = hybrid(cpuc->pmu, pebs_constraints);
15311536

15321537
if (!*(u64 *)cntr_mask)
15331538
return;
15341539

1535-
local_irq_save(flags);
1536-
15371540
if (x86_pmu.version >= 2) {
15381541
rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, ctrl);
15391542
rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, status);
@@ -1577,7 +1580,6 @@ void perf_event_print_debug(void)
15771580
pr_info("CPU#%d: fixed-PMC%d count: %016llx\n",
15781581
cpu, idx, pmc_count);
15791582
}
1580-
local_irq_restore(flags);
15811583
}
15821584

15831585
void x86_pmu_stop(struct perf_event *event, int flags)

arch/x86/events/intel/cstate.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
* perf code: 0x00
6565
* Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL,
6666
* KBL,CML,ICL,ICX,TGL,TNT,RKL,ADL,
67-
* RPL,SPR,MTL,ARL,LNL
67+
* RPL,SPR,MTL,ARL,LNL,SRF
6868
* Scope: Package (physical package)
6969
* MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter.
7070
* perf code: 0x01
@@ -693,7 +693,8 @@ static const struct cstate_model srf_cstates __initconst = {
693693
.core_events = BIT(PERF_CSTATE_CORE_C1_RES) |
694694
BIT(PERF_CSTATE_CORE_C6_RES),
695695

696-
.pkg_events = BIT(PERF_CSTATE_PKG_C6_RES),
696+
.pkg_events = BIT(PERF_CSTATE_PKG_C2_RES) |
697+
BIT(PERF_CSTATE_PKG_C6_RES),
697698

698699
.module_events = BIT(PERF_CSTATE_MODULE_C6_RES),
699700
};

0 commit comments

Comments
 (0)