lockdep: Print the shortest dependency chain if finding a circle
authorMing Lei <tom.leiming@gmail.com>
Thu, 16 Jul 2009 13:44:29 +0000 (15:44 +0200)
committerPeter Zijlstra <a.p.zijlstra@chello.nl>
Fri, 24 Jul 2009 08:49:44 +0000 (10:49 +0200)
commitc94aa5ca3088018d2a7a9bd3258aefffe29df265
tree29c81673e37315087ee3087180fae043085e6343
parent4be3bd7849165e7efa6b0b35a23d6a3598d97465
lockdep: Print the shortest dependency chain if finding a circle

Currently lockdep will print the 1st circle detected if it
exists when acquiring a new (next) lock.

This patch prints the shortest path from the next lock to be
acquired to the previous held lock if a circle is found.

The patch still uses the current method to check circle, and
once the circle is found, breadth-first search algorithem is
used to compute the shortest path from the next lock to the
previous lock in the forward lock dependency graph.

Printing the shortest path will shorten the dependency chain,
and make troubleshooting for possible circular locking easier.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1246201486-7308-2-git-send-email-tom.leiming@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
include/linux/lockdep.h
kernel/lockdep.c
kernel/lockdep_internals.h