KVM, hotplug: export register_cpu_notifier
PATCH 1/1 KVM, hotplug: export register_cpu_notifier
Subject: [patch] KVM, hotplug: export register_cpu_notifier
From: Ingo Molnar <[email protected]>
KVM-trunk uses register_cpu_notifier() but it's a module and we only export this if CONFIG_HOTPLUG_CPU. Export it otherwise too.
--- kernel/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/cpu.c +2 -2
@@ -75,10 +75,10 @@ int __cpuinit register_cpu_notifier(strureturn ret; } -#ifdef CONFIG_HOTPLUG_CPU -EXPORT_SYMBOL (register_cpu_notifier); +#ifdef CONFIG_HOTPLUG_CPU +void unregister_cpu_notifier (struct notifier_block *nb) {mutex_lock (&cpu_add_remove_lock);
Quoted 18 lines · Ingo Molnar
Subject: [patch] KVM, hotplug: export
register_cpu_notifier
From: Ingo Molnar <[email protected]>KVM-trunk uses
register_cpu_notifier()but it's a module and we only export this ifCONFIG_HOTPLUG_CPU. Export it otherwise too.Signed-off-by Ingo Molnar <[email protected]>--- kernel/cpu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Index:
linux/kernel/cpu.c
===================================================================kernel/cpu.c +0
-0@@ -75,10 +75,10 @@ int __cpuinit register_cpu_notifier(strureturn ret; }
kernel/cpu.c int __cpuinit register_cpu_notifier(stru · line 84
Quoted 10 lines
kernel/cpu.c +2
-2-#ifdef CONFIG_HOTPLUG_CPU -EXPORT_SYMBOL (register_cpu_notifier); +#ifdef CONFIG_HOTPLUG_CPU +void unregister_cpu_notifier (struct notifier_block *nb) {mutex_lock (&cpu_add_remove_lock);
This is broken: register_cpu_notifier() is __cpuinit, which means it disappears at module time if !CONFIG_CPU_HOTPLUG.
I submitted a hackaround to Andrew some time ago with the suspend patchset.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Quoted 14 lines · Avi Kivity
Quoted 10 lines
(quoted diff) +0
-2-#ifdef CONFIG_HOTPLUG_CPU -
EXPORT_SYMBOL(register_cpu_notifier);(quoted diff) +2
-0+#ifdef CONFIG_HOTPLUG_CPU +void
unregister_cpu_notifier(struct notifier_block *nb){ mutex_lock(&cpu_add_remove_lock);This is broken:
register_cpu_notifier()is__cpuinit, which means it disappears at module time if !CONFIG_CPU_HOTPLUG.
Quoted 2 lines
I submitted a hackaround to Andrew some time ago with the suspend patchset.
ok. What does your patch do - turns it into an inline? I fixed it up in -rt via the patch below.
Ingo
---------------------->
Subject: [patch] KVM: export register_cpu_notifier
From: Ingo Molnar <[email protected]>
KVM-trunk uses register_cpu_notifier() but it's not exported on CONFIG_HOTPLUG_CPU. Make it a nop inline.
--- include/linux/cpu.h | 6 +++++- kernel/cpu.c | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-)
include/linux/cpu.h +5 -1
@@ -49,10 +49,14 @@ struct notifier_block;#ifdef CONFIG_SMP /* Need to know about CPUs going up/down? */ -extern int register_cpu_notifier (struct notifier_block *nb);#ifdef CONFIG_HOTPLUG_CPU +extern int register_cpu_notifier (struct notifier_block *nb);extern void unregister_cpu_notifier (struct notifier_block *nb);#else +static inline int register_cpu_notifier (struct notifier_block *nb) +{ +return 0 ; +}static inline void unregister_cpu_notifier (struct notifier_block *nb) { }
kernel/cpu.c +0 -4
@@ -63,8 +63,6 @@ void unlock_cpu_hotplug(void) }EXPORT_SYMBOL_GPL (unlock_cpu_hotplug); -#endif /* CONFIG_HOTPLUG_CPU */ -/* Need to know about CPUs going up/down? */ int __cpuinit register_cpu_notifier (struct notifier_block *nb) {
@@ -75,8 +73,6 @@ int __cpuinit register_cpu_notifier(strureturn ret; } -#ifdef CONFIG_HOTPLUG_CPU -EXPORT_SYMBOL (register_cpu_notifier);void unregister_cpu_notifier (struct notifier_block *nb)
Quoted 16 lines · Ingo Molnar
Quoted 13 lines · Avi Kivity
Quoted 11 lines
kernel/cpu.c +0
-2-#ifdef CONFIG_HOTPLUG_CPU -
EXPORT_SYMBOL(register_cpu_notifier);(quoted diff) +2
-0+#ifdef CONFIG_HOTPLUG_CPU +void
unregister_cpu_notifier(struct notifier_block *nb){ mutex_lock(&cpu_add_remove_lock);This is broken:
register_cpu_notifier()is__cpuinit, which means it disappears at module time if !CONFIG_CPU_HOTPLUG.
Quoted 7 lines
Quoted 2 lines
I submitted a hackaround to Andrew some time ago with the suspend patchset.
ok. What does your patch do - turns it into an inline? I fixed it up in -rt via the patch below.
yes, but only if MODULE.
Quoted 58 lines
Ingo
---------------------->
Subject: [patch] KVM: exportregister_cpu_notifier
From: Ingo Molnar <[email protected]>KVM-trunk uses
register_cpu_notifier()but it's not exported onCONFIG_HOTPLUG_CPU. Make it a nop inline.Signed-off-by Ingo Molnar <[email protected]>--- include/linux/cpu.h | 6 +++++- kernel/cpu.c | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-)Index:
linux/include/linux/cpu.h
===================================================================include/linux/cpu.h +5
-1@@ -49,10 +49,14 @@ struct notifier_block;#ifdef CONFIG_SMP /* Need to know about CPUs going up/down? */ -extern int register_cpu_notifier (struct notifier_block *nb);#ifdef CONFIG_HOTPLUG_CPU +extern int register_cpu_notifier (struct notifier_block *nb);extern void unregister_cpu_notifier (struct notifier_block *nb);#else +static inline int register_cpu_notifier (struct notifier_block *nb) +{ +return 0 ; +}static inline void unregister_cpu_notifier (struct notifier_block *nb) { }Index:
linux/kernel/cpu.c
===================================================================kernel/cpu.c +0
-4@@ -63,8 +63,6 @@ void unlock_cpu_hotplug(void) }EXPORT_SYMBOL_GPL (unlock_cpu_hotplug); -#endif /* CONFIG_HOTPLUG_CPU */ -/* Need to know about CPUs going up/down? */ int __cpuinit register_cpu_notifier (struct notifier_block *nb) {@@ -75,8 +73,6 @@ int __cpuinit register_cpu_notifier(strureturn ret; } -#ifdef CONFIG_HOTPLUG_CPU -EXPORT_SYMBOL (register_cpu_notifier);void unregister_cpu_notifier (struct notifier_block *nb)
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.