diff --git a/kernel/hung_task.c b/kernel/hung_task.c index f108a95..2fddd98 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -164,6 +164,23 @@ static bool rcu_lock_break(struct task_struct *g, struct task_struct *t) return can_cont; } +static void print_all_running_threads(void) +{ +#ifdef CONFIG_SMP + struct task_struct *g; + struct task_struct *t; + + rcu_read_lock(); + for_each_process_thread(g, t) { + if (!t->on_cpu || t == current) + continue; + pr_err("INFO: Currently running\n"); + sched_show_task(t); + } + rcu_read_unlock(); +#endif +} + /* * Check whether a TASK_UNINTERRUPTIBLE does not get woken up for * a really long time (120 seconds). If that happens, print out @@ -201,7 +218,7 @@ static void check_hung_uninterruptible_tasks(unsigned long timeout) if (hung_task_show_lock) debug_show_all_locks(); if (hung_task_call_panic) { - trigger_all_cpu_backtrace(); + print_all_running_threads(); panic("hung_task: blocked tasks"); } } diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index e221be7..5ea9531 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -611,12 +611,6 @@ static void lockdep_print_held_locks(struct task_struct *p) else printk("%d lock%s held by %s/%d:\n", depth, depth > 1 ? "s" : "", p->comm, task_pid_nr(p)); - /* - * It's not reliable to print a task's held locks if it's not sleeping - * and it's not the current task. - */ - if (p->state == TASK_RUNNING && p != current) - return; for (i = 0; i < depth; i++) { printk(" #%d: ", i); print_lock(p->held_locks + i); diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 02ca827..95022a9 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -3322,3 +3322,19 @@ void kmsg_dump_rewind(struct kmsg_dumper *dumper) EXPORT_SYMBOL_GPL(kmsg_dump_rewind); #endif + +#include +static int ping_printk(void *unused) +{ + while (true) { + pr_info("kernel is alive.\n"); + schedule_timeout_idle(10 * HZ); + } + return 0; +} +static int __init ping_printk_init(void) +{ + kthread_run(ping_printk, NULL, "ping_printk"); + return 0; +} +late_initcall(ping_printk_init);