[PATCH net 0/2] net: ipa: fix a suspend hang

From: Alex Elder
Date: Thu Jan 07 2021 - 16:44:11 EST


The IPA driver's PM suspend callback stops all channels, and its
resume callback restarts them again. Part of stopping a channel is
disabling NAPI and disabling its I/O completion interrupt.

When stopping a channel, the IPA driver currently disables NAPI
before disabling the interrupt. It also re-enables interrupts
before re-enabling NAPI. The interrupt handler can therefore be
called while NAPI is disabled.

If the interrupt signaling a transfer completion occurs while NAPI
is disabled, NAPI polling will not be scheduled to process that
completion. That processing will be delayed, occuring only when a
subsequent interrupt schedules NAPI polling when NAPI is enabled
again.

The second patch in this series reorders the NAPI and interrupt
control calls. The completion interrupt is disabled before NAPI
when stopping a channel, and re-enabled after NAPI when starting.
This way polling to handle the completion of a transfer can begin
immediately when handling its interrupt. And if a completion occurs
while the interrupt is disabled, the handler will trigger polling
when interrupts are enabled again.

The first patch adds a flag that prevents the poll function from
re-enabling the interrupt when stopping.

Without this fix in place we would occasionally see a hang while
stopping channels during suspend.

-Alex

Alex Elder (2):
net: ipa: introduce atomic channel STOPPING flag
net: ipa: re-enable NAPI before enabling interrupt

drivers/net/ipa/gsi.c | 15 ++++++++++++---
drivers/net/ipa/gsi.h | 6 ++++++
2 files changed, 18 insertions(+), 3 deletions(-)

--
2.20.1