Re: [PATCH 1/2] sc16is7xx: Do not handle irqs in endless loop

From: m . brock
Date: Tue Aug 09 2016 - 05:22:44 EST


On 2016-08-08 15:32, dirk.eibach@xxxxxxxx wrote:
From: Dirk Eibach <dirk.eibach@xxxxxxxx>

sc16is7xx_port_irq() is laid out as an endless loop. It will exit only
when there is no more interrupt left to service. This not common
practice.
In our case it lead to some strange hangup situation when there was an
unexpected XOFF-interrupt that could not be handled.
So let's service interrupts only once and report XOFF-interrupts that
should never happen since they are never enabled.

The reason for such an endless loop in an interrupt handler usually means
that multiple sources can generate an interrupt and the interrupt controller
is configured for edge. During handling the interrupt of one source (e.g.
data received) but before it is cleared, another interrupt can trigger (e.g.
transmit done). This will not generate a new edge as the interrupt line is
still active! Thus re-reading the interrupt status is required. And with
interrupt sharing this problem gets even worse. The fact that the sc16is7xx
uses an indirect interface like i2c or spi doesn't help either.

When configured for level interrupts the interrupt will automatically
re-trigger. But the risk of interrupt storm when the hardware is broken
(interrupt line stuck active) seems to keep developers away from setting
level interrupt. IMHO an interrupt storm should be detectable by the
interrupt handler so nobody needs to fear using level sensitive interrupts.

Maarten