From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
tglx@linutronix.de,
Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH] lockdep: Do no validate wait context for novalidate class
Date: Mon, 29 Jun 2020 22:15:29 +0200 [thread overview]
Message-ID: <20200629201529.1017485-1-bigeasy@linutronix.de> (raw)
The novalidate class is ignored in the lockchain validation but is
considered in the wait context validation.
If a mutex and a spinlock_t is ignored by using
lockdep_set_novalidate_class() then both locks will share the same lock
class. From the wait validation point of view the mutex will then appear
like a spinlock_t and the validator will complain if another mutex will
be acquired.
Ignore the nonvalidate locks from wait context checking.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
kernel/locking/lockdep.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 29a8de4c50b90..fb9a642d8ebef 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4067,7 +4067,7 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)
*/
for (depth = curr->lockdep_depth - 1; depth >= 0; depth--) {
struct held_lock *prev = curr->held_locks + depth;
- if (prev->irq_context != next->irq_context)
+ if (prev->check && prev->irq_context != next->irq_context)
break;
}
depth++;
@@ -4078,6 +4078,9 @@ static int check_wait_context(struct task_struct *curr, struct held_lock *next)
struct held_lock *prev = curr->held_locks + depth;
short prev_inner = hlock_class(prev)->wait_type_inner;
+ if (!prev->check)
+ continue;
+
if (prev_inner) {
/*
* We can have a bigger inner than a previous one
--
2.27.0
next reply other threads:[~2020-06-29 20:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 20:15 Sebastian Andrzej Siewior [this message]
2020-08-20 9:05 ` [PATCH] lockdep: Do no validate wait context for novalidate class Sebastian Andrzej Siewior
2020-08-20 11:40 ` peterz
2020-08-20 11:43 ` Sebastian Andrzej Siewior
2020-08-20 12:38 ` peterz
2020-08-20 14:05 ` Sebastian Andrzej Siewior
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=20200629201529.1017485-1-bigeasy@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).