Commit 97db56ce authored by Avi Kivity's avatar Avi Kivity

KVM: Initialize the mmu caches only after verifying cpu support

Otherwise we re-initialize the mmu caches, which will fail since the
caches are already registered, which will cause us to deinitialize said caches.
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 75e68e60
...@@ -2187,12 +2187,6 @@ int kvm_arch_init(void *opaque) ...@@ -2187,12 +2187,6 @@ int kvm_arch_init(void *opaque)
int r; int r;
struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque; struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
r = kvm_mmu_module_init();
if (r)
goto out_fail;
kvm_init_msr_list();
if (kvm_x86_ops) { if (kvm_x86_ops) {
printk(KERN_ERR "kvm: already loaded the other module\n"); printk(KERN_ERR "kvm: already loaded the other module\n");
r = -EEXIST; r = -EEXIST;
...@@ -2210,13 +2204,17 @@ int kvm_arch_init(void *opaque) ...@@ -2210,13 +2204,17 @@ int kvm_arch_init(void *opaque)
goto out; goto out;
} }
r = kvm_mmu_module_init();
if (r)
goto out;
kvm_init_msr_list();
kvm_x86_ops = ops; kvm_x86_ops = ops;
kvm_mmu_set_nonpresent_ptes(0ull, 0ull); kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
return 0; return 0;
out: out:
kvm_mmu_module_exit();
out_fail:
return r; return r;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment