LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [patch] KVM, hotplug: export register_cpu_notifier
@ 2007-02-07  8:16 Ingo Molnar
  2007-02-07  9:12 ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-02-07  8:16 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Avi Kivity, linux-kernel

Subject: [patch] KVM, hotplug: export register_cpu_notifier
From: Ingo Molnar <mingo@elte.hu>

KVM-trunk uses register_cpu_notifier() but it's a module and we only 
export this if CONFIG_HOTPLUG_CPU. Export it otherwise too.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 kernel/cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux/kernel/cpu.c
===================================================================
--- linux.orig/kernel/cpu.c
+++ linux/kernel/cpu.c
@@ -75,10 +75,10 @@ int __cpuinit register_cpu_notifier(stru
 	return 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);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] KVM, hotplug: export register_cpu_notifier
  2007-02-07  8:16 [patch] KVM, hotplug: export register_cpu_notifier Ingo Molnar
@ 2007-02-07  9:12 ` Avi Kivity
  2007-02-07  9:19   ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Avi Kivity @ 2007-02-07  9:12 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andrew Morton, linux-kernel

Ingo Molnar wrote:
> Subject: [patch] KVM, hotplug: export register_cpu_notifier
> From: Ingo Molnar <mingo@elte.hu>
>
> KVM-trunk uses register_cpu_notifier() but it's a module and we only 
> export this if CONFIG_HOTPLUG_CPU. Export it otherwise too.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  kernel/cpu.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: linux/kernel/cpu.c
> ===================================================================
> --- linux.orig/kernel/cpu.c
> +++ linux/kernel/cpu.c
> @@ -75,10 +75,10 @@ int __cpuinit register_cpu_notifier(stru
>  	return 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);
>   

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.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] KVM, hotplug: export register_cpu_notifier
  2007-02-07  9:12 ` Avi Kivity
@ 2007-02-07  9:19   ` Ingo Molnar
  2007-02-07  9:34     ` Avi Kivity
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-02-07  9:19 UTC (permalink / raw)
  To: Avi Kivity; +Cc: Andrew Morton, linux-kernel


* Avi Kivity <avi@qumranet.com> wrote:

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

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 <mingo@elte.hu>

KVM-trunk uses register_cpu_notifier() but it's not exported
on CONFIG_HOTPLUG_CPU. Make it a nop inline.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 include/linux/cpu.h |    6 +++++-
 kernel/cpu.c        |    4 ----
 2 files changed, 5 insertions(+), 5 deletions(-)

Index: linux/include/linux/cpu.h
===================================================================
--- linux.orig/include/linux/cpu.h
+++ linux/include/linux/cpu.h
@@ -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
===================================================================
--- linux.orig/kernel/cpu.c
+++ linux/kernel/cpu.c
@@ -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(stru
 	return ret;
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-
 EXPORT_SYMBOL(register_cpu_notifier);
 
 void unregister_cpu_notifier(struct notifier_block *nb)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] KVM, hotplug: export register_cpu_notifier
  2007-02-07  9:19   ` Ingo Molnar
@ 2007-02-07  9:34     ` Avi Kivity
  0 siblings, 0 replies; 4+ messages in thread
From: Avi Kivity @ 2007-02-07  9:34 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Andrew Morton, linux-kernel

Ingo Molnar wrote:
> * Avi Kivity <avi@qumranet.com> wrote:
>
>   
>>> -#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.
>>     
>
> 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.

> 	Ingo
>
> ---------------------->
> Subject: [patch] KVM: export register_cpu_notifier
> From: Ingo Molnar <mingo@elte.hu>
>
> KVM-trunk uses register_cpu_notifier() but it's not exported
> on CONFIG_HOTPLUG_CPU. Make it a nop inline.
>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> ---
>  include/linux/cpu.h |    6 +++++-
>  kernel/cpu.c        |    4 ----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> Index: linux/include/linux/cpu.h
> ===================================================================
> --- linux.orig/include/linux/cpu.h
> +++ linux/include/linux/cpu.h
> @@ -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
> ===================================================================
> --- linux.orig/kernel/cpu.c
> +++ linux/kernel/cpu.c
> @@ -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(stru
>  	return ret;
>  }
>  
> -#ifdef CONFIG_HOTPLUG_CPU
> -
>  EXPORT_SYMBOL(register_cpu_notifier);
>  
>  void unregister_cpu_notifier(struct notifier_block *nb)
>   


-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-02-07  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07  8:16 [patch] KVM, hotplug: export register_cpu_notifier Ingo Molnar
2007-02-07  9:12 ` Avi Kivity
2007-02-07  9:19   ` Ingo Molnar
2007-02-07  9:34     ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).