aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/stop_machine.h
diff options
context:
space:
mode:
Diffstat (limited to 'xen/include/xen/stop_machine.h')
-rw-r--r--xen/include/xen/stop_machine.h19
1 files changed, 19 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..7d4506869f
--- /dev/null
+++ b/xen/include/xen/stop_machine.h
@@ -0,0 +1,19 @@
+#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);
+
+#endif /* __XEN_STOP_MACHINE_H__ */