Skip to content

Commit

Permalink
KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesn't support g…
Browse files Browse the repository at this point in the history
…lobal_ctrl

[ Upstream commit 98defd2 ]

MSR_CORE_PERF_GLOBAL_CTRL is introduced as part of Architecture PMU V2,
as indicated by Intel SDM 19.2.2 and the intel_is_valid_msr() function.

So in the absence of global_ctrl support, all PMCs are enabled as AMD does.

Signed-off-by: Like Xu <likexu@tencent.com>
Message-Id: <20220509102204.62389-1-likexu@tencent.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Like Xu authored and gregkh committed Aug 17, 2022
1 parent 9f1a172 commit 1eedac0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions arch/x86/kvm/vmx/pmu_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc)
{
struct kvm_pmu *pmu = pmc_to_pmu(pmc);

if (pmu->version < 2)
return true;

return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl);
}

Expand Down

0 comments on commit 1eedac0

Please sign in to comment.