From: David Ahern <dsahern@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>,
Stephane Eranian <eranian@google.com>,
LKML <linux-kernel@vger.kernel.org>
Cc: Gleb Natapov <gleb@redhat.com>, Avi Kivity <avi@redhat.com>
Subject: perf, x86: only do lbr init if bts is available
Date: Thu, 24 May 2012 10:19:50 -0600 [thread overview]
Message-ID: <4FBE5FA6.5050802@gmail.com> (raw)
KVM recently added support for a version 2 PMU. When passing -cpu host
as the CPU model for the guest we get an abnormal configuration from
perf's perspective in that the guest identifies the processor as a
Westmere or Nehalem (etc):
[ 0.013998] Performance Events: Westmere events, Intel PMU driver.
but yet the processor does not have the debug store mechanisms
(X86_FEATURE_DTES64 is not set) meaning there is no PEBS or BTS.
Right now the LBR init functions are run based on processor model which
leads to attempts to write to LBR MSRs generating messages like:
[ 1170.125605] kvm: 6873: cpu0 unhandled rdmsr: 0x345
[ 1170.135354] kvm_set_msr_common: 54 callbacks suppressed
[ 1170.135612] kvm: 6873: cpu0 unhandled wrmsr: 0x680 data 0
[ 1170.135900] kvm: 6873: cpu0 unhandled wrmsr: 0x6c0 data 0
[ 1170.136163] kvm: 6873: cpu0 unhandled wrmsr: 0x681 data 0
[ 1170.136437] kvm: 6873: cpu0 unhandled wrmsr: 0x6c1 data 0
[ 1170.136703] kvm: 6873: cpu0 unhandled wrmsr: 0x682 data 0
[ 1170.136968] kvm: 6873: cpu0 unhandled wrmsr: 0x6c2 data 0
[ 1170.137227] kvm: 6873: cpu0 unhandled wrmsr: 0x683 data 0
[ 1170.137502] kvm: 6873: cpu0 unhandled wrmsr: 0x6c3 data 0
[ 1170.137797] kvm: 6873: cpu0 unhandled wrmsr: 0x684 data 0
[ 1170.138061] kvm: 6873: cpu0 unhandled wrmsr: 0x6c4 data 0
MSR 0x345 is MSR_IA32_PERF_CAPABILITIES; the 0x6XX MSRs are LBR from/to.
Question: is something like this acceptable/make sense -- to only setup
lbr values if the BTS is detected?
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c
b/arch/x86/kernel/cpu/perf_event_intel.c
index 166546e..7ba4afa 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1783,7 +1784,8 @@ __init int intel_pmu_init(void)
memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs,
sizeof(hw_cache_extra_regs));
- intel_pmu_lbr_init_nhm();
+ if (x86_pmu.bts)
+ intel_pmu_lbr_init_nhm();
x86_pmu.event_constraints = intel_nehalem_event_constraints;
x86_pmu.pebs_constraints = intel_nehalem_pebs_event_constraints;
David
next reply other threads:[~2012-05-24 16:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-24 16:19 David Ahern [this message]
2012-05-24 16:35 ` perf, x86: only do lbr init if bts is available Stephane Eranian
2012-05-24 16:41 ` David Ahern
2012-05-24 17:07 ` David Ahern
2012-05-24 17:11 ` Stephane Eranian
2012-05-25 22:49 ` Andi Kleen
2012-05-24 17:18 ` Peter Zijlstra
2012-05-24 17:21 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FBE5FA6.5050802@gmail.com \
--to=dsahern@gmail.com \
--cc=avi@redhat.com \
--cc=eranian@google.com \
--cc=gleb@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox