Re: [RFC] workqueue: Fix irq inversion deadlock in manage_workers()

From: Peter Zijlstra
Date: Mon Oct 09 2017 - 11:25:05 EST


On Mon, Oct 09, 2017 at 05:40:43PM +0800, Lai Jiangshan wrote:
> I didn't thought this kind of pattern is very seldom. I remember I saw several.

> mutex_lock();
> do_something();
> spin_lock_irq();
> record_the_state_for_ do_something().
> // keep the spin lock held to hold the state for do_more_things().
> mutex_unlock(); // unlock() is suggested to be called when just exiting C.S.
> do_more_things();
> spin_unlock_irq();
>
> Was all code of this pattern removed?
> Could it be possible that mutex will be changed to allow this?

So I think we did something similar to the rt_mutex in:

b4abf91047cf ("rtmutex: Make wait_lock irq safe")

And I would not be entirely against doing the same for our normal mutex,
but I've not really had time to read/think through this thread.