locking/lockdep: Avoid triggering hardlockup from debug_show_all_locks()
authorTejun Heo <tj@kernel.org>
Mon, 22 Jan 2018 22:00:55 +0000 (14:00 -0800)
committerIngo Molnar <mingo@kernel.org>
Wed, 24 Jan 2018 09:00:09 +0000 (10:00 +0100)
debug_show_all_locks() iterates all tasks and print held locks whole
holding tasklist_lock.  This can take a while on a slow console device
and may end up triggering NMI hardlockup detector if someone else ends
up waiting for tasklist_lock.

Touch the NMI watchdog while printing the held locks to avoid
spuriously triggering the hardlockup detector.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kernel-team@fb.com
Link: http://lkml.kernel.org/r/20180122220055.GB1771050@devbig577.frc2.facebook.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/locking/lockdep.c

index 5fa1324a4f29a57901bdcf0ca81874a3dfd9a66c..52165904471963a7a70e6d2786ea88c64ecae431 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/gfp.h>
 #include <linux/random.h>
 #include <linux/jhash.h>
+#include <linux/nmi.h>
 
 #include <asm/sections.h>
 
@@ -4490,6 +4491,7 @@ retry:
                if (!unlock)
                        if (read_trylock(&tasklist_lock))
                                unlock = 1;
+               touch_nmi_watchdog();
        } while_each_thread(g, p);
 
        pr_warn("\n");