Skip to content

Commit 46c4937

Browse files
committed
KVM: x86: move vm_destroy callback at end of kvm_arch_destroy_vm
TDX needs to free the TDR control structures last, after all paging structures have been torn down; move the vm_destroy callback at a suitable place. The new place is also okay for AMD; the main difference is that the MMU has been torn down and, if anything, that is better done before the SNP ASID is released. Extracted from a patch by Yan Zhao. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent ea9bd29 commit 46c4937

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12880,7 +12880,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
1288012880
}
1288112881
kvm_unload_vcpu_mmus(kvm);
1288212882
kvm_destroy_vcpus(kvm);
12883-
kvm_x86_call(vm_destroy)(kvm);
1288412883
kvm_free_msr_filter(srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1));
1288512884
kvm_pic_destroy(kvm);
1288612885
kvm_ioapic_destroy(kvm);
@@ -12890,6 +12889,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
1289012889
kvm_page_track_cleanup(kvm);
1289112890
kvm_xen_destroy_vm(kvm);
1289212891
kvm_hv_destroy_vm(kvm);
12892+
kvm_x86_call(vm_destroy)(kvm);
1289312893
}
1289412894

1289512895
static void memslot_rmap_free(struct kvm_memory_slot *slot)

0 commit comments

Comments
 (0)