logo       

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

emulators.kvm.devel

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

Yoshimi Ichiyanagi wrote:
> 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.
>
>

Applied with edits; thanks.

Please provide a Signed-off-by: line in future patches.

See below:

> -------------------------------------------------------------------
> diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
> index 9f24f22..9287b2d 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)
> {
> int r;
>
> + if ( kvm_arch_ops ) {
> + printk(KERN_ERR "kvm: already loaded the other module\n
> ");
> + return -EOPNOTSUPP;
> + }
> +
>

Changed to -EEXIST.

> 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.

--
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
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