From: Zhang, X. <xia...@in...> - 2007-11-08 08:05:02
|
Hi Avi Please drop it, and use this one, due to version issue. thanks=20 Xiantao=20 >From 959bc19b0e2ca7edcb3389aabdecf99ba9f1794e Mon Sep 17 00:00:00 2001 From: Zhang Xiantao <xia...@in...> Date: Thu, 8 Nov 2007 13:19:06 +0800 Subject: [PATCH] Combine kvm_init and kvm_init_x86 into one function, and meanwhile remove module_init module_exit function, since they will be called once new arch is registered.=20 Signed-off-by: Zhang Xiantao <xia...@in...> --- drivers/kvm/kvm.h | 4 +- drivers/kvm/kvm_main.c | 60 +++++++++++++++++------------------------------ drivers/kvm/svm.c | 4 +- drivers/kvm/vmx.c | 4 +- 4 files changed, 28 insertions(+), 44 deletions(-) diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 4b2421a..33b4629 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h @@ -494,9 +494,9 @@ void vcpu_load(struct kvm_vcpu *vcpu); void vcpu_put(struct kvm_vcpu *vcpu); =20 =20 -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, struct module *module); -void kvm_exit_x86(void); +void kvm_exit(void); =20 int kvm_mmu_module_init(void); void kvm_mmu_module_exit(void); diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index da7fb22..8f09170 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -1503,12 +1503,27 @@ static void kvm_sched_out(struct preempt_notifier *pn, kvm_arch_vcpu_put(vcpu); } =20 -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, struct module *module) { int r; int cpu; =20 + r =3D kvm_mmu_module_init(); + if (r) + goto out4; + + kvm_init_debug(); + + kvm_arch_init(); + + bad_page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); + + if (bad_page =3D=3D NULL) { + r =3D -ENOMEM; + goto out; + } + if (kvm_x86_ops) { printk(KERN_ERR "kvm: already loaded the other module\n"); return -EEXIST; @@ -1589,11 +1604,14 @@ out_free_0: kvm_arch_hardware_unsetup(); out: kvm_x86_ops =3D NULL; + kvm_exit_debug(); + kvm_mmu_module_exit(); +out44: return r; } -EXPORT_SYMBOL_GPL(kvm_init_x86); +EXPORT_SYMBOL_GPL(kvm_init); =20 -void kvm_exit_x86(void) +void kvm_exit(void) { misc_deregister(&kvm_dev); kmem_cache_destroy(kvm_vcpu_cache); @@ -1604,43 +1622,9 @@ void kvm_exit_x86(void) on_each_cpu(hardware_disable, NULL, 0, 1); kvm_arch_hardware_unsetup(); kvm_x86_ops =3D NULL; -} -EXPORT_SYMBOL_GPL(kvm_exit_x86); - -static __init int kvm_init(void) -{ - int r; - - r =3D kvm_mmu_module_init(); - if (r) - goto out4; - - kvm_init_debug(); - - kvm_arch_init(); - - bad_page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); - - if (bad_page =3D=3D NULL) { - r =3D -ENOMEM; - goto out; - } - - return 0; - -out: - kvm_exit_debug(); - kvm_mmu_module_exit(); -out4: - return r; -} - -static __exit void kvm_exit(void) -{ kvm_exit_debug(); __free_page(bad_page); kvm_mmu_module_exit(); } +EXPORT_SYMBOL_GPL(kvm_exit); =20 -module_init(kvm_init) -module_exit(kvm_exit) diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 95a3489..cc71a07 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -1716,13 +1716,13 @@ static struct kvm_x86_ops svm_x86_ops =3D { =20 static int __init svm_init(void) { - return kvm_init_x86(&svm_x86_ops, sizeof(struct vcpu_svm), + return kvm_init(&svm_x86_ops, sizeof(struct vcpu_svm), THIS_MODULE); } =20 static void __exit svm_exit(void) { - kvm_exit_x86(); + kvm_exit(); } =20 module_init(svm_init) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index da3a339..d5a77bc 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -2657,7 +2657,7 @@ static int __init vmx_init(void) memset(iova, 0xff, PAGE_SIZE); kunmap(vmx_io_bitmap_b); =20 - r =3D kvm_init_x86(&vmx_x86_ops, sizeof(struct vcpu_vmx), THIS_MODULE); + r =3D kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx), THIS_MODULE); if (r) goto out1; =20 @@ -2678,7 +2678,7 @@ static void __exit vmx_exit(void) __free_page(vmx_io_bitmap_b); __free_page(vmx_io_bitmap_a); =20 - kvm_exit_x86(); + kvm_exit(); } =20 module_init(vmx_init) --=20 1.5.1.2 ------------------------------------------------------------------------ - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ kvm-devel mailing list kvm...@li... https://lists.sourceforge.net/lists/listinfo/kvm-devel |
From: Zhang, X. <xia...@in...> - 2007-11-08 08:18:01
|
Hi Avi Seems my mailer has something wrong, and it always reference an old version. This should be a correct one. Sorry for inconvenience!=20 Xiantao=20 >From 959bc19b0e2ca7edcb3389aabdecf99ba9f1794e Mon Sep 17 00:00:00 2001 From: Zhang Xiantao <xia...@in...> Date: Thu, 8 Nov 2007 13:19:06 +0800 Subject: [PATCH] Combine kvm_init and kvm_init_x86 into one function, and meanwhile remove module_init module_exit function, since they will be called once new arch is registered.=20 Signed-off-by: Zhang Xiantao <xia...@in...> --- drivers/kvm/kvm.h | 4 +- drivers/kvm/kvm_main.c | 60 +++++++++++++++++------------------------------ drivers/kvm/svm.c | 4 +- drivers/kvm/vmx.c | 4 +- 4 files changed, 28 insertions(+), 44 deletions(-) diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 4b2421a..33b4629 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h @@ -494,9 +494,9 @@ void vcpu_load(struct kvm_vcpu *vcpu); void vcpu_put(struct kvm_vcpu *vcpu); =20 =20 -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, struct module *module); -void kvm_exit_x86(void); +void kvm_exit(void); =20 int kvm_mmu_module_init(void); void kvm_mmu_module_exit(void); diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index da7fb22..8f09170 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -1503,12 +1503,27 @@ static void kvm_sched_out(struct preempt_notifier *pn, kvm_arch_vcpu_put(vcpu); } =20 -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, struct module *module) { int r; int cpu; =20 + r =3D kvm_mmu_module_init(); + if (r) + goto out4; + + kvm_init_debug(); + + kvm_arch_init(); + + bad_page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); + + if (bad_page =3D=3D NULL) { + r =3D -ENOMEM; + goto out; + } + if (kvm_x86_ops) { printk(KERN_ERR "kvm: already loaded the other module\n"); return -EEXIST; @@ -1589,11 +1604,14 @@ out_free_0: kvm_arch_hardware_unsetup(); out: kvm_x86_ops =3D NULL; + kvm_exit_debug(); + kvm_mmu_module_exit(); +out4: return r; } -EXPORT_SYMBOL_GPL(kvm_init_x86); +EXPORT_SYMBOL_GPL(kvm_init); =20 -void kvm_exit_x86(void) +void kvm_exit(void) { misc_deregister(&kvm_dev); kmem_cache_destroy(kvm_vcpu_cache); @@ -1604,43 +1622,9 @@ void kvm_exit_x86(void) on_each_cpu(hardware_disable, NULL, 0, 1); kvm_arch_hardware_unsetup(); kvm_x86_ops =3D NULL; -} -EXPORT_SYMBOL_GPL(kvm_exit_x86); - -static __init int kvm_init(void) -{ - int r; - - r =3D kvm_mmu_module_init(); - if (r) - goto out4; - - kvm_init_debug(); - - kvm_arch_init(); - - bad_page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); - - if (bad_page =3D=3D NULL) { - r =3D -ENOMEM; - goto out; - } - - return 0; - -out: - kvm_exit_debug(); - kvm_mmu_module_exit(); -out4: - return r; -} - -static __exit void kvm_exit(void) -{ kvm_exit_debug(); __free_page(bad_page); kvm_mmu_module_exit(); } +EXPORT_SYMBOL_GPL(kvm_exit); =20 -module_init(kvm_init) -module_exit(kvm_exit) diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 95a3489..cc71a07 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -1716,13 +1716,13 @@ static struct kvm_x86_ops svm_x86_ops =3D { =20 static int __init svm_init(void) { - return kvm_init_x86(&svm_x86_ops, sizeof(struct vcpu_svm), + return kvm_init(&svm_x86_ops, sizeof(struct vcpu_svm), THIS_MODULE); } =20 static void __exit svm_exit(void) { - kvm_exit_x86(); + kvm_exit(); } =20 module_init(svm_init) diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index da3a339..d5a77bc 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -2657,7 +2657,7 @@ static int __init vmx_init(void) memset(iova, 0xff, PAGE_SIZE); kunmap(vmx_io_bitmap_b); =20 - r =3D kvm_init_x86(&vmx_x86_ops, sizeof(struct vcpu_vmx), THIS_MODULE); + r =3D kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx), THIS_MODULE); if (r) goto out1; =20 @@ -2678,7 +2678,7 @@ static void __exit vmx_exit(void) __free_page(vmx_io_bitmap_b); __free_page(vmx_io_bitmap_a); =20 - kvm_exit_x86(); + kvm_exit(); } =20 module_init(vmx_init) --=20 1.5.1.2 |
From: Carsten O. <co...@de...> - 2007-11-08 13:55:16
|
I agree with the gernal idea of this patch. Just a few minor things to pick on: Zhang, Xiantao wrote: > diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h > index 4b2421a..33b4629 100644 > --- a/drivers/kvm/kvm.h > +++ b/drivers/kvm/kvm.h > @@ -494,9 +494,9 @@ void vcpu_load(struct kvm_vcpu *vcpu); > void vcpu_put(struct kvm_vcpu *vcpu); > > > -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, > +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, > struct module *module); > -void kvm_exit_x86(void); > +void kvm_exit(void); Renaming this makes sense to me. > + r = kvm_mmu_module_init(); > + if (r) > + goto out4; This should go to kvm_arch_init. We don't want the shaddow-mmu module on s390. > + bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO); > + > + if (bad_page == NULL) { > + r = -ENOMEM; > + goto out; > + } I don't think we need bad_page on s390, maybe I missed something. It's only useful for mmu code as far as I can tell. |
From: Zhang, X. <xia...@in...> - 2007-11-08 15:16:39
|
Carsten Otte wrote: >=20 >> + bad_page =3D alloc_page(GFP_KERNEL | __GFP_ZERO); >> + >> + if (bad_page =3D=3D NULL) { >> + r =3D -ENOMEM; >> + goto out; >> + } > I don't think we need bad_page on s390, maybe I missed something. It's > only useful for mmu code as far as I can tell. Determined by the position of code realted to mmu :) Xiantao |
From: Hollis B. <ho...@us...> - 2007-11-08 17:29:16
|
Your mailer, which I'm guessing is Microsoft Outlook, is wrapping lines and so this patch does not apply. You might try using git-send-email or equivalent to avoid this issue. -- Hollis Blanchard IBM Linux Technology Center On Thu, 2007-11-08 at 16:17 +0800, Zhang, Xiantao wrote: > Hi Avi > Seems my mailer has something wrong, and it always reference an > old version. This should be a correct one. Sorry for inconvenience! > Xiantao > > From 959bc19b0e2ca7edcb3389aabdecf99ba9f1794e Mon Sep 17 00:00:00 2001 > From: Zhang Xiantao <xia...@in...> > Date: Thu, 8 Nov 2007 13:19:06 +0800 > Subject: [PATCH] Combine kvm_init and kvm_init_x86 into one function, > and > meanwhile remove module_init module_exit function, since they will be > called > once new arch is registered. > Signed-off-by: Zhang Xiantao <xia...@in...> > --- > drivers/kvm/kvm.h | 4 +- > drivers/kvm/kvm_main.c | 60 > +++++++++++++++++------------------------------ > drivers/kvm/svm.c | 4 +- > drivers/kvm/vmx.c | 4 +- > 4 files changed, 28 insertions(+), 44 deletions(-) > > diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h > index 4b2421a..33b4629 100644 > --- a/drivers/kvm/kvm.h > +++ b/drivers/kvm/kvm.h > @@ -494,9 +494,9 @@ void vcpu_load(struct kvm_vcpu *vcpu); > void vcpu_put(struct kvm_vcpu *vcpu); > > > -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, > +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, > struct module *module); > -void kvm_exit_x86(void); > +void kvm_exit(void); > > int kvm_mmu_module_init(void); > void kvm_mmu_module_exit(void); > diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c > index da7fb22..8f09170 100644 > --- a/drivers/kvm/kvm_main.c > +++ b/drivers/kvm/kvm_main.c > @@ -1503,12 +1503,27 @@ static void kvm_sched_out(struct > preempt_notifier *pn, > kvm_arch_vcpu_put(vcpu); > } > > -int kvm_init_x86(struct kvm_x86_ops *ops, unsigned int vcpu_size, > +int kvm_init(struct kvm_x86_ops *ops, unsigned int vcpu_size, > struct module *module) > { > int r; > int cpu; > > + r = kvm_mmu_module_init(); > + if (r) > + goto out4; > + > + kvm_init_debug(); > + > + kvm_arch_init(); > + > + bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO); > + > + if (bad_page == NULL) { > + r = -ENOMEM; > + goto out; > + } > + > if (kvm_x86_ops) { > printk(KERN_ERR "kvm: already loaded the other > module\n"); > return -EEXIST; > @@ -1589,11 +1604,14 @@ out_free_0: > kvm_arch_hardware_unsetup(); > out: > kvm_x86_ops = NULL; > + kvm_exit_debug(); > + kvm_mmu_module_exit(); > +out4: > return r; > } > -EXPORT_SYMBOL_GPL(kvm_init_x86); > +EXPORT_SYMBOL_GPL(kvm_init); > > -void kvm_exit_x86(void) > +void kvm_exit(void) > { > misc_deregister(&kvm_dev); > kmem_cache_destroy(kvm_vcpu_cache); > @@ -1604,43 +1622,9 @@ void kvm_exit_x86(void) > on_each_cpu(hardware_disable, NULL, 0, 1); > kvm_arch_hardware_unsetup(); > kvm_x86_ops = NULL; > -} > -EXPORT_SYMBOL_GPL(kvm_exit_x86); > - > -static __init int kvm_init(void) > -{ > - int r; > - > - r = kvm_mmu_module_init(); > - if (r) > - goto out4; > - > - kvm_init_debug(); > - > - kvm_arch_init(); > - > - bad_page = alloc_page(GFP_KERNEL | __GFP_ZERO); > - > - if (bad_page == NULL) { > - r = -ENOMEM; > - goto out; > - } > - > - return 0; > - > -out: > - kvm_exit_debug(); > - kvm_mmu_module_exit(); > -out4: > - return r; > -} > - > -static __exit void kvm_exit(void) > -{ > kvm_exit_debug(); > __free_page(bad_page); > kvm_mmu_module_exit(); > } > +EXPORT_SYMBOL_GPL(kvm_exit); > > -module_init(kvm_init) > -module_exit(kvm_exit) > diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c > index 95a3489..cc71a07 100644 > --- a/drivers/kvm/svm.c > +++ b/drivers/kvm/svm.c > @@ -1716,13 +1716,13 @@ static struct kvm_x86_ops svm_x86_ops = { > > static int __init svm_init(void) > { > - return kvm_init_x86(&svm_x86_ops, sizeof(struct vcpu_svm), > + return kvm_init(&svm_x86_ops, sizeof(struct vcpu_svm), > THIS_MODULE); > } > > static void __exit svm_exit(void) > { > - kvm_exit_x86(); > + kvm_exit(); > } > > module_init(svm_init) > diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c > index da3a339..d5a77bc 100644 > --- a/drivers/kvm/vmx.c > +++ b/drivers/kvm/vmx.c > @@ -2657,7 +2657,7 @@ static int __init vmx_init(void) > memset(iova, 0xff, PAGE_SIZE); > kunmap(vmx_io_bitmap_b); > > - r = kvm_init_x86(&vmx_x86_ops, sizeof(struct vcpu_vmx), > THIS_MODULE); > + r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx), > THIS_MODULE); > if (r) > goto out1; > > @@ -2678,7 +2678,7 @@ static void __exit vmx_exit(void) > __free_page(vmx_io_bitmap_b); > __free_page(vmx_io_bitmap_a); > > - kvm_exit_x86(); > + kvm_exit(); > } > > module_init(vmx_init) |