[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180222154456.eno5mvqzvdamvqdx@tardis>
Date: Thu, 22 Feb 2018 23:44:56 +0800
From: Boqun Feng <boqun.feng@...il.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Andrea Parri <parri.andrea@...il.com>
Subject: Re: [RFC tip/locking/lockdep v5 06/17] lockdep: Support deadlock
detection for recursive read in check_noncircular()
On Thu, Feb 22, 2018 at 04:16:26PM +0100, Peter Zijlstra wrote:
> On Thu, Feb 22, 2018 at 03:54:34PM +0100, Peter Zijlstra wrote:
> > On Thu, Feb 22, 2018 at 03:08:53PM +0800, Boqun Feng wrote:
> >
> > > +static inline int hlock_conflict(struct lock_list *entry, void *data)
> > > +{
> > > + struct held_lock *hlock = (struct held_lock *)data;
> > > +
> > > + return hlock_class(hlock) == entry->class &&
> > > + (hlock->read != 2 || !entry->is_rr);
> > > +}
> >
> > Bah, brain hurts.
> >
> > So before we add prev -> this, relation, we check if there's a this ->
> > prev relation already in the graph -- if so that would be a problem.
> >
> > The above function has @data == @prev (__bfs_forward starts at @this,
> > looking for @prev), and the above patch augments the 'class_equal' test
> > with @prev not having read==2 or @entry not having xr;
> >
> > This is because.... (insert brain hurt)
>
> (hlock->read != 2 || !entry->have_xr) := !(hlock->read == 2 && entry->have_xr)
>
> hlock->read == 2 := prev->read == 2
> entry->have_xr means the last fwd link has read==2.
>
> Together this gives that:
>
> @prev (Rx) ---> X ---> @entry (xR)
>
> does not form a cycle, because:
>
> @enrty (xR) -> @prev (Rx)
>
> is not strong and can be ignored.
>
> Did I get that right? If so, the Changelog needs serious help and code
Yep.. I was about to rely you with something similar.. I will add a
comment for this function and other "brain-hurting" functions too.
Sorry for the headache ;-(
Regards,
Boqun
> does too.
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists