blob: b2574118fea1155becabc7088ae976c9a93bebe6 [file] [log] [blame]
From cfb08af8205a61e43e6778e5314d656ff01491f4 Mon Sep 17 00:00:00 2001
From: Sean Christopherson <>
Date: Wed, 18 Dec 2019 13:55:05 -0800
Subject: [PATCH] KVM: x86: Remove spurious kvm_mmu_unload() from vcpu
destruction path
commit 9d979c7e6ff43ca3200ffcb74f57415fd633a2da upstream.
x86 does not load its MMU until KVM_RUN, which cannot be invoked until
after vCPU creation succeeds. Given that kvm_arch_vcpu_destroy() is
called if and only if vCPU creation fails, it is impossible for the MMU
to be loaded.
Note, the bogus kvm_mmu_unload() call was added during an unrelated
refactoring of vCPU allocation, i.e. was presumably added as an
opportunstic "fix" for a perceived leak.
Fixes: fb3f0f51d92d1 ("KVM: Dynamically allocate vcpus")
Signed-off-by: Sean Christopherson <>
Signed-off-by: Paolo Bonzini <>
Signed-off-by: Paul Gortmaker <>
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9273af4e36a4..1ad21dead494 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9027,10 +9027,6 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
vcpu->arch.apf.msr_val = 0;
- vcpu_load(vcpu);
- kvm_mmu_unload(vcpu);
- vcpu_put(vcpu);