From: tip-bot for Thomas Gleixner <tglx@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
peterz@infradead.org, tglx@linutronix.de
Subject: [tip:smp/hotplug] smp: Implement kick_all_cpus_sync()
Date: Tue, 8 May 2012 05:26:08 -0700 [thread overview]
Message-ID: <tip-f37f435f33717dcf15fd4bb422da739da7fc2052@git.kernel.org> (raw)
In-Reply-To: <20120507175652.049316594@linutronix.de>
Commit-ID: f37f435f33717dcf15fd4bb422da739da7fc2052
Gitweb: http://git.kernel.org/tip/f37f435f33717dcf15fd4bb422da739da7fc2052
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Mon, 7 May 2012 17:59:48 +0000
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 8 May 2012 12:35:06 +0200
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
---
include/linux/smp.h | 4 ++++
kernel/smp.c | 23 +++++++++++++++++++++++
2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/include/linux/smp.h b/include/linux/smp.h
index 24360de..717fb74 100644
--- a/include/linux/smp.h
+++ b/include/linux/smp.h
@@ -81,6 +81,8 @@ void __smp_call_function_single(int cpuid, struct call_single_data *data,
int smp_call_function_any(const struct cpumask *mask,
smp_call_func_t func, void *info, int wait);
+void kick_all_cpus_sync(void);
+
/*
* Generic and arch helpers
*/
@@ -192,6 +194,8 @@ smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,
return smp_call_function_single(0, func, info, wait);
}
+static inline void kick_all_cpus_sync(void) { }
+
#endif /* !SMP */
/*
diff --git a/kernel/smp.c b/kernel/smp.c
index a61294c..d0ae5b2 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);
next prev parent reply other threads:[~2012-05-08 12:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-07 17:59 [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Thomas Gleixner
2012-05-07 17:59 ` [patch 1/8] powerpc: Fix broken cpu_idle_wait() implementation Thomas Gleixner
2012-05-08 12:25 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 2/8] smp: Implement kick_all_cpus_sync() Thomas Gleixner
2012-05-08 12:26 ` tip-bot for Thomas Gleixner [this message]
2012-05-07 17:59 ` [patch 3/8] cpuidle: Use kick_all_cpus_sync() Thomas Gleixner
2012-05-08 12:26 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 5/8] arm: Remove unused cpu_idle_wait() Thomas Gleixner
2012-05-08 12:28 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 4/8] x86: Use kick_all_cpus_sync() Thomas Gleixner
2012-05-08 12:27 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 6/8] powerpc: Remove unused cpu_idle_wait() Thomas Gleixner
2012-05-08 12:30 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 7/8] ia64: " Thomas Gleixner
2012-05-08 12:29 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 17:59 ` [patch 8/8] sh: Remove cpu_idle_wait() Thomas Gleixner
2012-05-08 12:31 ` [tip:smp/hotplug] " tip-bot for Thomas Gleixner
2012-05-07 20:06 ` [patch 0/8] cpuidle: Fix and replace cpu_idle_wait copied code Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-f37f435f33717dcf15fd4bb422da739da7fc2052@git.kernel.org \
--to=tglx@linutronix.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox