Unlike IA32_PERF_GLOBAL_CTRL, hardware does not filter GLOBAL_INUSE reads based on the PerfMon mask at all, so always intercept this MSR and filter out host-owned bits in KVM. Signed-off-by: Zide Chen --- arch/x86/kvm/vmx/vmx.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index a241efb99b3d..2bd1ffe65510 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4339,8 +4339,15 @@ static void vmx_recalc_pmu_msr_intercepts(struct kvm_vcpu *vcpu) MSR_TYPE_RW, intercept); vmx_set_intercept_for_msr(vcpu, MSR_CORE_PERF_GLOBAL_STATUS_SET, MSR_TYPE_RW, intercept || pmu->version < 4); + + /* + * IA32_PERF_GLOBAL_INUSE reads are not subject to PerfMon mask + * filtering. + */ vmx_set_intercept_for_msr(vcpu, MSR_CORE_PERF_GLOBAL_INUSE, - MSR_TYPE_RW, intercept || pmu->version < 4); + MSR_TYPE_RW, + intercept || kvm_vcpu_has_perfmon_mask(vcpu) || + pmu->version < 4); intercept = !has_mediated_pmu || !kvm_vcpu_has_perf_metrics(vcpu); vmx_set_intercept_for_msr(vcpu, MSR_PERF_METRICS, -- 2.55.0