Re: [PATCH net] net: phy: Warn about incorrect mdio_bus_phy_resume() state

From: Florian Fainelli
Date: Thu Sep 22 2022 - 11:29:47 EST




On 9/22/2022 5:31 AM, Jakub Kicinski wrote:
On Mon, 1 Aug 2022 16:34:03 -0700 Florian Fainelli wrote:
Calling mdio_bus_phy_resume() with neither the PHY state machine set to
PHY_HALTED nor phydev->mac_managed_pm set to true is a good indication
that we can produce a race condition looking like this:

CPU0 CPU1
bcmgenet_resume
-> phy_resume
-> phy_init_hw
-> phy_start
-> phy_resume
phy_start_aneg()
mdio_bus_phy_resume
-> phy_resume
-> phy_write(..., BMCR_RESET)
-> usleep() -> phy_read()

with the phy_resume() function triggering a PHY behavior that might have
to be worked around with (see bf8bfc4336f7 ("net: phy: broadcom: Fix
brcm_fet_config_init()") for instance) that ultimately leads to an error
reading from the PHY.

Hi Florian! There were some follow ups on this one, were all the known
reports covered at this point or there are still platforms to tweak?

This is the only active thread that I am aware of, and Lukas and I are in agreement as to what to do next:

https://lore.kernel.org/all/20220918191333.GA2107@xxxxxxxxx/

expect him to submit a follow on the warning condition to deal with the smsc95xx USB driver.

Thanks!
--
Florian