aboutsummaryrefslogtreecommitdiff
path: root/arch/x86/kvm/vmx/pmu_intel.c
diff options
context:
space:
mode:
authorGravatar Sean Christopherson <seanjc@google.com> 2024-03-06 17:13:42 -0800
committerGravatar Sean Christopherson <seanjc@google.com> 2024-04-11 12:58:46 -0700
commit447112d7edd77fa468938377418434233bcb3709 (patch)
treea09c7abb357f62c358ce77af2fd47f200affb6de /arch/x86/kvm/vmx/pmu_intel.c
parentKVM: VMX: Ignore MKTME KeyID bits when intercepting #PF for allow_smaller_max... (diff)
downloadlinux-447112d7edd77fa468938377418434233bcb3709.tar.gz
linux-447112d7edd77fa468938377418434233bcb3709.tar.bz2
linux-447112d7edd77fa468938377418434233bcb3709.zip
KVM: VMX: Snapshot LBR capabilities during module initialization
Snapshot VMX's LBR capabilities once during module initialization instead of calling into perf every time a vCPU reconfigures its vPMU. This will allow massaging the LBR capabilities, e.g. if the CPU doesn't support callstacks, without having to remember to update multiple locations. Opportunistically tag vmx_get_perf_capabilities() with __init, as it's only called from vmx_set_cpu_caps(). Reviewed-by: Mingwei Zhang <mizhang@google.com> Link: https://lore.kernel.org/r/20240307011344.835640-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'arch/x86/kvm/vmx/pmu_intel.c')
-rw-r--r--arch/x86/kvm/vmx/pmu_intel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c
index 12ade343a17e..be40474de6e4 100644
--- a/arch/x86/kvm/vmx/pmu_intel.c
+++ b/arch/x86/kvm/vmx/pmu_intel.c
@@ -535,7 +535,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu)
perf_capabilities = vcpu_get_perf_capabilities(vcpu);
if (cpuid_model_is_consistent(vcpu) &&
(perf_capabilities & PMU_CAP_LBR_FMT))
- x86_perf_get_lbr(&lbr_desc->records);
+ memcpy(&lbr_desc->records, &vmx_lbr_caps, sizeof(vmx_lbr_caps));
else
lbr_desc->records.nr = 0;