Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Nicolai Buchwitz
Mon, 23 Nov 2026 15:38
[PATCH net] net: macb: don't disable an IRQ wake that was never enabled
Author: Nicolai Buchwitz
Date: Mon, 23 Nov 2026 15:38
Date: Mon, 23 Nov 2026 15:38
85 lines
11403 bytes
11403 bytes
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>
Re: [PATCH net] net: macb: don't disable an IRQ wake that was never enabled
Author: Nicolai Buchwitz
Date: Tue, 24 Nov 2026 06:12
Date: Tue, 24 Nov 2026 06:12
69 lines
10744 bytes
10744 bytes
Hi Théo On 23.11.2026 18:09, Théo Lebrun wrote: > 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. Agreed. This also would match the WAKE_ARP check, which already aborts suspend. We could arm the IRQ before touching the hardware and return the error, so the flag goes away too? > > 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 Yes, the bootloader / rtc alarm / power button. The GIC is off as it is on rp1 too, which is in reset I guess. This makes WoL IMHO impoissible. > - 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. There is another downstream patch I plan to upstream, which sets MACB_CAPS_NO_WOL for rp1. As this in kinda feature I planned for net-next and just fix the bug in net > > 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. macb is a platform device behind rp1, which is a mfd. PCIe is down in S3 anyway? > [...] Thanks, Nicolai
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads