net: mvneta: re-enable percpu interrupt on resume
Subsystems (4)
PATCH v4 1/1 net: mvneta: re-enable percpu interrupt on resume
On Marvell MPIC platforms (Armada 370/XP/38x), mvneta uses a percpu IRQ disable/enable scheme for NAPI: the ISR (mvneta_percpu_isr) calls disable_percpu_irq() to mask the MPIC per-CPU interrupt and schedules NAPI poll, which calls enable_percpu_irq() on completion to unmask.
If suspend occurs while NAPI poll is pending (between disable_percpu_irq in the ISR and enable_percpu_irq in poll completion), the interrupt is never re-enabled:
1. mvneta_percpu_isr: disable_percpu_irq() + napi_schedule() => MPIC masked, percpu_enabled cpumask bit cleared
2. NAPI poll does not complete before suspend proceeds (on PREEMPT_RT this is highly likely since softirqs run in ksoftirqd which gets frozen; on non-RT it can happen when softirq processing is deferred to ksoftirqd)
3. mvneta_stop_dev => napi_disable(): cancels the pending poll without executing the completion path
4. suspend_device_irqs => IRQCHIP_MASK_ON_SUSPEND: masks MPIC (already masked, but records IRQS_SUSPENDED)
5. Resume: mpic_resume checks irq_percpu_is_enabled() => false (bit was cleared in step 1) => skips unmask
6. mvneta_start_dev only restores device-level INTR_NEW_MASK, does not touch the MPIC per-CPU mask
Result: MPIC per-CPU interrupt stays masked permanently. The NIC generates interrupts (INTR_NEW_CAUSE != 0) but the CPU never receives them, causing complete loss of network connectivity.
Fix by calling on_each_cpu(mvneta_percpu_enable) in the resume path to unconditionally unmask the MPIC per-CPU interrupt regardless of pre-suspend state.
---
v4:
- Rewrite commit message with accurate root cause analysis.
v3:
- Dropped the free_irq/request_irq approach (incorrect root cause).
- Instead, call on_each_cpu(mvneta_percpu_enable) in the resume path to ensure the MPIC percpu IRQ is unmasked, matching mvneta_open().
- Updated commit message with correct root cause analysis.
v2:
- Move request_irq before cpuhp registration in resume (matching mvneta_open ordering) so that failure does not leave cpuhp callbacks registered on a non-functional device.
- On request_irq failure, call netif_device_detach() to prevent further traffic on the dead interface.
drivers/net/ethernet/marvell/mvneta.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/marvell/mvneta.c +3 -0
@@ -5918,6 +5918,9 @@ static int mvneta_resume(struct device *device)rtnl_unlock ();mvneta_set_rx_mode (dev); +if (!pp->neta_armada3700) +on_each_cpu (mvneta_percpu_enable, pp, true); + return 0; }#endif
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Unsafe call to mvneta_set_rx_mode() without netif_addr_lock_bh() in PM resume.
- [High] Race condition in mvneta_open() and mvneta_resume() with CPU hotplug causing double napi_enable(). --
commit bf4b34826006aca50b2726e755de72b6f2a7c330
Author: Yun Zhou <[email protected]>
net: mvneta: re-enable percpu interrupt on resume
On Marvell MPIC platforms (Armada 370/XP/38x), mvneta uses a percpu IRQ disable/enable scheme for NAPI. This commit fixes an issue where the MPIC per-CPU interrupt stays masked permanently after suspend by unmasking it unconditionally during the resume path.
drivers/net/ethernet/marvell/mvneta.c static int mvneta_resume(struct device *device) · line 5901
Quoted 7 lines
drivers/net/ethernet/marvell/mvneta.c +0
-0@@ -5900,6 +5900,9 @@ static int mvneta_resume(struct device *device)rtnl_unlock ();mvneta_set_rx_mode (dev);
[Severity: High]
This isn't a bug introduced by this patch, but is it safe to call mvneta_set_rx_mode() here without holding netif_addr_lock_bh()?
The mvneta_set_rx_mode() function iterates over the net_device's multicast list:
drivers/net/ethernet/marvell/mvneta.c:mvneta_set_rx_mode() {
...
if (!netdev_mc_empty(dev)) {
netdev_for_each_mc_addr(ha, dev) {
mvneta_mcast_addr_set(pp, ha->addr,
pp->rxq_def);
}
}
...
}Since rtnl_unlock() is called immediately before this, it looks like this unprotected iteration could race with concurrent softirqs handling IGMP/MLD packets. Could this corrupt the list and lead to use-after-free crashes or infinite loops?
drivers/net/ethernet/marvell/mvneta.c static int mvneta_resume(struct device *device) · line 5923
Quoted 4 lines
drivers/net/ethernet/marvell/mvneta.c +3
-0+if (!pp->neta_armada3700) +on_each_cpu (mvneta_percpu_enable, pp, true); +
[Severity: High]
This is a pre-existing issue, but does the resume path have a race condition with CPU hotplug?
In functions like mvneta_open() and mvneta_resume(), the device is added to the CPU hotplug state via cpuhp_state_add_instance_nocalls() without preventing concurrent hotplug events (e.g., via cpus_read_lock()).
If a CPU hotplug event triggers concurrently, mvneta_cpu_online() could call napi_enable_locked() for the new CPU:
drivers/net/ethernet/marvell/mvneta.c:mvneta_cpu_online() {
...
napi_enable_locked(&port->napi);
...
}If mvneta_start_dev() then runs and blindly iterates over all online CPUs calling napi_enable(), could this result in a double napi_enable() on the same NAPI instance and trigger a BUG_ON() panic in the core NAPI code?
Quoted 3 lines
drivers/net/ethernet/marvell/mvneta.c +0
-0return 0; }#endif
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 1 line · Yun Zhou
On Marvell MPIC platforms (Armada 370/XP/38x), mvneta uses a percpu
…
Quoted 6 lines
Fix by calling
on_each_cpu(mvneta_percpu_enable)in the resume path to unconditionally unmask the MPIC per-CPU interrupt regardless of pre-suspend state.Fixes 12bb03b436da ("net: mvneta: Handle per-cpu interrupts")Signed-off-by Yun Zhou <[email protected]>
Sebastian
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Mon, 22 Jun 2026 15:43:50 +0800 you wrote:
On Marvell MPIC platforms (Armada 370/XP/38x), mvneta uses a percpu IRQ disable/enable scheme for NAPI: the ISR (
mvneta_percpu_isr) callsdisable_percpu_irq()to mask the MPIC per-CPU interrupt and schedules NAPI poll, which callsenable_percpu_irq()on completion to unmask.If suspend occurs while NAPI poll is pending (between
disable_percpu_irqin the ISR andenable_percpu_irqin poll completion), the interrupt is never re-enabled:[...]
Here is the summary with links:
- [v4] net: mvneta: re-enable percpu interrupt on resume
https://git.kernel.org/netdev/net/c/fd398d648098
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html