logo       

Re: [PATCH] kvm: initialize kvm_arch_ops in kvm_init(): msg#00253

emulators.kvm.devel

Subject: Re: [PATCH] kvm: initialize kvm_arch_ops in kvm_init()


>> static __init int kvm_init(void)
>> @@ -1914,6 +1920,7 @@ static __init int kvm_init(void)
>> static struct page *bad_page;
>> int r = 0;
>>
>> + kvm_arch_ops = NULL;
>> kvm_init_debug();
>>
>> kvm_init_msr_list();
>>
>>
>
>This bit is unnecessary, no? I think kvm_init() will only be called
>after the module is loaded, at which point kvm_arch_ops is initialized
>from the .bss section.
>

Logically it's not required, however it's better to initialize
explicitly in general.


By the way, the previous patch didn't fix the problem completely.
You can't load the supported arch's module
if you load the unsupported arch's module beforehand.

The following patch will fix this problem.
Please take a look.

Signed-off-by: Yoshimi Ichiyanagi <ichiyanagi.yoshimi@xxxxxxxxxxxxx>

Index: kvm_main.c
===================================================================
--- kvm_main.c (revision 4190)
+++ kvm_main.c (working copy)
@@ -1972,17 +1972,17 @@
return -EEXIST;
}

- kvm_arch_ops = ops;
-
- if (!kvm_arch_ops->cpu_has_kvm_support()) {
+ if (!ops->cpu_has_kvm_support()) {
printk(KERN_ERR "kvm: no hardware support\n");
return -EOPNOTSUPP;
}
- if (kvm_arch_ops->disabled_by_bios()) {
+ if (ops->disabled_by_bios()) {
printk(KERN_ERR "kvm: disabled by bios\n");
return -EOPNOTSUPP;
}

+ kvm_arch_ops = ops;
+
r = kvm_arch_ops->hardware_setup();
if (r < 0)
return r;

--
Yoshimi Ichiyanagi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise