Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1207460
| From | Huaitong Han <huaitong.han@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] RDMSR before test_cpu_capacity brings about KVM warning |
| Date | 2015-08-14 12:10 +0200 |
| Message-ID | <pXk5X-7mp-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
rdmsrl_safe does not lead to #GP in native kernel although CPU
does not support INTEL_PT, but if KVM does not support INTEL_PT,
the codes cannot understand MSR_IA32_RTIT_CTL, and the warning
is produced.
If KVM does not support INTEL_PT, its guest CPUID also does not.
So test_cpu_cap is added before RDMSR, and it is more in line with
the code style.
Signed-off-by: Huaitong Han <huaitong.han@intel.com>
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/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] RDMSR before test_cpu_capacity brings about KVM warning Huaitong Han <huaitong.han@intel.com> - 2015-08-14 12:10 +0200
Re: [PATCH] RDMSR before test_cpu_capacity brings about KVM warning Alexander Shishkin <alexander.shishkin@linux.intel.com> - 2015-08-17 14:10 +0200
Re: [PATCH] RDMSR before test_cpu_capacity brings about KVM warning "Han, Huaitong" <huaitong.han@intel.com> - 2015-08-17 15:30 +0200
csiph-web