public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: linux 3.13 guest crash with -cpu host
Date: Mon, 3 Feb 2014 14:29:03 +0100	[thread overview]
Message-ID: <20140203132903.GI8874@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140203125828.GH2221@otherpad.lan.raisama.net>

On Mon, Feb 03, 2014 at 10:58:28AM -0200, Eduardo Habkost wrote:
> Linux seems to be trying to read IA32_PERF_CAPABILITIES without checking the
> PDCM flag (CPUID[1].ECX[15]).
> 
> I can't see why this wasn't crashing before, though. That code seems to be old.
> 
> 	 * v2 and above have a perf capabilities MSR
> 	 */
> 	if (version > 1) {
> 		u64 capabilities;
> 
> 		rdmsrl(MSR_IA32_PERF_CAPABILITIES, capabilities);
> 		x86_pmu.intel_cap.capabilities = capabilities;
> 	}
> 
> Where does the "v2 and above have a perf capabilities MSR" claim in the code
> come from?

Dunno, I'm pretty sure I wrote that code but I've no idea, other than
that's what actual hardware does.

I suppose the below would be correct.

diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 0fa4f242f050..9407f61cdc1c 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -2310,10 +2310,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);

  reply	other threads:[~2014-02-03 13:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02 20:59 linux 3.13 guest crash with -cpu host Michael S. Tsirkin
2014-02-03 12:58 ` Eduardo Habkost
2014-02-03 13:29   ` Peter Zijlstra [this message]
2014-02-03 14:06   ` Michael S. Tsirkin
2014-02-03 14:07     ` Paolo Bonzini
2014-02-03 14:42       ` Michael S. Tsirkin
2014-02-03 14:12     ` Peter Zijlstra
2014-02-03 14:19       ` Paolo Bonzini
2014-02-03 14:26         ` Peter Zijlstra
2014-02-03 14:28           ` Peter Zijlstra
2014-02-03 15:01             ` Paolo Bonzini
2014-02-03 14:45           ` Michael S. Tsirkin

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=20140203132903.GI8874@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    /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