Skip to content

Commit 77819da

Browse files
0x7f454c46torvalds
authored andcommitted
kdb: don't play with console_loglevel
Print the stack trace with KERN_EMERG - it should be always visible. Playing with console_loglevel is a bad idea as there may be more messages printed than wanted. Also the stack trace might be not printed at all if printk() was deferred and console_loglevel was raised back before the trace got flushed. Unfortunately, after rebasing on commit 2277b49 ("kdb: Fix stack crawling on 'running' CPUs that aren't the master"), kdb_show_stack() uses now kdb_dump_stack_on_cpu(), which for now won't be converted as it uses dump_stack() instead of show_stack(). Convert for now the branch that uses show_stack() and remove console_loglevel exercise from that case. Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Acked-by: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jason Wessel <jason.wessel@windriver.com> Link: http://lkml.kernel.org/r/20200418201944.482088-48-dima@arista.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 3f05437 commit 77819da

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎kernel/debug/kdb/kdb_bt.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,18 @@
2121

2222
static void kdb_show_stack(struct task_struct *p, void *addr)
2323
{
24-
int old_lvl = console_loglevel;
25-
26-
console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
2724
kdb_trap_printk++;
2825

29-
if (!addr && kdb_task_has_cpu(p))
26+
if (!addr && kdb_task_has_cpu(p)) {
27+
int old_lvl = console_loglevel;
28+
29+
console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
3030
kdb_dump_stack_on_cpu(kdb_process_cpu(p));
31-
else
32-
show_stack(p, addr);
31+
console_loglevel = old_lvl;
32+
} else {
33+
show_stack_loglvl(p, addr, KERN_EMERG);
34+
}
3335

34-
console_loglevel = old_lvl;
3536
kdb_trap_printk--;
3637
}
3738

0 commit comments

Comments
 (0)