Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1209002 > unrolled thread

[V2] rdmsr before the CPUID test produces KVM warning

Started byHuaitong Han <huaitong.han@intel.com>
First post2015-08-18 04:20 +0200
Last post2015-08-18 04:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [V2] rdmsr before the CPUID test produces KVM warning Huaitong Han <huaitong.han@intel.com> - 2015-08-18 04:20 +0200

#1209002 — [V2] rdmsr before the CPUID test produces KVM warning

FromHuaitong Han <huaitong.han@intel.com>
Date2015-08-18 04:20 +0200
Subject[V2] rdmsr before the CPUID test produces KVM warning
Message-ID<pYEFk-Q2-3@gated-at.bofh.it>
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 <huaitong.han@intel.com>
Reviewed-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>

--
ChangeLog:
V2:Update commit message.
--

diff --git a/arch/x86/kernel/cpu/perf_event_intel_pt.c b/arch/x86/kernel/cpu/perf_event_intel_pt.c
index 183de71..4cc6492 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_pt.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_pt.c
@@ -123,9 +123,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,
@@ -1061,6 +1058,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;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web