* [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off
@ 2023-08-11 10:26 Russell King (Oracle)
2023-08-11 14:38 ` Andrew Lunn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2023-08-11 10:26 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandru Ardelean, Andre Edich, Antoine Tenart, Baruch Siach,
Christophe Leroy, David S. Miller, Divya Koppera, Eric Dumazet,
Florian Fainelli, Hauke Mehrtens, Ioana Ciornei, Jakub Kicinski,
Jerome Brunet, Kavya Sree Kotagiri, Linus Walleij, Marco Felsch,
Marek Vasut, Martin Blumenstingl, Mathias Kresin, Maxim Kochetkov,
Michael Walle, Neil Armstrong, Nisar Sayed, Oleksij Rempel,
Paolo Abeni, Philippe Schenker, Willy Liu, Yuiko Oshino,
Uwe Kleine-König, netdev
Uwe reports:
"Most PHYs signal WoL using an interrupt. So disabling interrupts [at
shutdown] breaks WoL at least on PHYs covered by the marvell driver."
Discussing with Ioana, the problem which was trying to be solved was:
"The board in question is a LS1021ATSN which has two AR8031 PHYs that
share an interrupt line. In case only one of the PHYs is probed and
there are pending interrupts on the PHY#2 an IRQ storm will happen
since there is no entity to clear the interrupt from PHY#2's registers.
PHY#1's driver will get stuck in .handle_interrupt() indefinitely."
Further confirmation that "the two AR8031 PHYs are on the same MDIO
bus."
With WoL using interrupts to wake the system, in such a case, the
system will begin booting with an asserted interrupt. Thus, we need to
cope with an interrupt asserted during boot.
Solve this instead by disabling interrupts during PHY probe. This will
ensure in Ioana's situation that both PHYs of the same type sharing an
interrupt line on a common MDIO bus will have their interrupt outputs
disabled when the driver probes the device, but before we hook in any
interrupt handlers - thus avoiding the interrupt storm.
A better fix would be for platform firmware to disable the interrupting
devices at source during boot, before control is handed to the kernel.
Fixes: e2f016cf7751 ("net: phy: add a shutdown procedure")
Link: 20230804071757.383971-1-u.kleine-koenig@pengutronix.de
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/phy/phy_device.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 61921d4dbb13..c7cf61fe41cf 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3216,6 +3216,8 @@ static int phy_probe(struct device *dev)
goto out;
}
+ phy_disable_interrupts(phydev);
+
/* Start out supporting everything. Eventually,
* a controller will attach, and may modify one
* or both of these values
@@ -3333,16 +3335,6 @@ static int phy_remove(struct device *dev)
return 0;
}
-static void phy_shutdown(struct device *dev)
-{
- struct phy_device *phydev = to_phy_device(dev);
-
- if (phydev->state == PHY_READY || !phydev->attached_dev)
- return;
-
- phy_disable_interrupts(phydev);
-}
-
/**
* phy_driver_register - register a phy_driver with the PHY layer
* @new_driver: new phy_driver to register
@@ -3376,7 +3368,6 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner)
new_driver->mdiodrv.driver.bus = &mdio_bus_type;
new_driver->mdiodrv.driver.probe = phy_probe;
new_driver->mdiodrv.driver.remove = phy_remove;
- new_driver->mdiodrv.driver.shutdown = phy_shutdown;
new_driver->mdiodrv.driver.owner = owner;
new_driver->mdiodrv.driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off
2023-08-11 10:26 [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off Russell King (Oracle)
@ 2023-08-11 14:38 ` Andrew Lunn
2023-08-11 18:30 ` Florian Fainelli
2023-08-13 11:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2023-08-11 14:38 UTC (permalink / raw)
To: Russell King (Oracle)
Cc: Heiner Kallweit, Alexandru Ardelean, Andre Edich, Antoine Tenart,
Baruch Siach, Christophe Leroy, David S. Miller, Divya Koppera,
Eric Dumazet, Florian Fainelli, Hauke Mehrtens, Ioana Ciornei,
Jakub Kicinski, Jerome Brunet, Kavya Sree Kotagiri, Linus Walleij,
Marco Felsch, Marek Vasut, Martin Blumenstingl, Mathias Kresin,
Maxim Kochetkov, Michael Walle, Neil Armstrong, Nisar Sayed,
Oleksij Rempel, Paolo Abeni, Philippe Schenker, Willy Liu,
Yuiko Oshino, Uwe Kleine-König, netdev
On Fri, Aug 11, 2023 at 11:26:30AM +0100, Russell King (Oracle) wrote:
> Uwe reports:
> "Most PHYs signal WoL using an interrupt. So disabling interrupts [at
> shutdown] breaks WoL at least on PHYs covered by the marvell driver."
>
> Discussing with Ioana, the problem which was trying to be solved was:
> "The board in question is a LS1021ATSN which has two AR8031 PHYs that
> share an interrupt line. In case only one of the PHYs is probed and
> there are pending interrupts on the PHY#2 an IRQ storm will happen
> since there is no entity to clear the interrupt from PHY#2's registers.
> PHY#1's driver will get stuck in .handle_interrupt() indefinitely."
>
> Further confirmation that "the two AR8031 PHYs are on the same MDIO
> bus."
>
> With WoL using interrupts to wake the system, in such a case, the
> system will begin booting with an asserted interrupt. Thus, we need to
> cope with an interrupt asserted during boot.
>
> Solve this instead by disabling interrupts during PHY probe. This will
> ensure in Ioana's situation that both PHYs of the same type sharing an
> interrupt line on a common MDIO bus will have their interrupt outputs
> disabled when the driver probes the device, but before we hook in any
> interrupt handlers - thus avoiding the interrupt storm.
>
> A better fix would be for platform firmware to disable the interrupting
> devices at source during boot, before control is handed to the kernel.
>
> Fixes: e2f016cf7751 ("net: phy: add a shutdown procedure")
> Link: 20230804071757.383971-1-u.kleine-koenig@pengutronix.de
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off
2023-08-11 10:26 [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off Russell King (Oracle)
2023-08-11 14:38 ` Andrew Lunn
@ 2023-08-11 18:30 ` Florian Fainelli
2023-08-13 11:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2023-08-11 18:30 UTC (permalink / raw)
To: Russell King (Oracle), Andrew Lunn, Heiner Kallweit
Cc: Alexandru Ardelean, Andre Edich, Antoine Tenart, Baruch Siach,
Christophe Leroy, David S. Miller, Divya Koppera, Eric Dumazet,
Hauke Mehrtens, Ioana Ciornei, Jakub Kicinski, Jerome Brunet,
Kavya Sree Kotagiri, Linus Walleij, Marco Felsch, Marek Vasut,
Martin Blumenstingl, Mathias Kresin, Maxim Kochetkov,
Michael Walle, Neil Armstrong, Nisar Sayed, Oleksij Rempel,
Paolo Abeni, Philippe Schenker, Willy Liu, Yuiko Oshino,
Uwe Kleine-König, netdev
On 8/11/23 03:26, Russell King (Oracle) wrote:
> Uwe reports:
> "Most PHYs signal WoL using an interrupt. So disabling interrupts [at
> shutdown] breaks WoL at least on PHYs covered by the marvell driver."
>
> Discussing with Ioana, the problem which was trying to be solved was:
> "The board in question is a LS1021ATSN which has two AR8031 PHYs that
> share an interrupt line. In case only one of the PHYs is probed and
> there are pending interrupts on the PHY#2 an IRQ storm will happen
> since there is no entity to clear the interrupt from PHY#2's registers.
> PHY#1's driver will get stuck in .handle_interrupt() indefinitely."
>
> Further confirmation that "the two AR8031 PHYs are on the same MDIO
> bus."
>
> With WoL using interrupts to wake the system, in such a case, the
> system will begin booting with an asserted interrupt. Thus, we need to
> cope with an interrupt asserted during boot.
>
> Solve this instead by disabling interrupts during PHY probe. This will
> ensure in Ioana's situation that both PHYs of the same type sharing an
> interrupt line on a common MDIO bus will have their interrupt outputs
> disabled when the driver probes the device, but before we hook in any
> interrupt handlers - thus avoiding the interrupt storm.
>
> A better fix would be for platform firmware to disable the interrupting
> devices at source during boot, before control is handed to the kernel.
>
> Fixes: e2f016cf7751 ("net: phy: add a shutdown procedure")
> Link: 20230804071757.383971-1-u.kleine-koenig@pengutronix.de
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
--
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off
2023-08-11 10:26 [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off Russell King (Oracle)
2023-08-11 14:38 ` Andrew Lunn
2023-08-11 18:30 ` Florian Fainelli
@ 2023-08-13 11:30 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-08-13 11:30 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, alexandru.ardelean, andre.edich, atenart,
baruch, christophe.leroy, davem, Divya.Koppera, edumazet,
f.fainelli, hauke, ioana.ciornei, kuba, jbrunet,
kavyasree.kotagiri, linus.walleij, m.felsch, marex,
martin.blumenstingl, dev, fido_max, michael, narmstrong,
Nisar.Sayed, o.rempel, pabeni, philippe.schenker, willy.liu,
yuiko.oshino, u.kleine-koenig, netdev
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:
On Fri, 11 Aug 2023 11:26:30 +0100 you wrote:
> Uwe reports:
> "Most PHYs signal WoL using an interrupt. So disabling interrupts [at
> shutdown] breaks WoL at least on PHYs covered by the marvell driver."
>
> Discussing with Ioana, the problem which was trying to be solved was:
> "The board in question is a LS1021ATSN which has two AR8031 PHYs that
> share an interrupt line. In case only one of the PHYs is probed and
> there are pending interrupts on the PHY#2 an IRQ storm will happen
> since there is no entity to clear the interrupt from PHY#2's registers.
> PHY#1's driver will get stuck in .handle_interrupt() indefinitely."
>
> [...]
Here is the summary with links:
- [net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off
https://git.kernel.org/netdev/net/c/cc941e548bff
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-13 11:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-11 10:26 [PATCH net] net: phy: fix IRQ-based wake-on-lan over hibernate / power off Russell King (Oracle)
2023-08-11 14:38 ` Andrew Lunn
2023-08-11 18:30 ` Florian Fainelli
2023-08-13 11:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).