On Wed, May 02, 2018 at 04:48:32PM +0000, Song Liu wrote: > > It's broken though, I've bet you've never actually ran this with lockdep > > enabled for example. > > I am not following here. I just run the new selftest with CONFIG_LOCKDEP on, > and got no warning for this.
Weird, I would be expecting complaints about releasing an unheld lock. nmi_enter(),nmi_exit() have lockdep_off(),lockdep_on() resp. Which means that the down_trylock() will not be recorded. The up, which is done from IRQ context, will not be so supressed and should hit print_unlock_imbalance_bug(). > > Also, you set work->sem before you do trylock, if the trylock fails you > > return early and keep work->sem set, which will thereafter always result > > in irq_work_busy. > > work->sem was set after down_read_trylock(). I guess you misread the patch? Argh, yes indeed. Sorry.