linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add call to non-crashing cores through IPI
@ 2010-11-19 10:08 Per Fransson
  2010-11-22  7:24 ` Mika Westerberg
  0 siblings, 1 reply; 23+ messages in thread
From: Per Fransson @ 2010-11-19 10:08 UTC (permalink / raw)
  To: linux-arm-kernel

When kexec is used to start a crash kernel the other cores
are notified. These non-crashing cores will save their state
in the crash notes and then do nothing.

Signed-off-by: Per Fransson <per.xx.fransson@stericsson.com>
---
 arch/arm/kernel/machine_kexec.c |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 3a8fd51..56683db 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -23,6 +23,8 @@ extern unsigned long kexec_indirection_page;
 extern unsigned long kexec_mach_type;
 extern unsigned long kexec_boot_atags;
 
+static atomic_t waiting_for_crash_ipi;
+
 /*
  * Provide a dummy crash_notes definition while crash dump arrives to arm.
  * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
@@ -37,8 +39,34 @@ void machine_kexec_cleanup(struct kimage *image)
 {
 }
 
+void machine_crash_nonpanic_core(void *unused)
+{
+	struct pt_regs regs;
+
+	crash_setup_regs(&regs, NULL);
+	printk(KERN_EMERG "CPU %u will stop doing anything useful since another CPU has crashed\n",
+	       smp_processor_id());
+	crash_save_cpu(&regs, smp_processor_id());
+	flush_cache_all();
+
+	atomic_dec(&waiting_for_crash_ipi);
+	while (1)
+		cpu_relax();
+}
+
 void machine_crash_shutdown(struct pt_regs *regs)
 {
+	unsigned long msecs;
+
+	atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
+
+	local_irq_enable();
+	smp_call_function(machine_crash_nonpanic_core, NULL, false);
+	msecs = 1000; /* Wait at most a second for the other cpus to stop */
+	while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
+		mdelay(1);
+		msecs--;
+	}
 	local_irq_disable();
 	crash_save_cpu(regs, smp_processor_id());
 
-- 
1.7.2.2

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2010-11-23 16:31 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-19 10:08 [PATCH] Add call to non-crashing cores through IPI Per Fransson
2010-11-22  7:24 ` Mika Westerberg
2010-11-22  9:47   ` Maxim Uvarov
2010-11-22  9:53   ` Per Fransson
2010-11-22 10:47     ` Russell King - ARM Linux
2010-11-22 11:27       ` Russell King - ARM Linux
2010-11-22 13:07         ` Santosh Shilimkar
2010-11-22 14:21           ` Russell King - ARM Linux
2010-11-22 17:25             ` Santosh Shilimkar
2010-11-22 14:31         ` Per Fransson
2010-11-22 14:40           ` Russell King - ARM Linux
2010-11-22 17:03             ` Per Fransson
2010-11-22 17:12               ` Catalin Marinas
2010-11-22 20:09                 ` Maxim Uvarov
2010-11-22 22:14                   ` Per Fransson
2010-11-22 22:30                     ` Per Fransson
2010-11-23  9:14                   ` Catalin Marinas
2010-11-23 10:57                     ` Per Fransson
2010-11-23 12:37                       ` Catalin Marinas
2010-11-23 12:41                         ` Mika Westerberg
2010-11-23 12:48                           ` Catalin Marinas
2010-11-23 13:01                             ` Maxim Uvarov
2010-11-23 16:31                               ` Per Fransson

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).