* [PATCH net] net: macb: don't disable an IRQ wake that was never enabled
@ 2026-11-23 15:38 Nicolai Buchwitz
2026-11-23 17:09 ` Théo Lebrun
0 siblings, 1 reply; 2+ messages in thread
From: Nicolai Buchwitz @ 2026-11-23 15:38 UTC (permalink / raw)
To: Théo Lebrun, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Conor Dooley, Sergio Prado, netdev, Dom Cobley, Nicolai Buchwitz
From: Dom Cobley <popcornmix@gmail.com>
If the irqchip has neither an .irq_set_wake callback nor the
IRQCHIP_SKIP_SET_WAKE flag, enable_irq_wake() returns -ENXIO and
macb_resume() later tries to drop a wake reference it never acquired:
Unbalanced IRQ 108 wake disable
WARNING: CPU: 0 PID: 1013 at irq_set_irq_wake+0x168/0x238
...
irq_set_irq_wake+0x168/0x238 (P)
macb_resume+0x23c/0x4b8
platform_pm_resume+0x30/0x70
Record whether arming the queue 0 IRQ for wake succeeded, warn on
failure, and only disarm it on resume if it was armed.
Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Signed-off-by: Dom Cobley <popcornmix@gmail.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
Seen on Raspberry Pi 5, where the RP1 irqchip has no wake support.
Tested on a CM5 with WoL enabled and a suspend/resume cycle.
---
drivers/net/ethernet/cadence/macb.h | 1 +
drivers/net/ethernet/cadence/macb_main.c | 12 ++++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
index b7b4b6a38298..bd4f04ac8356 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -1221,6 +1221,7 @@ struct macb_ptp_info {
struct macb_pm_data {
u32 scrt2;
u32 usrio;
+ bool irq_wake_enabled;
};
struct macb_usrio_config {
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 5ad0e32e2b40..f2d29428fa78 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -6517,6 +6517,7 @@ static int __maybe_unused macb_suspend(struct device *dev)
unsigned long flags;
u32 tmp, ifa_local;
unsigned int q;
+ int err;
if (!device_may_wakeup(&bp->netdev->dev))
phy_exit(bp->phy);
@@ -6589,7 +6590,11 @@ static int __maybe_unused macb_suspend(struct device *dev)
}
spin_unlock_irqrestore(&bp->lock, flags);
- enable_irq_wake(bp->queues[0].irq);
+ err = enable_irq_wake(bp->queues[0].irq);
+ if (err)
+ netdev_warn(netdev, "Unable to enable IRQ %d as a wake source (error %d)\n",
+ bp->queues[0].irq, err);
+ bp->pm_data.irq_wake_enabled = !err;
}
netif_device_detach(netdev);
@@ -6655,7 +6660,10 @@ static int __maybe_unused macb_resume(struct device *dev)
macb_queue_isr_clear(bp, bp->queues, -1);
spin_unlock_irqrestore(&bp->lock, flags);
- disable_irq_wake(bp->queues[0].irq);
+ if (bp->pm_data.irq_wake_enabled) {
+ disable_irq_wake(bp->queues[0].irq);
+ bp->pm_data.irq_wake_enabled = false;
+ }
/* Now make sure we disable phy before moving
* to common restore path
---
base-commit: dd206ec7ed36be3883d08def9eca8faab7a38ee5
change-id: 20261123-nb-macb-irq-wake-net-8e23e4a0be54
Best regards,
--
Nicolai Buchwitz <nb@tipi-net.de>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] net: macb: don't disable an IRQ wake that was never enabled
2026-11-23 15:38 [PATCH net] net: macb: don't disable an IRQ wake that was never enabled Nicolai Buchwitz
@ 2026-11-23 17:09 ` Théo Lebrun
0 siblings, 0 replies; 2+ messages in thread
From: Théo Lebrun @ 2026-11-23 17:09 UTC (permalink / raw)
To: Nicolai Buchwitz, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Conor Dooley, Sergio Prado, netdev, Dom Cobley
Hello Nicolai & Dom,
On Mon Nov 23, 2026 at 4:38 PM CET, Nicolai Buchwitz wrote:
> @@ -6589,7 +6590,11 @@ static int __maybe_unused macb_suspend(struct device *dev)
> }
> spin_unlock_irqrestore(&bp->lock, flags);
>
> - enable_irq_wake(bp->queues[0].irq);
> + err = enable_irq_wake(bp->queues[0].irq);
> + if (err)
> + netdev_warn(netdev, "Unable to enable IRQ %d as a wake source (error %d)\n",
> + bp->queues[0].irq, err);
> + bp->pm_data.irq_wake_enabled = !err;
> }
Your error handling is surprising to me: if we get asked to be a wakeup
source and fail doing so, we should refuse and error out. This will in
turn abort the system-wide suspend.
The risk is that we might be the only wakeup source. We'd sleep for a
really long time.
What's the behavior on the platform you noticed the issue? I can think
of two reasons that still make it work:
- you have another wakeup source or
- some other interrupt (PCI related) is your wakeup path.
In my mind, we should instead propagate the enable_irq_wake() error in
macb_suspend().
To go even further, we could move the enable_irq_wake() into
macb_set_wol() to report early to userspace that WoL isn't supported.
Lastly, if this is indeed a PCI related topic, then we need to
special-case the enable_irq_wake() call. From my LLM report, many PCI
MAC drivers only call device_set_wakeup_enable() at the set_wol
request. Then everything is handled at the bus level at suspend: a
pci_enable_wake() call made if the device is on the wakeup path.
What do you think?
Thanks,
--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 17:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 15:38 [PATCH net] net: macb: don't disable an IRQ wake that was never enabled Nicolai Buchwitz
2026-11-23 17:09 ` Théo Lebrun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox