Re: [PATCH net v1 1/1] net: usb: asix: ax88772: drop phylink use in PM to avoid MDIO runtime PM wakeups

Russell King (Oracle)
2025-09-11T14:39:34Z

On Thu, Sep 11, 2025 at 03:58:50PM +0200, Marek Szyprowski wrote:
> On 08.09.2025 13:26, Oleksij Rempel wrote:
> > Drop phylink_{suspend,resume}() from ax88772 PM callbacks.
> >
> > MDIO bus accesses have their own runtime-PM handling and will try to
> > wake the device if it is suspended. Such wake attempts must not happen
> > from PM callbacks while the device PM lock is held. Since phylink
> > {sus|re}sume may trigger MDIO, it must not be called in PM context.
> >
> > No extra phylink PM handling is required for this driver:
> > - .ndo_open/.ndo_stop control the phylink start/stop lifecycle.
> > - ethtool/phylib entry points run in process context, not PM.
> > - phylink MAC ops program the MAC on link changes after resume.
> >
> > Fixes: e0bffe3e6894 ("net: asix: ax88772: migrate to phylink")
> > Reported-by: Hubert Wiśniewski <hubert.wisniewski.25632@gmail.com>
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> > ---
>
> This patch landed in today's linux-next as commit 5537a4679403 ("net:
> usb: asix: ax88772: drop phylink use in PM to avoid MDIO runtime PM
> wakeups"). In my tests I found that it breaks operation of asix ethernet
> usb dongle after system suspend-resume cycle. The ethernet device is
> still present in the system, but it is completely dysfunctional. Here is
> the log:
>
> root@target:~# time rtcwake -s10 -mmem
> rtcwake: wakeup from "mem" using /dev/rtc0 at Thu Sep 11 13:02:23 2025
> PM: suspend entry (deep)
> Filesystems sync: 0.002 seconds
> Freezing user space processes
> Freezing user space processes completed (elapsed 0.003 seconds)
> OOM killer disabled.
> Freezing remaining freezable tasks
> Freezing remaining freezable tasks completed (elapsed 0.024 seconds)
> ...
> usb usb1: root hub lost power or was reset
> ...
> usb usb2: root hub lost power or was reset
> xhci-hcd xhci-hcd.7.auto: xHC error in resume, USBSTS 0x401, Reinit
> usb usb3: root hub lost power or was reset
> usb usb4: root hub lost power or was reset
> asix 2-1:1.0 eth0: Failed to write reg index 0x0000: -113
> asix 2-1:1.0 eth0: Failed to enable software MII access
> asix 2-1:1.0 eth0: Failed to read reg index 0x0000: -113
> asix 2-1:1.0 eth0: Failed to write reg index 0x0000: -113
> asix 2-1:1.0 eth0: Failed to enable software MII access
> ... (the above error repeated many times)
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 9 at drivers/net/phy/phy.c:1346
> _phy_state_machine+0x158/0x2d0
> phy_check_link_status+0x0/0x140: returned: -110

I'm not surprised. I'm guessing phylib is using polled mode, and
removing the suspend/resume handling likely means that it's at the
mercy of the timings of the phylib state machine running (which is
what is complaining here) vs the MDIO bus being available for use.

Given that this happens, I'm convinced that the original patch is
the wrong approach. The driver needs the phylink suspend/resume
calls to shutdown and restart phylib polling, and the resume call
needs to be placed in such a location that the MDIO bus is already
accessible.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!