Skip to content

Commit

Permalink
perf/x86: Correctly use FEATURE_PDCM
Browse files Browse the repository at this point in the history
The current code simply assumes Intel Arch PerfMon v2+ to have
the IA32_PERF_CAPABILITIES MSR; the SDM specifies that we should check
CPUID[1].ECX[15] (aka, FEATURE_PDCM) instead.

This was found by KVM which implements v2+ but didn't provide the
capabilities MSR. Change the code to DTRT; KVM will also implement the
MSR and return 0.

Cc: pbonzini@redhat.com
Reported-by: "Michael S. Tsirkin" <mst@redhat.com>
Suggested-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140203132903.GI8874@twins.programming.kicks-ass.net
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Peter Zijlstra authored and Thomas Gleixner committed Feb 21, 2014
1 parent a3ef222 commit c9b0888
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions arch/x86/kernel/cpu/perf_event_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2308,10 +2308,7 @@ __init int intel_pmu_init(void)
if (version > 1)
x86_pmu.num_counters_fixed = max((int)edx.split.num_counters_fixed, 3);

/*
* v2 and above have a perf capabilities MSR
*/
if (version > 1) {
if (boot_cpu_has(X86_FEATURE_PDCM)) {
u64 capabilities;

rdmsrl(MSR_IA32_PERF_CAPABILITIES, capabilities);
Expand Down

0 comments on commit c9b0888

Please sign in to comment.