move_kvm_cpu_cache_to_x86_header
From: Christian Ehrhardt <[email protected]>
Date: Thu, 29 Nov 2007 10:54:00 +0100
Subject: [PATCH] [3/2] move_kvm_cpu_cache_to_x86_header
To prevent misuse of these x86 structure in generic code the definition moved from kvm.h to x86.h.
---
[diffstat]
kvm.h | 1 - x86.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
[diff]
drivers/kvm/kvm.h +0 -1
@@ -112,7 +112,6 @@ struct kvm_mmu_page { };struct kvm_vcpu ; -extern struct kmem_cache *kvm_vcpu_cache;/* * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
drivers/kvm/x86.h +1 -0
@@ -224,6 +224,7 @@ struct kvm_x86_ops { };extern struct kvm_x86_ops *kvm_x86_ops; +extern struct kmem_cache *kvm_vcpu_cache;int kvm_mmu_module_init (void );void kvm_mmu_module_exit (void );
Signature · 19 lines
Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization +49 7031/16-3385 [email protected] [email protected] IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Johann Weihen Geschäftsführung: Herbert Kircher Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294 ------------------------------------------------------------------------- SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future. http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
A message that is not in the archive (sent off-list or not yet received): [email protected]
Thanks, sure to move it out. Maybe you can update my second patch directly for Avi's easy maintenance.
Quoted 16 lines
drivers/kvm/kvm.h +0
-1@@ -112,7 +112,6 @@ struct kvm_mmu_page { };struct kvm_vcpu ; -extern struct kmem_cache *kvm_vcpu_cache;/* * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
drivers/kvm/x86.h +0
-0
drivers/kvm/x86.h struct kvm_x86_ops { · line 230
Quoted 7 lines
drivers/kvm/x86.h +1
-0@@ -224,6 +224,7 @@ struct kvm_x86_ops { };extern struct kvm_x86_ops *kvm_x86_ops; +extern struct kmem_cache *kvm_vcpu_cache;int kvm_mmu_module_init (void );void kvm_mmu_module_exit (void );
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
A message that is not in the archive (sent off-list or not yet received): 42DFA526FC41B1429CE7279EF83C6BDCA3951C-wq7ZOvIWXbMAbVU2wMM1CrfspsVTdybXVpNB7YpNyf8@public.gmane.org
PATCH 2/2 merged_move_kvm_vpu_cache_to_x86
Attached your patch 2/2 and my 3/2 merged.
As you said the renaming patch is not essential, but I prefer names as clear as possible which would be with renaming patch. As 4/2 still applies after this merged one we can just let Avi apply whatever he likes from this series ;-)
Quoted 2 lines · Xiantao
Thanks, sure to move it out. Maybe you can update my second patch directly for Avi's easy maintenance.
[...]
---
From: Zhang Xiantao <[email protected]>
From: Christian Ehrhardt <[email protected]>
Date: Thu, 29 Nov 2007 10:54:00 +0100
Subject: [PATCH] [2/2] merged_move_kvm_vpu_cache_to_x86
Moving kvm_vcpu_cache to x86.c, since only x86 platform will use to align the memory area for fx_save. To prevent misuse of these x86 structure in generic code the definition moved from kvm.h to x86.h.
---
[diffstat]
kvm.h | 4 ++-- kvm_main.c | 17 +---------------- x86.c | 19 ++++++++++++++++++- x86.h | 1 + 4 files changed, 22 insertions(+), 19 deletions(-)
I'm not yet sure if my mailer now at last keeps the format to apply it later so I additionally attach it as file this time. [diff]
drivers/kvm/kvm.h +0 -0
@@ -112,7 +112,6 @@ struct kvm_mmu_page {
};
struct kvm_vcpu;
-extern struct kmem_cache *kvm_vcpu_cache;
/*
* x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
@@ -456,7 +455,8 @@ int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu,
struct kvm_debug_guest *dbg);
int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run);
-int kvm_arch_init(void *opaque);
+int kvm_arch_init(void *opaque, unsigned int vcpu_size,
+ struct module * module);
void kvm_arch_exit(void);
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
drivers/kvm/kvm_main.c +0 -0
@@ -56,9 +56,6 @@ LIST_HEAD(vm_list);
static cpumask_t cpus_hardware_enabled;
-struct kmem_cache *kvm_vcpu_cache; -EXPORT_SYMBOL_GPL(kvm_vcpu_cache);
-
static __read_mostly struct preempt_ops kvm_preempt_ops;
static struct dentry *debugfs_dir;
@@ -1338,7 +1335,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
kvm_init_debug();
- r = kvm_arch_init(opaque);
+ r = kvm_arch_init(opaque, vcpu_size, module); if (r) goto out_fail;
@@ -1375,15 +1372,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
if (r) goto out_free_4;
- /* A kmem cache lets us meet the alignment requirements of fx_save. */
- kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size,
- __alignof__(struct kvm_vcpu),
- 0, NULL);
- if (!kvm_vcpu_cache) {
- r = -ENOMEM;
- goto out_free_5;
- }
-
kvm_chardev_ops.owner = module; r = misc_register(&kvm_dev); @@ -1398,8 +1386,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size, return 0;
out_free:
- kmem_cache_destroy(kvm_vcpu_cache);
-out_free_5:
sysdev_unregister(&kvm_sysdev);
out_free_4:
sysdev_class_unregister(&kvm_sysdev_class);
@@ -1423,7 +1409,6 @@ EXPORT_SYMBOL_GPL(kvm_init);
void kvm_exit(void)
{
misc_deregister(&kvm_dev);
- kmem_cache_destroy(kvm_vcpu_cache);
sysdev_unregister(&kvm_sysdev);
sysdev_class_unregister(&kvm_sysdev_class);
unregister_reboot_notifier(&kvm_reboot_notifier);drivers/kvm/x86.c +0 -0
@@ -48,6 +48,10 @@
struct kvm_x86_ops *kvm_x86_ops;
+struct kmem_cache *kvm_vcpu_cache;
+EXPORT_SYMBOL_GPL(kvm_vcpu_cache);
+
+
struct kvm_stats_debugfs_item debugfs_entries[] = {
{ "pf_fixed", VCPU_STAT(pf_fixed) },
{ "pf_guest", VCPU_STAT(pf_guest) },@@ -1997,7 +2001,8 @@ int kvm_emulate_pio_string(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, }EXPORT_SYMBOL_GPL(kvm_emulate_pio_string);
-int kvm_arch_init(void *opaque)
+int kvm_arch_init(void *opaque, unsigned int vcpu_size,
+ struct module *module)
{
int r;
struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
@@ -2006,6 +2011,15 @@ int kvm_arch_init(void *opaque)
if (r)
goto out_fail;+ /* A kmem cache lets us meet the alignment requirements of fx_save. */
+ kvm_vcpu_cache = kmem_cache_create("kvm_vcpu", vcpu_size,
+ __alignof__(struct kvm_vcpu),
+ 0, NULL);
+ if (!kvm_vcpu_cache) {
+ r = -ENOMEM;
+ goto out_free;
+ }
+
kvm_init_msr_list();
if (kvm_x86_ops) {
@@ -2030,6 +2044,8 @@ int kvm_arch_init(void *opaque)
return 0;out:
+ kmem_cache_destroy(kvm_vcpu_cache);
+out_free:
kvm_mmu_module_exit();
out_fail:
return r;
@@ -2039,6 +2055,7 @@ void kvm_arch_exit(void)
{
kvm_x86_ops = NULL;
kvm_mmu_module_exit();+ kmem_cache_destroy(kvm_vcpu_cache);
}
int kvm_emulate_halt(struct kvm_vcpu *vcpu)
drivers/kvm/x86.h +0 -0
@@ -224,6 +224,7 @@ struct kvm_x86_ops {
};
extern struct kvm_x86_ops *kvm_x86_ops;
+extern struct kmem_cache *kvm_vcpu_cache;
int kvm_mmu_module_init(void);
void kvm_mmu_module_exit(void);
Signature · 10 lines
Grüsse / regards, Christian Ehrhardt IBM Linux Technology Center, Open Virtualization +49 7031/16-3385 [email protected] [email protected] IBM Deutschland Entwicklung GmbH Vorsitzender des Aufsichtsrats: Johann Weihen Geschäftsführung: Herbert Kircher Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294
drivers/kvm/kvm.h +2 -2
@@ -112,7 +112,6 @@ struct kvm_mmu_page { };struct kvm_vcpu ; -extern struct kmem_cache *kvm_vcpu_cache;/* * x86 supports 3 paging modes (4-level 64-bit, 3-level 64-bit, and 2-level
@@ -456,7 +455,8 @@ int kvm_arch_vcpu_ioctl_debug_guest(struct kvm_vcpu *vcpu, struct kvm_debug_guest *dbg);int kvm_arch_vcpu_ioctl_run (struct kvm_vcpu *vcpu,struct kvm_run *kvm_run); -int kvm_arch_init (void *opaque); +int kvm_arch_init (void *opaque,unsigned int vcpu_size, +struct module * module);void kvm_arch_exit (void );int kvm_arch_vcpu_init (struct kvm_vcpu *vcpu);
drivers/kvm/kvm_main.c +1 -16
@@ -56,9 +56,6 @@ LIST_HEAD(vm_list);static cpumask_t cpus_hardware_enabled; -struct kmem_cache *kvm_vcpu_cache; -EXPORT_SYMBOL_GPL (kvm_vcpu_cache); -static __read_mostly struct preempt_ops kvm_preempt_ops;static struct dentry *debugfs_dir;
@@ -1338,7 +1335,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,kvm_init_debug (); - r =kvm_arch_init (opaque); + r =kvm_arch_init (opaque, vcpu_size, module);if (r) goto out_fail;
@@ -1375,15 +1372,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,if (r) goto out_free_4; -/* A kmem cache lets us meet the alignment requirements of fx_save. */ - kvm_vcpu_cache =kmem_cache_create ("kvm_vcpu" , vcpu_size, - __alignof__(struct kvm_vcpu ), -0 ,NULL ); -if (!kvm_vcpu_cache) { - r = -ENOMEM ; - goto out_free_5; - } - kvm_chardev_ops.owner = module; r =misc_register (&kvm_dev);
@@ -1398,8 +1386,6 @@ int kvm_init(void *opaque, unsigned int vcpu_size,return 0 ; out_free: -kmem_cache_destroy (kvm_vcpu_cache); -out_free_5:sysdev_unregister (&kvm_sysdev); out_free_4:sysdev_class_unregister (&kvm_sysdev_class);
@@ -1423,7 +1409,6 @@ EXPORT_SYMBOL_GPL(kvm_init);void kvm_exit (void ) {misc_deregister (&kvm_dev); -kmem_cache_destroy (kvm_vcpu_cache);sysdev_unregister (&kvm_sysdev);sysdev_class_unregister (&kvm_sysdev_class);unregister_reboot_notifier (&kvm_reboot_notifier);
drivers/kvm/x86.c +18 -1
@@ -48,6 +48,10 @@struct kvm_x86_ops *kvm_x86_ops; +struct kmem_cache *kvm_vcpu_cache; +EXPORT_SYMBOL_GPL (kvm_vcpu_cache); + +struct kvm_stats_debugfs_item debugfs_entries[] = { {"pf_fixed" ,VCPU_STAT (pf_fixed) }, {"pf_guest" ,VCPU_STAT (pf_guest) },
@@ -1997,7 +2001,8 @@ int kvm_emulate_pio_string(struct kvm_vcpu *vcpu, struct kvm_run *run, int in, }EXPORT_SYMBOL_GPL (kvm_emulate_pio_string); -int kvm_arch_init (void *opaque) +int kvm_arch_init (void *opaque,unsigned int vcpu_size, +struct module *module) {int r;struct kvm_x86_ops *ops = (struct kvm_x86_ops *)opaque;
@@ -2006,6 +2011,15 @@ int kvm_arch_init(void *opaque)if (r) goto out_fail; +/* A kmem cache lets us meet the alignment requirements of fx_save. */ + kvm_vcpu_cache =kmem_cache_create ("kvm_vcpu" , vcpu_size, + __alignof__(struct kvm_vcpu ), +0 ,NULL ); +if (!kvm_vcpu_cache) { + r = -ENOMEM ; + goto out_free; + } +kvm_init_msr_list ();if (kvm_x86_ops) {
@@ -2030,6 +2044,8 @@ int kvm_arch_init(void *opaque)return 0 ; out: +kmem_cache_destroy (kvm_vcpu_cache); +out_free:kvm_mmu_module_exit (); out_fail:return r;
@@ -2039,6 +2055,7 @@ void kvm_arch_exit(void) { kvm_x86_ops =NULL ;kvm_mmu_module_exit (); +kmem_cache_destroy (kvm_vcpu_cache); }int kvm_emulate_halt (struct kvm_vcpu *vcpu)
drivers/kvm/x86.h +1 -0
@@ -224,6 +224,7 @@ struct kvm_x86_ops { };extern struct kvm_x86_ops *kvm_x86_ops; +extern struct kmem_cache *kvm_vcpu_cache;int kvm_mmu_module_init (void );void kvm_mmu_module_exit (void );
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel
A message that is not in the archive (sent off-list or not yet received): [email protected]
Carsten Otte
Acked-byRe: [PATCH] [2/2] merged_move_kvm_vpu_cache_to_x86
Quoted 18 lines · Christian Ehrhardt
Attached your patch 2/2 and my 3/2 merged.
As you said the renaming patch is not essential, but I prefer names as clear as possible which would be with renaming patch.
As 4/2 still applies after this merged one we can just let Avi apply whatever he likes from this series ;-)Quoted 2 lines · Xiantao
Thanks, sure to move it out. Maybe you can update my second patch directly for Avi's easy maintenance.
[...]
---
From: Zhang Xiantao <[email protected]>
From: Christian Ehrhardt <[email protected]>
Date: Thu, 29 Nov 2007 10:54:00 +0100
Subject: [PATCH] [2/2]merged_move_kvm_vpu_cache_to_x86
Quoted 5 lines
Moving
kvm_vcpu_cachetox86.c, since only x86 platform will use to align the memory area forfx_save. To prevent misuse of these x86 structure in generic code the definition moved fromkvm.htox86.h.Signed-off-by Christian Ehrhardt <[email protected]>
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
Carsten Otte
Acked-byQuoted 8 lines · Christian Ehrhardt
From: Christian Ehrhardt <[email protected]>
Date: Thu, 29 Nov 2007 10:54:00 +0100
Subject: [PATCH] [3/2]move_kvm_cpu_cache_to_x86_headerTo prevent misuse of these x86 structure in generic code the definition moved from
kvm.htox86.h.Signed-off-by Christian Ehrhardt <[email protected]>
-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4