diff options
author | Per Fransson <per.xx.fransson@stericsson.com> | 2010-12-03 04:53:38 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-12-04 06:02:04 -0500 |
commit | b23065313297e750edd57ab6edfd36224826724e (patch) | |
tree | 93b2935d8d94bc702e35e2b99047a7d0dc931e8b | |
parent | cd849ae9cd291117c0f7e0e8d531ab62a906e308 (diff) |
ARM: 6522/1: kexec: Add call to non-crashing cores through IPI
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>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/kernel/machine_kexec.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index 3a8fd5140d7a..30ead135ff5f 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; | |||
23 | extern unsigned long kexec_mach_type; | 23 | extern unsigned long kexec_mach_type; |
24 | extern unsigned long kexec_boot_atags; | 24 | extern unsigned long kexec_boot_atags; |
25 | 25 | ||
26 | static atomic_t waiting_for_crash_ipi; | ||
27 | |||
26 | /* | 28 | /* |
27 | * Provide a dummy crash_notes definition while crash dump arrives to arm. | 29 | * Provide a dummy crash_notes definition while crash dump arrives to arm. |
28 | * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. | 30 | * This prevents breakage of crash_notes attribute in kernel/ksysfs.c. |
@@ -37,9 +39,37 @@ void machine_kexec_cleanup(struct kimage *image) | |||
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
42 | void machine_crash_nonpanic_core(void *unused) | ||
43 | { | ||
44 | struct pt_regs regs; | ||
45 | |||
46 | crash_setup_regs(®s, NULL); | ||
47 | printk(KERN_DEBUG "CPU %u will stop doing anything useful since another CPU has crashed\n", | ||
48 | smp_processor_id()); | ||
49 | crash_save_cpu(®s, smp_processor_id()); | ||
50 | flush_cache_all(); | ||
51 | |||
52 | atomic_dec(&waiting_for_crash_ipi); | ||
53 | while (1) | ||
54 | cpu_relax(); | ||
55 | } | ||
56 | |||
40 | void machine_crash_shutdown(struct pt_regs *regs) | 57 | void machine_crash_shutdown(struct pt_regs *regs) |
41 | { | 58 | { |
59 | unsigned long msecs; | ||
60 | |||
42 | local_irq_disable(); | 61 | local_irq_disable(); |
62 | |||
63 | atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); | ||
64 | smp_call_function(machine_crash_nonpanic_core, NULL, false); | ||
65 | msecs = 1000; /* Wait at most a second for the other cpus to stop */ | ||
66 | while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) { | ||
67 | mdelay(1); | ||
68 | msecs--; | ||
69 | } | ||
70 | if (atomic_read(&waiting_for_crash_ipi) > 0) | ||
71 | printk(KERN_WARNING "Non-crashing CPUs did not react to IPI\n"); | ||
72 | |||
43 | crash_save_cpu(regs, smp_processor_id()); | 73 | crash_save_cpu(regs, smp_processor_id()); |
44 | 74 | ||
45 | printk(KERN_INFO "Loading crashdump kernel...\n"); | 75 | printk(KERN_INFO "Loading crashdump kernel...\n"); |