Re: [RFC net] Revert "net: phy: Fix race condition on link status change"
From: Andrew Lunn
Date: Wed Aug 16 2023 - 16:14:14 EST
> > So i suggest you change phy_process_error() to remove the lock.
>
> This doable.
>
> > Maybe
> > add a test to ensure the lock is actually held, and do a phydev_err()
> > if not.
>
> This can't be done since phy_state_machine() calls phy_error_precise()
> which calls phy_process_error() with no phy_device.lock held. Printing the
> error in that case would mean an error in the Networking PHY subsystem
> itself.
>
> Do you suggest to take the lock before calling phy_error_precise() then?
Thanks for digging into the details.
phy_error_precise() is used in exactly one place. So i would actually
put the lock inside it. And maybe move the comment about not using the
function with the lock already held here :-)
Andrew