lkml.org 
[lkml]   [2022]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] lockdep: report name and key when look_up_lock_class() got confused
On Mon, Sep 19, 2022 at 12:01:30AM +0900, Tetsuo Handa wrote:
> Printing this information will be helpful.
>
> ------------[ cut here ]------------
> class->name=slock-AF_INET6 lock->name=l2tp_sock lock->key=l2tp_socket_class
> WARNING: CPU: 2 PID: 9237 at kernel/locking/lockdep.c:940 look_up_lock_class+0xcc/0x140
> Modules linked in:
> CPU: 2 PID: 9237 Comm: a.out Not tainted 6.0.0-rc5-00094-ga335366bad13-dirty #860
> 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>
> ---
> kernel/locking/lockdep.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
> index 64a13eb56078..a22469dbeeee 100644
> --- a/kernel/locking/lockdep.c
> +++ b/kernel/locking/lockdep.c
> @@ -934,8 +934,10 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)
> * Huh! same key, different name? Did someone trample
> * on some memory? We're most confused.
> */
> - WARN_ON_ONCE(class->name != lock->name &&
> - lock->key != &__lockdep_no_validate__);
> + WARN_ONCE(class->name != lock->name &&
> + lock->key != &__lockdep_no_validate__,
> + "class->name=%s lock->name=%s lock->key=%ps\n",
> + class->name, lock->name, lock->key);

Maybe more human readable information like:

"Looking for class \"%s\" with key %ps, but found a different class \"%s\" with the same key\n"
lock->name, lock->key, class->name);

?

Regards,
Boqun

> return class;
> }
> }
> --
> 2.34.1
>

\
 
 \ /
  Last update: 2022-09-18 20:32    [W:0.078 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site