Re: [PATCH 4/4] lockdep: Fix workqueue crossrelease annotation
From: Peter Zijlstra
Date: Tue Sep 05 2017 - 05:36:42 EST
On Tue, Sep 05, 2017 at 05:57:27PM +0900, Byungchul Park wrote:
> On Tue, Sep 05, 2017 at 09:19:30AM +0200, Peter Zijlstra wrote:
> > On Tue, Sep 05, 2017 at 09:08:25AM +0200, Peter Zijlstra wrote:
> > > So you worry about max_active==1 ? Or you worry about pool->lock or
> > > about the thread setup? I'm still not sure.
> >
> > So the thing about pool->lock is that its a leaf lock, we take nothing
>
> I think the following sentence is a key, I hope...
>
> Leaf locks can also create dependecies with *crosslocks*. These
> dependencies are not built between holding locks like typical locks.
They can create dependencies, but they _cannot_ create deadlocks. So
there's no value in those dependencies.
> > And the whole setup stuff isn't properly preserved between works in any
> > case, only the first few works would ever see that history, so why
> > bother.
>
> As I said in another reply, what about (1), (3) and (5) in my example?
So for single-threaded workqueues, I'd like to get recursive-read sorted
and then we can make the lockdep_invariant_state() conditional.
Using recurisve-read lock for the wq lockdep_map's has the same effect
as your might thing without having to introduce new magic.