linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: olof@lixom.net (Olof Johansson)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] ARM: Stop secondary cpus in machine_halt()
Date: Sat, 3 Jul 2010 13:46:14 -0500	[thread overview]
Message-ID: <20100703184614.GA9693@lixom.net> (raw)
In-Reply-To: <20100701224706.GA26473@lixom.net>

ARM doesn't spin down secondary cpus on halt, which resulted interrupts
being delivered even after the "System halted" message, etc.

Change that to use smp_send_stop() to halt them.

Also, change the smp_send_stop() on ARM to not do a stack dump when
stopping the cpus during halt (but still print during other stops,
i.e. panic).

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 arch/arm/kernel/process.c |    6 ++++++
 arch/arm/kernel/smp.c     |   10 ++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index acf5e6f..203fc1b 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -191,6 +191,12 @@ __setup("reboot=", reboot_setup);
 
 void machine_halt(void)
 {
+#ifdef CONFIG_SMP
+	smp_send_stop();
+#endif
+	printk(KERN_EMERG "System halted, OK to turn off power\n");
+	local_irq_disable();
+	while (1) ;
 }
 
 
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index b8c3d0f..5496dea 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -467,10 +467,12 @@ static DEFINE_SPINLOCK(stop_lock);
  */
 static void ipi_cpu_stop(unsigned int cpu)
 {
-	spin_lock(&stop_lock);
-	printk(KERN_CRIT "CPU%u: stopping\n", cpu);
-	dump_stack();
-	spin_unlock(&stop_lock);
+	if (system_state != SYSTEM_HALT) {
+		spin_lock(&stop_lock);
+		printk(KERN_CRIT "CPU%u: stopping\n", cpu);
+		dump_stack();
+		spin_unlock(&stop_lock);
+	}
 
 	set_cpu_online(cpu, false);
 
-- 
1.5.6.5

  parent reply	other threads:[~2010-07-03 18:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-01 22:47 [PATCH] ARM: Stop secondary cpus in machine_halt() Olof Johansson
2010-07-01 23:11 ` Russell King - ARM Linux
2010-07-02  0:10   ` Olof Johansson
2010-07-03 18:46 ` Olof Johansson [this message]
2010-07-12 16:48   ` [PATCH v2] " Russell King - ARM Linux
2010-07-26 12:31     ` Russell King - ARM Linux
2010-07-26 15:26       ` Olof Johansson

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=20100703184614.GA9693@lixom.net \
    --to=olof@lixom.net \
    --cc=linux-arm-kernel@lists.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;
as well as URLs for NNTP newsgroup(s).