diff options
author | Peter Zijlstra <peterz@infradead.org> | 2014-02-03 14:29:03 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-02-21 22:09:01 +0100 |
commit | c9b08884c9c98929ec2d8abafd78e89062d01ee7 (patch) | |
tree | d7e9cd28d499baa17f6f33d9493a91d62e1f217d /arch | |
parent | a3ef2229c94ff70998724cb64b9cb4c77db9e950 (diff) | |
download | linux-c9b08884c9c98929ec2d8abafd78e89062d01ee7.tar.gz linux-c9b08884c9c98929ec2d8abafd78e89062d01ee7.tar.bz2 linux-c9b08884c9c98929ec2d8abafd78e89062d01ee7.zip |
perf/x86: Correctly use FEATURE_PDCM
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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/perf_event_intel.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c index 698ae77d6f18..aa333d966886 100644 --- a/arch/x86/kernel/cpu/perf_event_intel.c +++ b/arch/x86/kernel/cpu/perf_event_intel.c @@ -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); |