History

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 2277b492582d ("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.

Dmitry Safonov committed 6 years ago

Commit 77819da1 parent 3f054371 file · +8 −7Browse files

Showing the changes to kernel/debug (1 of 1 file). Show all

Unified · Split

kernel/debug/kdb/kdb_bt.c+8−7
@@ -21,17 +21,18 @@ · 20 unmodified lines
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