From patchwork Mon Feb 3 13:29:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 3569351 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 49EF59F2F5 for ; Mon, 3 Feb 2014 13:29:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 390A420176 for ; Mon, 3 Feb 2014 13:29:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DB5220160 for ; Mon, 3 Feb 2014 13:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751072AbaBCN3I (ORCPT ); Mon, 3 Feb 2014 08:29:08 -0500 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 Received: from dhcp-077-248-225-117.chello.nl ([77.248.225.117] helo=twins) by merlin.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1WAJaE-0000UC-C3; Mon, 03 Feb 2014 13:29:06 +0000 Received: by twins (Postfix, from userid 1000) id 41B9580049F1; Mon, 3 Feb 2014 14:29:03 +0100 (CET) Date: Mon, 3 Feb 2014 14:29:03 +0100 From: Peter Zijlstra To: Eduardo Habkost Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, pbonzini@redhat.com Subject: Re: linux 3.13 guest crash with -cpu host 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-Disposition: inline In-Reply-To: <20140203125828.GH2221@otherpad.lan.raisama.net> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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. --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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);