aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/stop_machine.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/stop_machine.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/stop_machine.h')
-rw-r--r--xen/include/xen/stop_machine.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/xen/include/xen/stop_machine.h b/xen/include/xen/stop_machine.h
new file mode 100644
index 0000000000..f379f6705a
--- /dev/null
+++ b/xen/include/xen/stop_machine.h
@@ -0,0 +1,30 @@
+#ifndef __XEN_STOP_MACHINE_H__
+#define __XEN_STOP_MACHINE_H__
+
+/**
+ * stop_machine_run: freeze the machine on all CPUs and run this function
+ * @fn: the function to run
+ * @data: the data ptr for the @fn()
+ * @cpu: the cpu to run @fn() on (or any, if @cpu == NR_CPUS).
+ *
+ * Description: This causes every other cpu to enter a safe point, with
+ * each of which disables interrupts, and finally interrupts are disabled
+ * on the current CPU. The result is that none is holding a spinlock
+ * or inside any other preempt-disabled region when @fn() runs.
+ *
+ * This can be thought of as a very heavy write lock, equivalent to
+ * grabbing every spinlock in the kernel. */
+int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu);
+
+/**
+ * __stop_machine_run: freeze the machine on all CPUs and run this function
+ * @fn: the function to run
+ * @data: the data ptr for the @fn
+ * @cpu: the cpu to run @fn on (or any, if @cpu == NR_CPUS.
+ *
+ * Description: This is a special version of the above, without explicit
+ * lock acquisition. Used by hotplug cpu.
+ */
+int __stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu);
+
+#endif /* __XEN_STOP_MACHINE_H__ */