[PATCH RFC 04/30] net: fec: fix interrupt handling races

Russell King - ARM Linux linux at arm.linux.org.uk
Fri Jun 20 08:36:14 PDT 2014

On Fri, Jun 20, 2014 at 12:39:57PM +0000, David Laight wrote:
> It is usually possible to reduce the interrupt count even further by:
> 1) processing the rings.
> 2) clear the IRQ.
> 3) check the rings for new entries, if any start again.
> This means that you don't take the interrupt for anything that completes
> while processing the earlier ring entries.
> The slight downside is that it is easy to exit the ISR before the IRQ
> line actually drops - resulting in a spurious interrupt.
> (patch 24 seems to be similar).

ITYM patch 26, as patch 24 is an update to the errata workaround.

Patch 4 is what I regard to be the bare minimum fix, patch 26 is an
improvement over it.

Remember though that the real interrupt processing happens in the NAPI
handler, not the main interrupt handler - upon seeing a transmit and/or
receive complete interrupt, the main interrupt handler masks both of
these interrupts at the chip and triggers the NAPI handler to run.

Nevertheless, your suggestion is equally valid for a NAPI handler:
- process the rings
- clear the interrupt(s)
- if more work is allowed (according to the NAPI weight), repeat

This is simple enough for the RX ring, where each packet received is
equal one one NAPI unit of work.  The TX side is less obvious as
the NAPI documentation suggests that cleaning the ring partially
equates to no NAPI units of work but a clean of the entire ring
equates to the full allowance.  Maybe I've mis-understood something
there (which would mean there's another bug which needs fixing in the
tx reaping code...)

FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

More information about the linux-arm-kernel mailing list