Skip to content

Commit 4388c9b

Browse files
npigginmpe
authored andcommitted
powerpc: Do not send system reset request through the oops path
A system reset is a request to crash / debug the system rather than necessarily caused by encountering a BUG. So there is no need to serialize all CPUs behind the die lock, adding taints to all subsequent traces beyond the first, breaking console locks, etc. The system reset is NMI context which has its own printk buffers to prevent output being interleaved. Then it's better to have all secondaries print out their debug as quickly as possible and the primary will flush out all printk buffers during panic(). So remove the 0x100 path from die, and move it into system_reset. Name the crash/dump reasons "System Reset". This gives "not tained" traces when crashing an untainted kernel. It also gives the panic reason as "System Reset" as opposed to "Fatal exception in interrupt" (or "die oops" for fadump). Signed-off-by: Nicholas Piggin <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent bded070 commit 4388c9b

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

arch/powerpc/kernel/traps.c

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -162,21 +162,9 @@ static void oops_end(unsigned long flags, struct pt_regs *regs,
162162

163163
crash_fadump(regs, "die oops");
164164

165-
/*
166-
* A system reset (0x100) is a request to dump, so we always send
167-
* it through the crashdump code.
168-
*/
169-
if (kexec_should_crash(current) || (TRAP(regs) == 0x100)) {
165+
if (kexec_should_crash(current))
170166
crash_kexec(regs);
171167

172-
/*
173-
* We aren't the primary crash CPU. We need to send it
174-
* to a holding pattern to avoid it ending up in the panic
175-
* code.
176-
*/
177-
crash_kexec_secondary(regs);
178-
}
179-
180168
if (!signr)
181169
return;
182170

@@ -303,17 +291,44 @@ void system_reset_exception(struct pt_regs *regs)
303291
goto out;
304292
}
305293

306-
die("System Reset", regs, SIGABRT);
294+
if (debugger(regs))
295+
goto out;
296+
297+
/*
298+
* A system reset is a request to dump, so we always send
299+
* it through the crashdump code (if fadump or kdump are
300+
* registered).
301+
*/
302+
crash_fadump(regs, "System Reset");
303+
304+
crash_kexec(regs);
305+
306+
/*
307+
* We aren't the primary crash CPU. We need to send it
308+
* to a holding pattern to avoid it ending up in the panic
309+
* code.
310+
*/
311+
crash_kexec_secondary(regs);
312+
313+
/*
314+
* No debugger or crash dump registered, print logs then
315+
* panic.
316+
*/
317+
__die("System Reset", regs, SIGABRT);
318+
319+
mdelay(2*MSEC_PER_SEC); /* Wait a little while for others to print */
320+
add_taint(TAINT_DIE, LOCKDEP_NOW_UNRELIABLE);
321+
nmi_panic(regs, "System Reset");
307322

308323
out:
309324
#ifdef CONFIG_PPC_BOOK3S_64
310325
BUG_ON(get_paca()->in_nmi == 0);
311326
if (get_paca()->in_nmi > 1)
312-
panic("Unrecoverable nested System Reset");
327+
nmi_panic(regs, "Unrecoverable nested System Reset");
313328
#endif
314329
/* Must die if the interrupt is not recoverable */
315330
if (!(regs->msr & MSR_RI))
316-
panic("Unrecoverable System Reset");
331+
nmi_panic(regs, "Unrecoverable System Reset");
317332

318333
if (!nested)
319334
nmi_exit();

0 commit comments

Comments
 (0)