[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1537886469-18227-2-git-send-email-longman@redhat.com>
Date: Tue, 25 Sep 2018 10:41:08 -0400
From: Waiman Long <longman@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will.deacon@....com>
Cc: linux-kernel@...r.kernel.org,
Yang Shi <yang.shi@...ux.alibaba.com>,
Arnd Bergmann <arnd@...db.de>, chuhu@...hat.com,
Waiman Long <longman@...hat.com>
Subject: [PATCH v2 1/2] locking/lockdep: Don't warn class/lock name mismatch for novalidate class
For the special novalidate class (lockdep_set_novalidate_class), multiple
locks with different names may use the same class. The WARN_ON_ONCE()
check in look_up_lock_class() will then report an unnecessary warning.
The current users of lockdep_set_novalidate_class() includes the
device mutex, one mutex and one rwsem in drivers/md/bcache/btree.c.
So the novalidate class is now excluded from the check.
Signed-off-by: Waiman Long <longman@...hat.com>
---
kernel/locking/lockdep.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index dd13f865ad40..10babc35953b 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -693,9 +693,12 @@ look_up_lock_class(const struct lockdep_map *lock, unsigned int subclass)
if (class->key == key) {
/*
* Huh! same key, different name? Did someone trample
- * on some memory? We're most confused.
+ * on some memory? We're most confused unless it is
+ * __lockdep_no_validate__ where different locks can
+ * use the same class.
*/
- WARN_ON_ONCE(class->name != lock->name);
+ WARN_ON_ONCE((key != __lockdep_no_validate__.subkeys) &&
+ (class->name != lock->name));
return class;
}
}
--
2.18.0
Powered by blists - more mailing lists