public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Robert Marko <robert.marko@sartura.hr>,
	hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org,
	Divya.Koppera@microchip.com, horatiu.vultur@microchip.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: phy: micrel: fix LAN8814 QSGMII soft reset
Date: Thu, 30 Apr 2026 16:49:35 +0200	[thread overview]
Message-ID: <2983d402-83c1-477b-887e-7a8fd1535884@lunn.ch> (raw)
In-Reply-To: <0060104c-bb38-45d5-8f8e-14708702feac@redhat.com>

> > @@ -4548,6 +4548,13 @@ static int lan8814_config_init(struct phy_device *phydev)
> >  	struct kszphy_priv *lan8814 = phydev->priv;
> >  	int ret;
> >  
> > +	if (phy_package_init_once(phydev))
> > +		/* Reset the PHY */
> > +		lanphy_modify_page_reg(phydev, LAN8814_PAGE_COMMON_REGS,
> > +				       LAN8814_QSGMII_SOFT_RESET,
> > +				       LAN8814_QSGMII_SOFT_RESET_BIT,
> > +				       LAN8814_QSGMII_SOFT_RESET_BIT)
> 
> Sashiko says:
> 
> ---
> Could this introduce a race condition if multiple ports are brought up
> concurrently?
> Because phy_package_init_once() does not provide a synchronization
> barrier for followers, they might proceed immediately to configure their
> registers while the leader is still performing the reset.
> ---
> 
> on top of my head IDK if such race is possible at all.

config_init() is called from phy_init_hw(). That is called from
mdio_bus_phy_resume() and phy_attach_direct().

It seems unlikely resumes of devices on one bus is done in parallel,
same as probing of devices on one bus is not performed in parallel.

phy_attach_direct() is either used in the MAC drivers probe() or
open(). Again, probe should not be running in parallel especially
since this PHY is likely connect to a switch, and the ports are
created sequentially by the DSA core. open() should be protected by
RTNL.

So it seems unlikely to me.

lanphy_modify_page_reg() also takes the MDIO bus lock. That will
prevent any other MDIO operations being performed in parallel. This
does however make the assumption the software reset can be performed
within one MDIO bus cycle.

So a race here seems pretty theoretical to me.

    Andrew

  reply	other threads:[~2026-04-30 14:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 13:41 [PATCH net] net: phy: micrel: fix LAN8814 QSGMII soft reset Robert Marko
2026-04-30 11:27 ` Paolo Abeni
2026-04-30 14:49   ` Andrew Lunn [this message]
2026-04-30 16:06 ` Simon Horman
2026-05-01  0:40 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2983d402-83c1-477b-887e-7a8fd1535884@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=Divya.Koppera@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robert.marko@sartura.hr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox