aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@qumranet.com>2007-02-12 03:54:43 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:40 -0500
commit47e627bc8c9a70392d2049e6af5bd55fae61fe53 (patch)
tree51d5d0ff1008d200a7076b5f3fa0966277cb4b24
parent1e8ba6fba5050ec11bba90c8622aa2ed95ff711f (diff)
[PATCH] hotplug: Allow modules to use the cpu hotplug notifiers even if !CONFIG_HOTPLUG_CPU
The following patchset allows a host with running virtual machines to be suspended and, on at least a subset of the machines tested, resumed. Note that this is orthogonal to suspending and resuming an individual guest to a file. A side effect of implementing suspend/resume is that cpu hotplug is now supported. This should please the owners of big iron. This patch: KVM wants the cpu hotplug notifications, both for cpu hotplug itself, but more commonly for host suspend/resume. In order to avoid extensive #ifdefs, provide stubs when CONFIG_CPU_HOTPLUG is not defined. In all, we have four cases: - UP: register and unregister stubbed out - SMP+hotplug: full register and unregister - SMP, no hotplug, core: register as __init, unregister stubbed (cpus are brought up during core initialization) - SMP, no hotplug, module: register and unregister stubbed out (cpus cannot be brought up during module lifetime) Signed-off-by: Avi Kivity <avi@qumranet.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/cpu.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h
index bfb520212d71..769ddc6df492 100644
--- a/include/linux/cpu.h
+++ b/include/linux/cpu.h
@@ -49,10 +49,20 @@ struct notifier_block;
49 49
50#ifdef CONFIG_SMP 50#ifdef CONFIG_SMP
51/* Need to know about CPUs going up/down? */ 51/* Need to know about CPUs going up/down? */
52extern int register_cpu_notifier(struct notifier_block *nb);
53#ifdef CONFIG_HOTPLUG_CPU 52#ifdef CONFIG_HOTPLUG_CPU
53extern int register_cpu_notifier(struct notifier_block *nb);
54extern void unregister_cpu_notifier(struct notifier_block *nb); 54extern void unregister_cpu_notifier(struct notifier_block *nb);
55#else 55#else
56
57#ifndef MODULE
58extern int register_cpu_notifier(struct notifier_block *nb);
59#else
60static inline int register_cpu_notifier(struct notifier_block *nb)
61{
62 return 0;
63}
64#endif
65
56static inline void unregister_cpu_notifier(struct notifier_block *nb) 66static inline void unregister_cpu_notifier(struct notifier_block *nb)
57{ 67{
58} 68}