The patch titled Subject: kernel/hung_task.c: force console verbose before panic has been added to the -mm tree. Its filename is kernel-hung_taskc-force-console-verbose-before-panic.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/kernel-hung_taskc-force-console-verbose-before-panic.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/kernel-hung_taskc-force-console-verbose-before-panic.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: "Liu, Chuansheng" <chuansheng.liu@xxxxxxxxx> Subject: kernel/hung_task.c: force console verbose before panic Based on 401c636a0eeb ("kernel/hung_task.c: show all hung tasks before panic"), we could get the call stack of hung task. However, if the console loglevel is not high, we still can not see the useful panic information in practice, and in most cases users don't set console loglevel to high level. This patch is to force console verbose before system panic, so that the real useful information can be seen in the console, instead of being like the following, which doesn't have hung task information. [ 246.916600] INFO: task init:1 blocked for more than 120 seconds. [ 246.922320] Tainted: G U W 4.19.0-quilt-2e5dc0ac-g51b6c21d76cc #1 [ 246.926790] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 246.932553] Kernel panic - not syncing: hung_task: blocked tasks [ 246.938503] CPU: 2 PID: 479 Comm: khungtaskd Tainted: G U W 4.19.0-quilt-2e5dc0ac-g51b6c21d76cc #1 [ 246.990266] Call Trace: [ 246.991707] dump_stack+0x4f/0x65 [ 246.993710] panic+0xde/0x231 [ 246.995445] watchdog+0x290/0x410 [ 246.997390] kthread+0x12c/0x150 [ 246.999301] ? reset_hung_task_detector+0x20/0x20 [ 247.004825] ? kthread_create_worker_on_cpu+0x70/0x70 [ 247.007735] ret_from_fork+0x35/0x40 [ 247.010280] reboot: panic mode set: p,w [ 247.012619] Kernel Offset: 0x34000000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) Link: http://lkml.kernel.org/r/27240C0AC20F114CBF8149A2696CBE4A6015B675@xxxxxxxxxxxxxxxxxxxxxxxxxxxx Signed-off-by: Chuansheng Liu <chuansheng.liu@xxxxxxxxx> Reviewed-by: Petr Mladek <pmladek@xxxxxxxx> Reviewed-by: Sergey Senozhatsky <sergey.senozhatsky@xxxxxxxxx> Cc: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- --- a/kernel/hung_task.c~kernel-hung_taskc-force-console-verbose-before-panic +++ a/kernel/hung_task.c @@ -112,8 +112,11 @@ static void check_hung_task(struct task_ trace_sched_process_hang(t); - if (!sysctl_hung_task_warnings && !sysctl_hung_task_panic) - return; + if (sysctl_hung_task_panic) { + console_verbose(); + hung_task_show_lock = true; + hung_task_call_panic = true; + } /* * Ok, the task did not get scheduled for more than 2 minutes, @@ -135,11 +138,6 @@ static void check_hung_task(struct task_ } touch_nmi_watchdog(); - - if (sysctl_hung_task_panic) { - hung_task_show_lock = true; - hung_task_call_panic = true; - } } /* _ Patches currently in -mm which might be from chuansheng.liu@xxxxxxxxx are kernel-hung_taskc-force-console-verbose-before-panic.patch