Re: [PATCH] thermal: replace spin_lock_irqsave by spin_lock in hard IRQ
From: Thomas Gleixner
Date: Fri Oct 23 2020 - 17:45:22 EST
On Thu, Oct 22 2020 at 14:51, Geert Uytterhoeven wrote:
> On Wed, Oct 21, 2020 at 2:15 PM Tian Tao <tiantao6@xxxxxxxxxxxxx> wrote:
>> The code has been in a irq-disabled context since it is hard IRQ. There
>> is no necessity to do it again.
>>
> Is this also true if CONFIG_PREEMPT_RT=y, and all irq handlers execute
> in the context of special tasks?
On RT or even on mainline with 'threadirqs' on the command line all
interrupts which are not explicitly requested with IRQF_NO_THREAD run
their handlers in thread context. The same applies to soft interrupts.
That means they are subject to the normal scheduler rules and no other
code is going to acquire that lock from hard interrupt context either,
so the irqsave() here is pointless in all cases.
Famous last words...
... unless the driver does magic things like having a hrtimer armed
which expires in hard interrupt context and touches the very same
lock, but that's not the case in this particular driver.
So the change itself is correct, but the change log could do with some
polishing. :)
Thanks,
tglx