From: Peng Hao Date: Thu, 6 Mar 2025 07:54:25 +0000 (+0800) Subject: KVM: SVM: avoid frequency indirect calls X-Git-Tag: v6.16-rc1~78^2~4^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb5081f4abf2d91ae3ed22d7d1157c91d23db5ed;p=thirdparty%2Fkernel%2Flinux.git KVM: SVM: avoid frequency indirect calls 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 Link: https://lore.kernel.org/r/20250306075425.66693-1-flyingpeng@tencent.com Signed-off-by: Sean Christopherson --- diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 6de35274d278e..dca87d9e58502 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -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); }