From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755348AbbIMLKf (ORCPT ); Sun, 13 Sep 2015 07:10:35 -0400 Received: from terminus.zytor.com ([198.137.202.10]:43855 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752346AbbIMLKc (ORCPT ); Sun, 13 Sep 2015 07:10:32 -0400 Date: Sun, 13 Sep 2015 04:09:52 -0700 From: tip-bot for Huaitong Han Message-ID: Cc: vincent.weaver@maine.edu, hpa@zytor.com, jolsa@redhat.com, peterz@infradead.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org, alexander.shishkin@linux.intel.com, huaitong.han@intel.com, eranian@google.com, acme@redhat.com, torvalds@linux-foundation.org Reply-To: eranian@google.com, torvalds@linux-foundation.org, acme@redhat.com, huaitong.han@intel.com, alexander.shishkin@linux.intel.com, mingo@kernel.org, tglx@linutronix.de, linux-kernel@vger.kernel.org, peterz@infradead.org, jolsa@redhat.com, hpa@zytor.com, vincent.weaver@maine.edu In-Reply-To: <1441009262-9792-1-git-send-email-huaitong.han@intel.com> References: <1441009262-9792-1-git-send-email-huaitong.han@intel.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86/intel/pt: Fix KVM warning due to doing rdmsr() before the CPUID test Git-Commit-ID: 73fdeb66592ee80dffb16fb8a9b7378a00c1a826 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 73fdeb66592ee80dffb16fb8a9b7378a00c1a826 Gitweb: http://git.kernel.org/tip/73fdeb66592ee80dffb16fb8a9b7378a00c1a826 Author: Huaitong Han AuthorDate: Mon, 31 Aug 2015 16:21:02 +0800 Committer: Ingo Molnar CommitDate: Sun, 13 Sep 2015 11:27:23 +0200 perf/x86/intel/pt: Fix KVM warning due to doing rdmsr() before the CPUID test If KVM does not support INTEL_PT, guest MSR_IA32_RTIT_CTL reading will produce host warning like "kvm [2469]: vcpu0 unhandled rdmsr: 0x570". Guest can determine whether the CPU supports Intel_PT according to CPUID, so test_cpu_cap function is added before rdmsr,and it is more in line with the code style. Signed-off-by: Huaitong Han Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Alexander Shishkin Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: acme@kernel.org Link: http://lkml.kernel.org/r/1441009262-9792-1-git-send-email-huaitong.han@intel.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/cpu/perf_event_intel_pt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c index 4216928..868e119 100644 --- a/arch/x86/kernel/cpu/perf_event_intel_pt.c +++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c @@ -139,9 +139,6 @@ static int __init pt_pmu_hw_init(void) long i; attrs = NULL; - ret = -ENODEV; - if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT)) - goto fail; for (i = 0; i < PT_CPUID_LEAVES; i++) { cpuid_count(20, i, @@ -1130,6 +1127,10 @@ static __init int pt_init(void) int ret, cpu, prior_warn = 0; BUILD_BUG_ON(sizeof(struct topa) > PAGE_SIZE); + + if (!test_cpu_cap(&boot_cpu_data, X86_FEATURE_INTEL_PT)) + return -ENODEV; + get_online_cpus(); for_each_online_cpu(cpu) { u64 ctl;