summaryrefslogtreecommitdiff
path: root/kernel/smp.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2012-05-07 17:59:48 +0000
committerThomas Gleixner <tglx@linutronix.de>2012-05-08 12:35:06 +0200
commitf37f435f33717dcf15fd4bb422da739da7fc2052 (patch)
treeaca7b5707758ef33158116acbbdd41b8ab6c2fb4 /kernel/smp.c
parent9cd75e13de2dcf32ecc21c7f277cff3c0ced059e (diff)
smp: Implement kick_all_cpus_sync()
Will replace the misnomed cpu_idle_wait() function which is copied a gazillion times all over arch/* Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20120507175652.049316594@linutronix.de
Diffstat (limited to 'kernel/smp.c')
-rw-r--r--kernel/smp.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/kernel/smp.c b/kernel/smp.c
index a61294c07f3f..d0ae5b24875e 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -795,3 +795,26 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
}
}
EXPORT_SYMBOL(on_each_cpu_cond);
+
+static void do_nothing(void *unused)
+{
+}
+
+/**
+ * kick_all_cpus_sync - Force all cpus out of idle
+ *
+ * Used to synchronize the update of pm_idle function pointer. It's
+ * called after the pointer is updated and returns after the dummy
+ * callback function has been executed on all cpus. The execution of
+ * the function can only happen on the remote cpus after they have
+ * left the idle function which had been called via pm_idle function
+ * pointer. So it's guaranteed that nothing uses the previous pointer
+ * anymore.
+ */
+void kick_all_cpus_sync(void)
+{
+ /* Make sure the change is visible before we kick the cpus */
+ smp_mb();
+ smp_call_function(do_nothing, NULL, 1);
+}
+EXPORT_SYMBOL_GPL(kick_all_cpus_sync);