diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2022-03-25 17:42:52 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2022-04-02 11:34:38 +0200 |
commit | a1a39128faabc9883a7f9e3f8777b3fbd560fa5f (patch) | |
tree | 78a135733742d3f12bd3b2927b25d52683adcda0 /arch/x86/kvm/x86.c | |
parent | KVM: x86: Forbid VMM to set SYNIC/STIMER MSRs when SynIC wasn't activated (diff) | |
download | linux-a1a39128faabc9883a7f9e3f8777b3fbd560fa5f.tar.xz linux-a1a39128faabc9883a7f9e3f8777b3fbd560fa5f.zip |
KVM: MMU: propagate alloc_workqueue failure
If kvm->arch.tdp_mmu_zap_wq cannot be created, the failure has
to be propagated up to kvm_mmu_init_vm and kvm_arch_init_vm.
kvm_arch_init_vm also has to undo all the initialization, so
group all the MMU initialization code at the beginning and
handle cleaning up of kvm_page_track_init.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | arch/x86/kvm/x86.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index fe2171b11441..89b6efb7f504 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11629,12 +11629,13 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) ret = kvm_page_track_init(kvm); if (ret) - return ret; + goto out; + + ret = kvm_mmu_init_vm(kvm); + if (ret) + goto out_page_track; INIT_HLIST_HEAD(&kvm->arch.mask_notifier_list); - INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); - INIT_LIST_HEAD(&kvm->arch.zapped_obsolete_pages); - INIT_LIST_HEAD(&kvm->arch.lpage_disallowed_mmu_pages); INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); atomic_set(&kvm->arch.noncoherent_dma_count, 0); @@ -11666,10 +11667,14 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) kvm_apicv_init(kvm); kvm_hv_init_vm(kvm); - kvm_mmu_init_vm(kvm); kvm_xen_init_vm(kvm); return static_call(kvm_x86_vm_init)(kvm); + +out_page_track: + kvm_page_track_cleanup(kvm); +out: + return ret; } int kvm_arch_post_init_vm(struct kvm *kvm) |