Re: [PATCH] lockdep: Enable the printing of held locks of running non-current tasks
From: Tetsuo Handa
Date: Sun Jul 05 2026 - 07:06:23 EST
On 2026/07/05 18:05, Ingo Molnar wrote:
> TL;DR: it should be fine to print the held locks of running
> tasks too, as long as we print out a warning when we print
> such a task, so that users are aware of any racy output.
>
> The (lightly tested) patch below implements this.
>
> Note that this way there's no need to gate this on the Syzkaller
> config option, and you wouldn't have to carry it in -next either,
> it's a useful mainline kernel debuggability enhancement in its
> own right.
>
> Would this work for you?
Yes, this will be a helpful change. Thank you very much.
I can drop "locking/lockdep: make lockdep_print_held_locks() always print
if CONFIG_DEBUG_AID_FOR_SYZBOT=y" change from linux-next tree.
Please avoid emitting "BUG:" or "WARNING:", for syzkaller stops upon
encountering these strings. Also, since printk() is a slow operation,
please reduce number of characters to print where reasonable.
- msg_running = " (WARNING: task running)";
+ msg_running = " (running)";
If we can safely calculate on which CPU that thread is running (or waiting
to run), printing CPU number might be also helpful.
char msg_running[14] = "";
if (task_is_running(p)) {
int cpu_id = which_cpu_task_is_on(p); // If possible...
if (cpu_id >= 0)
scnprintf(msg_running, sizeof(msg_running), "(C%u)", cpu_id);
else
scnprintf(msg_running, sizeof(msg_running), "(running)");
}