[PATCH 2/2] KVM: SVM: Drop unnecessary avic_vm_destroy() call on init failure
From: Sean Christopherson
Date: Thu Jun 25 2026 - 18:13:40 EST
Don't bother calling avic_vm_destroy() when allocating the logical ID table
fails, as there is nothing to clean up now that the physical ID table is
allocated later, on-demand at first vCPU creation.
For all intents and purposes, no functional change intended, as calling
avic_vm_destroy() is a big nop in this case.
Fixes: 54ffe74cc4ab ("KVM: SVM: Move AVIC Physical ID table allocation to vcpu_precreate()")
Cc: Naveen N Rao (AMD) <naveen@xxxxxxxxxx>
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/svm/avic.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index 6b100fb014a6..cd1761744e1d 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -336,7 +336,6 @@ void avic_vm_destroy(struct kvm *kvm)
int avic_vm_init(struct kvm *kvm)
{
unsigned long flags;
- int err = -ENOMEM;
struct kvm_svm *kvm_svm = to_kvm_svm(kvm);
struct kvm_svm *k2;
u32 vm_id;
@@ -346,7 +345,7 @@ int avic_vm_init(struct kvm *kvm)
kvm_svm->avic_logical_id_table = (void *)get_zeroed_page(GFP_KERNEL_ACCOUNT);
if (!kvm_svm->avic_logical_id_table)
- goto free_avic;
+ return -ENOMEM;
spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
again:
@@ -367,10 +366,6 @@ int avic_vm_init(struct kvm *kvm)
spin_unlock_irqrestore(&svm_vm_data_hash_lock, flags);
return 0;
-
-free_avic:
- avic_vm_destroy(kvm);
- return err;
}
static phys_addr_t avic_get_backing_page_address(struct vcpu_svm *svm)
--
2.55.0.rc0.799.gd6f94ed593-goog