aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYoshimi Ichiyanagi <ichiyanagi.yoshimi@lab.ntt.co.jp>2006-12-29 19:49:41 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-30 13:56:44 -0500
commit09db28b8a3765a7ec35eba80420c71a7973f5a88 (patch)
tree13a43df5bceb1016dd6ad0179b9de8dacabbe145 /drivers
parenta9058ecd3cd72634cf548588ce79b3f225c9ca32 (diff)
[PATCH] KVM: Initialize kvm_arch_ops on unload
The latest version of kvm doesn't initialize kvm_arch_ops in kvm_init(), which causes an error with the following sequence. 1. Load the supported arch's module. 2. Load the unsupported arch's module. (loading error) 3. Unload the unsupported arch's module. You'll get the following error message after step 3. "BUG: unable to handle to handle kernel paging request at virtual address xxxxxxxx" The problem here is that the unsupported arch's module overwrites kvm_arch_ops of the supported arch's module at step 2. This patch initializes kvm_arch_ops upon loading architecture specific kvm module, and prevents overwriting kvm_arch_ops when kvm_arch_ops is already set correctly. Signed-off-by: Avi Kivity <avi@qumranet.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm_main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 38375e2bb703..06314071c6d2 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1865,6 +1865,11 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
1865{ 1865{
1866 int r; 1866 int r;
1867 1867
1868 if (kvm_arch_ops) {
1869 printk(KERN_ERR "kvm: already loaded the other module\n");
1870 return -EEXIST;
1871 }
1872
1868 kvm_arch_ops = ops; 1873 kvm_arch_ops = ops;
1869 1874
1870 if (!kvm_arch_ops->cpu_has_kvm_support()) { 1875 if (!kvm_arch_ops->cpu_has_kvm_support()) {
@@ -1907,6 +1912,7 @@ void kvm_exit_arch(void)
1907 unregister_reboot_notifier(&kvm_reboot_notifier); 1912 unregister_reboot_notifier(&kvm_reboot_notifier);
1908 on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1); 1913 on_each_cpu(kvm_arch_ops->hardware_disable, 0, 0, 1);
1909 kvm_arch_ops->hardware_unsetup(); 1914 kvm_arch_ops->hardware_unsetup();
1915 kvm_arch_ops = NULL;
1910} 1916}
1911 1917
1912static __init int kvm_init(void) 1918static __init int kvm_init(void)