Re: [RFC net] Revert "net: phy: Fix race condition on link status change"

From: Serge Semin
Date: Wed Aug 16 2023 - 16:25:45 EST


On Wed, Aug 16, 2023 at 10:13:10PM +0200, Andrew Lunn wrote:
> > > 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 :-)

Ok. I'll resubmit the patch tomorrow with the RFC status dropped.

-Serge(y)

>
> Andrew