Skip to content

Commit 05276d4

Browse files
Tero KristoPeter Zijlstra
authored andcommitted
perf/x86/cstate: Allow reading the package statistics from local CPU
The MSR registers for reading the package residency counters are available on every CPU of the package. To avoid doing unnecessary SMP calls to read the values for these from the various CPUs inside a package, allow reading them from any CPU of the package. Suggested-by: Kan Liang <kan.liang@intel.com> Signed-off-by: Tero Kristo <tero.kristo@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/20230912124432.3616761-2-tero.kristo@linux.intel.com
1 parent 38cd5b6 commit 05276d4

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

arch/x86/events/intel/cstate.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ static int cstate_pmu_event_init(struct perf_event *event)
336336
cfg = array_index_nospec((unsigned long)cfg, PERF_CSTATE_PKG_EVENT_MAX);
337337
if (!(pkg_msr_mask & (1 << cfg)))
338338
return -EINVAL;
339+
340+
event->event_caps |= PERF_EV_CAP_READ_ACTIVE_PKG;
341+
339342
event->hw.event_base = pkg_msr[cfg].msr;
340343
cpu = cpumask_any_and(&cstate_pkg_cpu_mask,
341344
topology_die_cpumask(event->cpu));

0 commit comments

Comments
 (0)