Commit 47e627bc authored by Avi Kivity's avatar Avi Kivity Committed by Linus Torvalds
Browse files

[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

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: default avatarAvi Kivity <>
Cc: Ingo Molnar <>
Cc: Rusty Russell <>
Cc: Oleg Nesterov <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 1e8ba6fb
......@@ -49,10 +49,20 @@ struct notifier_block;
/* Need to know about CPUs going up/down? */
extern int register_cpu_notifier(struct notifier_block *nb);
extern int register_cpu_notifier(struct notifier_block *nb);
extern void unregister_cpu_notifier(struct notifier_block *nb);
#ifndef MODULE
extern int register_cpu_notifier(struct notifier_block *nb);
static inline int register_cpu_notifier(struct notifier_block *nb)
return 0;
static inline void unregister_cpu_notifier(struct notifier_block *nb)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment