aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMike J. Chen <mjchen@google.com>2012-05-24 15:12:36 -0700
committerZiyan <jaraidaniel@gmail.com>2016-03-11 15:57:54 +0100
commit46b24a817e4e9976e28ea88b0fd352b8e49dcb43 (patch)
tree157f6e9f82ac744ea153f978cfa72cdd4f89fcc6 /arch
parent58cb59cc4a7fa627fa95dae28f32c51d74e4e353 (diff)
downloadkernel_samsung_espresso10-46b24a817e4e9976e28ea88b0fd352b8e49dcb43.zip
kernel_samsung_espresso10-46b24a817e4e9976e28ea88b0fd352b8e49dcb43.tar.gz
kernel_samsung_espresso10-46b24a817e4e9976e28ea88b0fd352b8e49dcb43.tar.bz2
ARM: disable preemption in machine_shutdown
Since the smp call to stop the other cpus are handled in those cpus in interrupt context, there's a potential for those smp handlers to interrupt threads holding spin locks (such as the one a mutex holds). This prevents those threads from ever releasing their spin lock, so if the cpu doing the shutdown is allowed to switch to another thread that tries to grab the same lock/mutex, we could get into a deadlock (the spin lock call is called with preemption disabled in the mutex lock code). To avoid that possibility, disable preemption before doing the smp_send_stop(). Change-Id: I7976c5382d7173fcb3cd14da8cc5083d442b2544 Signed-off-by: Mike J. Chen <mjchen@google.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/process.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index e5cfa6a..c132e81 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -272,6 +272,15 @@ __setup("reboot=", reboot_setup);
void machine_shutdown(void)
{
#ifdef CONFIG_SMP
+ /*
+ * Disable preemption so we're guaranteed to
+ * run to power off or reboot and prevent
+ * the possibility of switching to another
+ * thread that might wind up blocking on
+ * one of the stopped CPUs.
+ */
+ preempt_disable();
+
smp_send_stop();
#endif
}