From: Boqun Feng <boqun.feng@gmail.com>
To: Hillf Danton <hdanton@sina.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Peter Zijlstra <peterz@infradead.org>,
"Paul E. McKenney" <paulmck@kernel.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Joel Fernandes <joel@joelfernandes.org>
Subject: Re: [PATCH 2/3] rcu: Equip sleepable RCU with lockdep dependency graph checks
Date: Fri, 13 Jan 2023 16:17:59 -0800 [thread overview]
Message-ID: <Y8H0twLVEnM6jkgq@boqun-archlinux> (raw)
In-Reply-To: <20230113235809.1085-1-hdanton@sina.com>
On Sat, Jan 14, 2023 at 07:58:09AM +0800, Hillf Danton wrote:
> On 13 Jan 2023 09:58:10 -0800 Boqun Feng <boqun.feng@gmail.com>
> > On Fri, Jan 13, 2023 at 09:03:30PM +0800, Hillf Danton wrote:
> > > On 12 Jan 2023 22:59:54 -0800 Boqun Feng <boqun.feng@gmail.com>
> > > > --- a/kernel/rcu/srcutree.c
> > > > +++ b/kernel/rcu/srcutree.c
> > > > @@ -1267,6 +1267,8 @@ static void __synchronize_srcu(struct srcu_struct *ssp, bool do_norm)
> > > > {
> > > > struct rcu_synchronize rcu;
> > > >
> > > > + srcu_lock_sync(&ssp->dep_map);
> > > > +
> > > > RCU_LOCKDEP_WARN(lockdep_is_held(ssp) ||
> > > > lock_is_held(&rcu_bh_lock_map) ||
> > > > lock_is_held(&rcu_lock_map) ||
> > > > --
> > > > 2.38.1
> > >
> > > The following deadlock is able to escape srcu_lock_sync() because the
> > > __lock_release folded in sync leaves one lock on the sync side.
> > >
> > > cpu9 cpu0
> > > --- ---
> > > lock A srcu_lock_acquire(&ssp->dep_map);
> > > srcu_lock_sync(&ssp->dep_map);
> > > lock A
> >
> > But isn't it just the srcu_mutex_ABBA test case in patch #3, and my run
> > of lockdep selftest shows we can catch it. Anything subtle I'm missing?
>
> I am leaning to not call it ABBA deadlock, because B is unlocked.
>
> task X task Y
> --- ---
> lock A
> lock B
> lock B
> unlock B
> wait_for_completion E
>
> lock A
> complete E
>
> And no deadlock should be detected/caught after B goes home.
Your example makes me more confused.. given the case:
task X task Y
--- ---
mutex_lock(A);
srcu_read_lock(B);
synchronze_srcu(B);
mutex_lock(A);
isn't it a deadlock? If your example, A, B or E which one is srcu?
Regards,
Boqun
next prev parent reply other threads:[~2023-01-14 0:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230113065955.815667-1-boqun.feng@gmail.com>
[not found] ` <20230113065955.815667-3-boqun.feng@gmail.com>
2023-01-13 13:03 ` Hillf Danton
2023-01-13 17:58 ` Boqun Feng
2023-01-13 23:58 ` Hillf Danton
2023-01-14 0:17 ` Boqun Feng [this message]
2023-01-14 7:18 ` Hillf Danton
2023-01-14 7:32 ` Boqun Feng
2023-01-14 10:26 ` Hillf Danton
2023-01-15 0:18 ` Boqun Feng
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=Y8H0twLVEnM6jkgq@boqun-archlinux \
--to=boqun.feng@gmail.com \
--cc=hdanton@sina.com \
--cc=joel@joelfernandes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paulmck@kernel.org \
--cc=pbonzini@redhat.com \
--cc=peterz@infradead.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