Skip to content

Commit

Permalink
KVM: Initialize the mmu caches only after verifying cpu support
Browse files Browse the repository at this point in the history
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: Avi Kivity <avi@qumranet.com>
  • Loading branch information
Avi Kivity committed Jan 30, 2008
1 parent 75e68e6 commit 97db56c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions arch/x86/kvm/x86.c
Original file line number Diff line number Diff line change
Expand Up @@ -2187,12 +2187,6 @@ int kvm_arch_init(void *opaque)
int r;
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) {
printk(KERN_ERR "kvm: already loaded the other module\n");
r = -EEXIST;
Expand All @@ -2210,13 +2204,17 @@ int kvm_arch_init(void *opaque)
goto out;
}

r = kvm_mmu_module_init();
if (r)
goto out;

kvm_init_msr_list();

kvm_x86_ops = ops;
kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
return 0;

out:
kvm_mmu_module_exit();
out_fail:
return r;
}

Expand Down

0 comments on commit 97db56c

Please sign in to comment.