Re: Revert "leds: avoid races with workqueue"?
From: Hugh Dickins
Date: Sun May 26 2019 - 16:39:47 EST
On Sun, 26 May 2019, Pavel Machek wrote:
> On Sat 2019-05-25 10:32:31, Hugh Dickins wrote:
> >
> > Thanks, Pavel: yes, that works fine for me on the T420s, no debug
> > complaints, good and silent; and the wifi LED is blinking as before.
>
> I'd like to prevent recurrence of similar problem, and I wonder if you
> can give me a hint.
>
> I can annotate code that can sleep with might_sleep().
>
> How can I annotate code that can not sleep? I might do
>
> spin_lock(&dummy);
> this_should_not_sleep();
> spin_unlock(&dummy);
>
> But I don't really need extra serialization. I just want annotations for
> lockdep. Any ideas?
I haven't tried to do that directly, so I'm likely to give bad advice:
in particular, I forget the limitations of checking in_atomic().
But very useful (and much cheaper than lockdep) debug options in
this area are CONFIG_DEBUG_PREEMPT and CONFIG_DEBUG_ATOMIC_SLEEP.
Hugh