perf/x86/intel/pt: rdmsr before the CPUID test produces KVM warning
Subsystems (2)
PATCH 1/1 perf/x86/intel/pt: rdmsr before the CPUID test produces KVM warning
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.
arch/x86/kernel/cpu/perf_event_intel_pt.c +4 -3
@@ -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;
Signature · 1 line
2.4.3
tip-bot for Huaitong Han
merge bot[tip:perf/core] perf/x86/intel/pt: Fix KVM warning due to doing rdmsr() before the CPUID test
perf/x86/intel/pt: Fix KVM warning due to doing rdmsr() before the CPUID test
Commit-ID: 73fdeb66592ee80dffb16fb8a9b7378a00c1a826 Gitweb: http://git.kernel.org/tip/73fdeb66592ee80dffb16fb8a9b7378a00c1a826 Author: Huaitong Han <[email protected]> AuthorDate: Mon, 31 Aug 2015 16:21:02 +0800 Committer: Ingo Molnar <[email protected]> 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.
--- arch/x86/kernel/cpu/perf_event_intel_pt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_pt.c +4 -3
@@ -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;