Skip to content

Commit 76e64c7

Browse files
Tetsuo HandaIngo Molnar
authored andcommitted
locking/lockdep: Print more debug information - report name and key when look_up_lock_class() got confused
Printing this information will be helpful: ------------[ cut here ]------------ Looking for class "l2tp_sock" with key l2tp_socket_class, but found a different class "slock-AF_INET6" with the same key WARNING: CPU: 1 PID: 14195 at kernel/locking/lockdep.c:940 look_up_lock_class+0xcc/0x140 Modules linked in: CPU: 1 PID: 14195 Comm: a.out Not tainted 6.0.0-rc6-dirty torvalds#863 Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 RIP: 0010:look_up_lock_class+0xcc/0x140 Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Signed-off-by: Ingo Molnar <mingo@kernel.org> Link: https://lore.kernel.org/r/bd99391e-f787-efe9-5ec6-3c6dc4c587b0@I-love.SAKURA.ne.jp
1 parent 74656d0 commit 76e64c7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/locking/lockdep.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,10 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)
934934
* Huh! same key, different name? Did someone trample
935935
* on some memory? We're most confused.
936936
*/
937-
WARN_ON_ONCE(class->name != lock->name &&
938-
lock->key != &__lockdep_no_validate__);
937+
WARN_ONCE(class->name != lock->name &&
938+
lock->key != &__lockdep_no_validate__,
939+
"Looking for class \"%s\" with key %ps, but found a different class \"%s\" with the same key\n",
940+
lock->name, lock->key, class->name);
939941
return class;
940942
}
941943
}

0 commit comments

Comments
 (0)