aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/panic.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/panic.c')
-rw-r--r--kernel/panic.c47
1 files changed, 40 insertions, 7 deletions
diff --git a/kernel/panic.c b/kernel/panic.c
index ca8cea1ef673..e6480e20379e 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -71,6 +71,32 @@ void __weak nmi_panic_self_stop(struct pt_regs *regs)
71 panic_smp_self_stop(); 71 panic_smp_self_stop();
72} 72}
73 73
74/*
75 * Stop other CPUs in panic. Architecture dependent code may override this
76 * with more suitable version. For example, if the architecture supports
77 * crash dump, it should save registers of each stopped CPU and disable
78 * per-CPU features such as virtualization extensions.
79 */
80void __weak crash_smp_send_stop(void)
81{
82 static int cpus_stopped;
83
84 /*
85 * This function can be called twice in panic path, but obviously
86 * we execute this only once.
87 */
88 if (cpus_stopped)
89 return;
90
91 /*
92 * Note smp_send_stop is the usual smp shutdown function, which
93 * unfortunately means it may not be hardened to work in a panic
94 * situation.
95 */
96 smp_send_stop();
97 cpus_stopped = 1;
98}
99
74atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID); 100atomic_t panic_cpu = ATOMIC_INIT(PANIC_CPU_INVALID);
75 101
76/* 102/*
@@ -164,14 +190,21 @@ void panic(const char *fmt, ...)
164 if (!_crash_kexec_post_notifiers) { 190 if (!_crash_kexec_post_notifiers) {
165 printk_nmi_flush_on_panic(); 191 printk_nmi_flush_on_panic();
166 __crash_kexec(NULL); 192 __crash_kexec(NULL);
167 }
168 193
169 /* 194 /*
170 * Note smp_send_stop is the usual smp shutdown function, which 195 * Note smp_send_stop is the usual smp shutdown function, which
171 * unfortunately means it may not be hardened to work in a panic 196 * unfortunately means it may not be hardened to work in a
172 * situation. 197 * panic situation.
173 */ 198 */
174 smp_send_stop(); 199 smp_send_stop();
200 } else {
201 /*
202 * If we want to do crash dump after notifier calls and
203 * kmsg_dump, we will need architecture dependent extra
204 * works in addition to stopping other CPUs.
205 */
206 crash_smp_send_stop();
207 }
175 208
176 /* 209 /*
177 * Run any panic handlers, including those that might need to 210 * Run any panic handlers, including those that might need to