From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: peterz@infradead.org
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
Will Deacon <will@kernel.org>,
tglx@linutronix.de, kent.overstreet@gmail.com
Subject: Re: [PATCH] lockdep: Do no validate wait context for novalidate class
Date: Thu, 20 Aug 2020 16:05:52 +0200 [thread overview]
Message-ID: <20200820140552.5xtk23a3lxvcfpvu@linutronix.de> (raw)
In-Reply-To: <20200820123859.GS2674@hirez.programming.kicks-ass.net>
On 2020-08-20 14:38:59 [+0200], peterz@infradead.org wrote:
> On Thu, Aug 20, 2020 at 01:43:48PM +0200, Sebastian Andrzej Siewior wrote:
> > On 2020-08-20 13:40:36 [+0200], peterz@infradead.org wrote:
> > > Anyway, all 3 users should have the same wait context, so where is the
> > > actual problem?
> >
> > I have one in RT which is a per-CPU spinlock within local_bh_disable()
> > to act as a per-CPU BLK like mainline.
>
> Then can we get to see that code and an explanation for what the problem
> is and why it is still correct?
An actual backtrace looks like this:
| WARNING: possible circular locking dependency detected
…
| Possible unsafe locking scenario:
|
| CPU0 CPU1
| ---- ----
| lock(k-sk_lock-AF_NETLINK);
| lock((l).lock#2);
| lock(k-sk_lock-AF_NETLINK);
| lock((l).lock#2);
|
| *** DEADLOCK ***
The "k-sk_lock-AF_NETLINK" is global but "(l).lock#2" is per CPU. The
circular dependency can not occur because CPU0 and CPU1 can acquire the
lock simultaneously.
The softirq code is at
https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/tree/patches/softirq-Add-preemptible-softirq.patch?h=linux-5.6.y-rt-patches&id=4ce1fda10dae882d494c6430cc438ff645a35603#n146
I'm not sure why sk_lock on CPU0 is before (l).lock. It doesn't change
even if the lock is acquired after trace_softirqs_off(). If the sk_lock
would be acquired with enabled BH then lockdep would complain.
The lovely in_atomic() check is due to irq_enter(), preempt_disable() +
local_bh_disable() and others.
> Because as is, this patch isn't needed.
I can hold on to this and maybe it is not needed the final version of
softirq ends up to be different :)
Thanks.
Sebastian
prev parent reply other threads:[~2020-08-20 14:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-29 20:15 Sebastian Andrzej Siewior
2020-08-20 9:05 ` 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 [this message]
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=20200820140552.5xtk23a3lxvcfpvu@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=kent.overstreet@gmail.com \
--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
all inboxes | Powered by JetHome®