]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
KVM: SVM: avoid frequency indirect calls
authorPeng Hao <flyingpeng@tencent.com>
Thu, 6 Mar 2025 07:54:25 +0000 (15:54 +0800)
committerSean Christopherson <seanjc@google.com>
Fri, 25 Apr 2025 23:19:56 +0000 (16:19 -0700)
When retpoline is enabled, indirect function calls introduce additional
performance overhead. Avoid frequent indirect calls to VMGEXIT when SEV
is enabled.

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
Link: https://lore.kernel.org/r/20250306075425.66693-1-flyingpeng@tencent.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/kvm/svm/svm.c

index 6de35274d278e2dfa2c950636f499d3f90ea9bca..dca87d9e585021f3ca55bab9c6736b07aea74acf 100644 (file)
@@ -3626,6 +3626,10 @@ int svm_invoke_exit_handler(struct kvm_vcpu *vcpu, u64 exit_code)
                return kvm_emulate_halt(vcpu);
        else if (exit_code == SVM_EXIT_NPF)
                return npf_interception(vcpu);
+#ifdef CONFIG_KVM_AMD_SEV
+       else if (exit_code == SVM_EXIT_VMGEXIT)
+               return sev_handle_vmgexit(vcpu);
+#endif
 #endif
        return svm_exit_handlers[exit_code](vcpu);
 }