Re: [patch 1/1] genirq: Disable interrupts for force threaded handlers

From: Thomas Gleixner
Date: Wed Mar 17 2021 - 12:10:44 EST


On Wed, Mar 17 2021 at 15:48, Sebastian Andrzej Siewior wrote:
> On 2021-03-17 15:38:52 [+0100], Thomas Gleixner wrote:
>> thread(irq_A)
>> irq_handler(A)
>> spin_lock(&foo->lock);
>>
>> interrupt(irq_B)
>> irq_handler(B)
>> spin_lock(&foo->lock);
>
> It will not because both threads will wake_up(thread). It is an issue if
> - if &foo->lock is shared between a hrtimer and threaded-IRQ
> - if &foo->lock is shared between a non-threaded and thread-IRQ
> - if &foo->lock is shared between a printk() in hardirq context and
> thread-IRQ as I learned today.

That's the point and it's entirely clear from the above: A is thread
context and B is hard interrupt context and if the lock is shared then
it's busted. Otherwise we would not have this discussion at all.