From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: linux 3.13 guest crash with -cpu host Date: Mon, 3 Feb 2014 14:29:03 +0100 Message-ID: <20140203132903.GI8874@twins.programming.kicks-ass.net> References: <20140202205930.GA2157@redhat.com> <20140203125828.GH2221@otherpad.lan.raisama.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, pbonzini@redhat.com To: Eduardo Habkost Return-path: Received: from merlin.infradead.org ([205.233.59.134]:45501 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750967AbaBCN3H (ORCPT ); Mon, 3 Feb 2014 08:29:07 -0500 Content-Disposition: inline In-Reply-To: <20140203125828.GH2221@otherpad.lan.raisama.net> Sender: kvm-owner@vger.kernel.org List-ID: 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);