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.
Showing the changes to kernel/debug (1 of 1 file). Show all
Unified · Split
| @@ -21,17 +21,18 @@ · 20 unmodified lines | ||
| 21 | 21 | |
| 22 | 22 | static void kdb_show_stack(struct task_struct *p, void *addr) |
| 23 | 23 | { |
| 24 | − int old_lvl = console_loglevel; | |
| 25 | − | |
| 26 | − console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH; | |
| 27 | 24 | kdb_trap_printk++; |
| 28 | 25 | |
| 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; | |
| 30 | 30 | 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 | + } | |
| 33 | 35 | |
| 34 | − console_loglevel = old_lvl; | |
| 35 | 36 | kdb_trap_printk--; |
| 36 | 37 | } |
| 37 | 38 | |