mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Will Deacon <will.deacon@arm.com>
Cc: linux-kernel@vger.kernel.org,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Arnd Bergmann <arnd@arndb.de>,
	chuhu@redhat.com, Waiman Long <longman@redhat.com>
Subject: [PATCH v2 1/2] locking/lockdep: Don't warn class/lock name mismatch for novalidate class
Date: Tue, 25 Sep 2018 10:41:08 -0400	[thread overview]
Message-ID: <1537886469-18227-2-git-send-email-longman@redhat.com> (raw)
In-Reply-To: <1537886469-18227-1-git-send-email-longman@redhat.com>

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@redhat.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


  reply	other threads:[~2018-09-25 14:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 14:41 [PATCH v2 0/2] debugobjects: Fix potential hard lockup by disabling lockdep Waiman Long
2018-09-25 14:41 ` Waiman Long [this message]
2018-09-25 14:41 ` [PATCH v2 2/2] debugobjects: Disable lockdep tracking of debugobjects internal locks Waiman Long
2018-09-25 15:32   ` Peter Zijlstra
2018-09-25 16:20     ` Waiman Long
2018-09-25 16:31       ` Peter Zijlstra
2018-09-25 16:36         ` Waiman Long
2018-09-28 18:33           ` Waiman Long

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1537886469-18227-2-git-send-email-longman@redhat.com \
    --to=longman@redhat.com \
    --cc=arnd@arndb.de \
    --cc=chuhu@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.com \
    --cc=yang.shi@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®