Re: single-threaded wq lockdep is broken

2017-06-13 Thread Tejun Heo
Hello, Johannes reported that lockdep warning on single threaded workqueues doesn't work anymore. Nothing really changed there and all the relevant lockdep annotaitons are being invoked correctly. The following is the extracted lockdep-only reproducer. The culprit seems to be lock_map_acquire_r

Re: single-threaded wq lockdep is broken

2017-06-02 Thread Johannes Berg
On Fri, 2017-06-02 at 15:03 +0800, Lai Jiangshan wrote: > > the @w2 is not queued before flush_work(&w2), it is expected > that @w2 is not associated with @wq, and the dependence > mtx -> wq will not be recorded. And it is expected no warning. Lockdep is symmetric. So then maybe it won't warn whe

Re: single-threaded wq lockdep is broken

2017-06-02 Thread Lai Jiangshan
On Wed, May 31, 2017 at 4:36 PM, Johannes Berg wrote: > Hi, > >> > #include >> > #include >> > #include >> > #include >> > #include >> > >> > DEFINE_MUTEX(mtx); >> > static struct workqueue_struct *wq; >> > static struct work_struct w1, w2; >> > >> > static void w1_wk(struct work_struct *w) >

Re: single-threaded wq lockdep is broken

2017-05-31 Thread Johannes Berg
Hi Tejun, > On Sun, May 28, 2017 at 09:33:13PM +0200, Johannes Berg wrote: > > I suspect this is a long-standing bug introduced by all the pool > > rework > > you did at some point, but I don't really know nor can I figure out > > how > > to fix it right now. I guess it could possibly also be a lo

Re: single-threaded wq lockdep is broken

2017-05-31 Thread Tejun Heo
Hello, Johannes. On Sun, May 28, 2017 at 09:33:13PM +0200, Johannes Berg wrote: > I suspect this is a long-standing bug introduced by all the pool rework > you did at some point, but I don't really know nor can I figure out how > to fix it right now. I guess it could possibly also be a lockdep iss

Re: single-threaded wq lockdep is broken

2017-05-31 Thread Johannes Berg
On Wed, 2017-05-31 at 10:36 +0200, Johannes Berg wrote: > > This was "ifndef", so it does in fact run here, just like you > suggested. It doesn't warn though. Also, even if DEADLOCK *is* defined, lockdep doesn't report anything. johannes

Re: single-threaded wq lockdep is broken

2017-05-31 Thread Johannes Berg
Hi, > > #include > > #include > > #include > > #include > > #include > > > > DEFINE_MUTEX(mtx); > > static struct workqueue_struct *wq; > > static struct work_struct w1, w2; > > > > static void w1_wk(struct work_struct *w) > > { > > mutex_lock(&mtx); > > msleep(100); > >    

Re: single-threaded wq lockdep is broken

2017-05-31 Thread Lai Jiangshan
On Mon, May 29, 2017 at 3:33 AM, Johannes Berg wrote: > Hi Tejun, > > I suspect this is a long-standing bug introduced by all the pool rework > you did at some point, but I don't really know nor can I figure out how > to fix it right now. I guess it could possibly also be a lockdep issue, > or an

single-threaded wq lockdep is broken

2017-05-28 Thread Johannes Berg
Hi Tejun, I suspect this is a long-standing bug introduced by all the pool rework you did at some point, but I don't really know nor can I figure out how to fix it right now. I guess it could possibly also be a lockdep issue, or an issue in how it's used, but I definitely know that this used to wo