Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net v3 0/2] net: phy: postpone PHY interrupts during sleep with MAC-managed PM
@ 2026-10-29  4:58 Igor Velkov via B4 Relay
  2026-10-29  4:58 ` [PATCH net v3 1/2] net: phy: move irq_suspended and irq_rerun out of the bitfield Igor Velkov via B4 Relay
  2026-10-29  4:58 ` [PATCH net v3 2/2] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
  0 siblings, 2 replies; 4+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-10-29  4:58 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Maxime Chevallier, Lukas Wunner, Rafael J. Wysocki, Wei Fang,
	Niklas Söderlund, Paul Barker, Florian Fainelli, Doug Berger,
	Thangaraj Samynathan, netdev, linux-arm-kernel, linux-rockchip,
	linux-kernel, Igor Velkov

When the MAC driver manages PHY PM, phylib never sets irq_suspended, and
a PHY interrupt during the sleep transition runs the PHY driver's
handler while the MDIO bus may be powered down. On Helios64 (dwmac-rk)
this hangs the board on suspend as well as on resume.

Patch 1 moves the two flags out of a bitfield they share with the link
state written under phydev->lock; patch 2 sets irq_suspended for these
PHYs too.

Open question on 2/2: a postponed interrupt leaves the PHY line
disabled until resume. With Wake-on-LAN, v3 still signals a wakeup
from it, so suspend would abort when the link changes after
phy_stop(): phylink_suspend() calls phylink_speed_down() after
phylink_stop() when the PHY is the wake source (stmmac sets
wol_phy_speed_ctrl), and a PHY that keeps its link interrupt enabled
raises one there. RTL8211F masks it in suspend when its wakeup is
enabled, so Helios64 woke on a magic packet 3 of 3 times. Never
signalling a
wakeup would let the system sleep with a wake-armed PHY line left
disabled. Is the v3 behaviour acceptable, or should the MAC set
irq_suspended once it has stopped the PHY (phylink_suspend() plus a
phylib helper for MACs without phylink)?

Changes in v3:
- with mac_managed_pm, a postponed interrupt signals a wakeup event only
  with Wake-on-LAN; with MAC power/wakeup enabled and no WoL, v2 aborted
  s2idle on Helios64 3 of 3 times, v3 0 of 3 (reported by Sashiko)
- phy_free_interrupt(): stop postponing and re-enable the line before
  free_irq(), not after it (reported by Sashiko)
- mdio_bus_phy_suspend() comment narrowed to the MDIO bus (reported by
  Sashiko)
- patch 1: Andrew suggested taking phydev->lock in phy_interrupt();
  the commit message says why that does not close the race
- tests rerun on v3

Not changed: the replay does not reach a nested threaded PHY interrupt
(irq_wake_thread() has no thread to wake). That code predates this
series; v3 sends MAC-managed PHYs through it as well.

Link to v2: https://lore.kernel.org/r/20261026045343.837889-1-iav@iav.lv

Signed-off-by: Igor Velkov <iav@iav.lv>
---
Igor Velkov (2):
      net: phy: move irq_suspended and irq_rerun out of the bitfield
      net: phy: postpone PHY interrupts during sleep with MAC-managed PM

 drivers/net/phy/phy.c        | 21 +++++++++++++++++---
 drivers/net/phy/phy_device.c | 46 +++++++++++++++++++++++++++-----------------
 include/linux/phy.h          | 10 ++++++----
 3 files changed, 52 insertions(+), 25 deletions(-)
---
base-commit: fcc00b15cb21a6de76826e5012b2c758505f5e65
change-id: 20261029-b4-phylib-mac-pm-irq-v3-f656d4e1c64f

Best regards,
-- 
Igor Velkov <iav@iav.lv>




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-30 22:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29  4:58 [PATCH net v3 0/2] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
2026-10-29  4:58 ` [PATCH net v3 1/2] net: phy: move irq_suspended and irq_rerun out of the bitfield Igor Velkov via B4 Relay
2026-10-29  4:58 ` [PATCH net v3 2/2] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
2026-10-30 22:40   ` netdev-bot+sashiko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox