KVM: x86/pmu: Rewrite reprogram_counters() to improve performance
authorLike Xu <likexu@tencent.com>
Tue, 14 Feb 2023 05:07:48 +0000 (13:07 +0800)
committerSean Christopherson <seanjc@google.com>
Thu, 6 Apr 2023 23:04:31 +0000 (16:04 -0700)
commit649bccd7fac98225525c79cf4b1cecc4bafdfc54
tree0b4f2106e08187685229d0c731120768c73767c7
parent8bca8c5ce40b03862d782b9991da146909199327
KVM: x86/pmu: Rewrite reprogram_counters() to improve performance

A valid pmc is always tested before using pmu->reprogram_pmi. Eliminate
this part of the redundancy by setting the counter's bitmask directly,
and in addition, trigger KVM_REQ_PMU only once to save more cpu cycles.

Signed-off-by: Like Xu <likexu@tencent.com>
Link: https://lore.kernel.org/r/20230214050757.9623-4-likexu@tencent.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/vmx/pmu_intel.c