Skip to content

Commit 3f388f2

Browse files
aiktorvalds
authored andcommitted
panic: dump registers on panic_on_warn
Currently we print stack and registers for ordinary warnings but we do not for panic_on_warn which looks as oversight - panic() will reboot the machine but won't print registers. This moves printing of registers and modules earlier. This does not move the stack dumping as panic() dumps it. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Kees Cook <keescook@chromium.org> Cc: Douglas Anderson <dianders@chromium.org> Cc: Ingo Molnar <mingo@kernel.org> Cc: Kees Cook <keescook@chromium.org> Cc: Rafael Aquini <aquini@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will@kernel.org> Cc: Nicholas Piggin <npiggin@gmail.com> Link: https://lkml.kernel.org/r/20200804095054.68724-1-aik@ozlabs.ru Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 85094c0 commit 3f388f2

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

kernel/panic.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,11 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
589589
if (args)
590590
vprintk(args->fmt, args->args);
591591

592+
print_modules();
593+
594+
if (regs)
595+
show_regs(regs);
596+
592597
if (panic_on_warn) {
593598
/*
594599
* This thread may hit another WARN() in the panic path.
@@ -600,12 +605,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint,
600605
panic("panic_on_warn set ...\n");
601606
}
602607

603-
print_modules();
604-
605-
if (regs)
606-
show_regs(regs);
607-
else
608-
dump_stack();
608+
dump_stack();
609609

610610
print_irqtrace_events(current);
611611

0 commit comments

Comments
 (0)