Re: [PATCH] gpio: dwapb: Add robust error handling in interrupt handler

From: Thomas Gleixner

Date: Fri Jul 03 2026 - 17:41:58 EST


On Fri, Jul 03 2026 at 23:21, Linus Walleij wrote:
> On Fri, Jul 3, 2026 at 3:49 PM Liang Hao <haohlliang@xxxxxxxxx> wrote:
>
>> The current interrupt handler silently continues if an interrupt
>> handling fails, which may lead to interrupt storms. Add proper
>> error handling to gracefully recover from failed interrupt
>> handling.
>>
>> When generic_handle_irq() fails, the following recovery actions are
>> taken:
>> - Write EOI to clear the pending interrupt
>> - Mask the interrupt to prevent immediate re-triggering
>> - Disable the interrupt to stop further interrupts on this line

This completely fails to explain WHY generic_handle_irq() fails.

There are only two reasons for that:

1) The interrupt descriptor is not available (EINVAL)

2) The platform mandates that the interrupt has to be handled in
hard interrupt context (EPERM). This also emits a warning.

There is also zero information whether the irq mapping lookup returns a
valid interrupt in this scenario, so it's hard to tell what's really
going on.

As there is no mention of the warning I assume that's #1. Which means
this is papering over some underlying problem in that driver. Looking at
the counter measures makes it entirely clear:

EOI, mask, disable

If there is no interrupt descriptor then the driver failed to mask and
disable the interrupt line at some point.

So this is just a lazy debugging aid for something which is not supposed
to happen in a sane and production ready driver.

Thanks,

tglx