]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
x86/vPMU: don't blindly assume IA32_PERF_CAPABILITIES MSR exists
authorJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2020 16:35:48 +0000 (17:35 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 26 Feb 2020 16:35:48 +0000 (17:35 +0100)
Just like VMX'es lbr_tsx_fixup_check() the respective CPUID bit should
be consulted first.

Reported-by: Farrah Chen <farrah.chen@intel.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/cpu/vpmu_intel.c

index 6e27f6ec8ed7ecc900baccb89926cca07a90732c..75aa11c6adeca44e139d8eaeaf5da597e2596b6f 100644 (file)
@@ -900,7 +900,6 @@ int vmx_vpmu_initialise(struct vcpu *v)
 
 int __init core2_vpmu_init(void)
 {
-    u64 caps;
     unsigned int version = 0;
     unsigned int i;
 
@@ -932,8 +931,14 @@ int __init core2_vpmu_init(void)
 
     arch_pmc_cnt = core2_get_arch_pmc_count();
     fixed_pmc_cnt = core2_get_fixed_pmc_count();
-    rdmsrl(MSR_IA32_PERF_CAPABILITIES, caps);
-    full_width_write = (caps >> 13) & 1;
+
+    if ( cpu_has_pdcm )
+    {
+        uint64_t caps;
+
+        rdmsrl(MSR_IA32_PERF_CAPABILITIES, caps);
+        full_width_write = (caps >> 13) & 1;
+    }
 
     fixed_ctrl_mask = ~((1ull << (fixed_pmc_cnt * FIXED_CTR_CTRL_BITS)) - 1);
     /* mask .AnyThread bits for all fixed counters */