Re: [PATCH 4/4] lockdep: Fix workqueue crossrelease annotation

From: Byungchul Park
Date: Tue Sep 05 2017 - 20:48:37 EST


On Tue, Sep 05, 2017 at 03:46:43PM +0200, Peter Zijlstra wrote:
> On Tue, Sep 05, 2017 at 07:58:38PM +0900, Byungchul Park wrote:
> > On Tue, Sep 05, 2017 at 07:31:44PM +0900, Byungchul Park wrote:
> > > Recursive-read and the hint I proposed(a.k.a. might) should be used for
> > > their different specific applications. Both meaning and constraints of
> > > them are totally different.
> > >
> > > Using a right function semantically is more important than making it
> > > just work, as you know. Wrong?
>
> > Of course, in the following cases, the results are same:
> >
> > recursive-read(A) -> recursive-read(A), is like nothing, and also
> > might(A) -> might(A) , is like nothing.
> >
> > recursive-read(A) -> lock(A), end in a deadlock, and also
> > might(A) -> lock(A), end in a deadlock.
>
> And these are exactly the cases we need.
>
> > Futhermore, recursive-read-might() can be used if needed, since their
> > semantics are orthogonal so they can be used in mixed forms.
> >
> > I really hope you accept the new semantics... I think current workqueue
> > code exactly needs the semantics.
>
> I really don't want to introduce this extra state if we don't have to.
> And as you already noted, this 'might' thing of yours doesn't belong in
> the .read argument, since as you say its orthogonal.

Right. Of course, it can be changed to be a proper form if allowed. I
was afraid to introduce another new function instead of using an arg.

> recursive-read
> wait_for_completion()
> recursive-read
> complete()
>
> is fundamentally not a deadlock, we don't need anything extra.

It might be ok wrt the workqueue. But, I think generally the
recursive-read is not a good option for that purpose.