aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/smp.h
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2008-02-11 15:59:49 +0000
committerKeir Fraser <keir.fraser@citrix.com>2008-02-11 15:59:49 +0000
commitf029add7ef8d5a4d474263a3a83f84fd7873aca1 (patch)
tree3fd5d21efa9ce2932889addce5777674e215d89b /xen/include/xen/smp.h
parent6abc7e7e8c16fcf4deb4819d8d96591739cb8dbd (diff)
downloadxen-f029add7ef8d5a4d474263a3a83f84fd7873aca1.tar.gz
xen-f029add7ef8d5a4d474263a3a83f84fd7873aca1.tar.bz2
xen-f029add7ef8d5a4d474263a3a83f84fd7873aca1.zip
Rendezvous selected cpus in softirq (stop_machine).
This is similar to stop_machine_run stub from Linux, to pull selected cpus in rendezvous point and the do some batch work under a safe environment. Current one usage is from S3 path, where individual cpu is pulled down with related online footprints being cleared. It's dangerous to have other cpus checking clobbered data structure in the middle, such as cpu_online_map, cpu_sibling_map, etc. Signed-off-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/include/xen/smp.h')
-rw-r--r--xen/include/xen/smp.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/xen/include/xen/smp.h b/xen/include/xen/smp.h
index c02ecd4dc3..3e7de77ec8 100644
--- a/xen/include/xen/smp.h
+++ b/xen/include/xen/smp.h
@@ -112,4 +112,21 @@ static inline int on_each_cpu(
#define smp_processor_id() raw_smp_processor_id()
+#ifdef CONFIG_HOTPLUG_CPU
+extern spinlock_t cpu_add_remove_lock;
+/*
+ * FIXME: need a better lock mechanism when real cpu hotplug is later
+ * supported, since spinlock may cause dead lock:
+ * cpu0: in stop_machine with lock held. Wait for cpu1 to respond
+ * to stop request
+ * cpu1: spin loop on lock upon cpu hotplug request from guest,
+ * without chance to handle softirq
+ * ...
+ */
+#define lock_cpu_hotplug() spin_lock(&cpu_add_remove_lock);
+#define unlock_cpu_hotplug() spin_unlock(&cpu_add_remove_lock);
+#else
+#define lock_cpu_hotplug() do { } while ( 0 )
+#define unlock_cpu_hotplug() do { } while ( 0 )
+#endif
#endif