]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Use static calls to reduce kvm_pmu_ops overhead
authorLike Xu <likexu@tencent.com>
Tue, 29 Mar 2022 23:50:54 +0000 (23:50 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 13 Apr 2022 17:37:45 +0000 (13:37 -0400)
commit31a63ad5e088071b6328f9e622b46c9947f831c2
treec015e1b55f22311ab59645010b56c5bc42d5ce9f
parent10a692da449211a9c44f75d2542ee9eccc86be01
KVM: x86: Use static calls to reduce kvm_pmu_ops overhead

Use static calls to improve kvm_pmu_ops performance, following the same
pattern and naming scheme used by kvm-x86-ops.h.

Here are the worst fenced_rdtsc() cycles numbers for the kvm_pmu_ops
functions that is most often called (up to 7 digits of calls) when running
a single perf test case in a guest on an ICX 2.70GHz host (mitigations=on):

| legacy | static call
------------------------------------------------------------
.pmc_idx_to_pmc | 1304840 | 994872 (+23%)
.pmc_is_enabled | 978670 | 1011750 (-3%)
.msr_idx_to_pmc | 47828 | 41690 (+12%)
.is_valid_msr | 28786 | 30108 (-4%)

Signed-off-by: Like Xu <likexu@tencent.com>
[sean: Handle static call updates in pmu.c, tweak changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20220329235054.3534728-5-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/include/asm/kvm-x86-pmu-ops.h [new file with mode: 0644]
arch/x86/kvm/pmu.c