Netdev List
 help / color / mirror / Atom feed
From: Romain Gantois <romain.gantois@bootlin.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 3/3] net: phy: dp83869: Support 1000Base-X SFP
Date: Thu, 11 Jun 2026 09:35:08 +0200	[thread overview]
Message-ID: <uKjb5R6hQWGmAlZw6eSfBw@bootlin.com> (raw)
In-Reply-To: <6c4f54bf-383a-4ff8-8389-99592a8fcd16@lunn.ch>

[-- Attachment #1: Type: text/plain, Size: 1763 bytes --]

Hi Andrew,

On Wednesday, 10 June 2026 22:39:12 CEST Andrew Lunn wrote:
> > > Why is it safe to call dp83869_configure_mode() without the lock, but
> > > dp83869_config_aneg() does need the lock? And what are the
> > > consequences of not being able to get the lock and so aneg is not
> > > configured?
> > > 
> > > Some comments would be good here.
> > 
> > Since phy_port has been merged, I'm currently preparing a v3 for this but
> > I'm in need of some general guidance regarding this
> > `mutex_trylock(&phydev->lock)` which has (rightfully) sparked some
> > concerns.
> > 
> > What data is supposed to be protected by the `phydev->lock` mutex? Is it
> > every field of the phydev struct + standard hardware registers + vendor
> > registers? Or only a subset of these?
> 
> The phydev lock should prevent two phylib operations happening at
> once. It also protects the members of phylib which are accessed during
> the callback when the link changes.
> 
> Phylib operations should include access to hwmon sensors and LEDs, if
> there is a danger such access could upset things. Since LEDs come
> through the phylib core, locking is done for that in the core. But
> hwmon sensors are not part of the core.
> 

Okay, thanks for the explanation!

> Since PHYs are pretty simple, and MDIO operations take a lot of time,
> it is better to hold the lock than not hold the lock.

ACK, so presumably we should also hold the lock when doing 
dp83869_configure_mode() since it modifies PHY registers. This'll be a bit of a 
headache since configure_mii() may be called with the lock already held or not 
depending on the call path... I'll see what can be done about this.

Thanks,

-- 
Romain Gantois, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2026-06-11  7:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10  9:24 [PATCH net-next v2 0/3] net: phy: dp83869: Support 1000Base-X SFP Romain Gantois
2025-11-10  9:24 ` [PATCH net-next v2 1/3] net: phy: dp83869: Restart PHY when configuring mode Romain Gantois
2025-11-11  1:02   ` Andrew Lunn
2025-11-10  9:24 ` [PATCH net-next v2 2/3] net: phy: dp83869: ensure FORCE_LINK_GOOD is cleared Romain Gantois
2025-11-11  1:03   ` Andrew Lunn
2025-11-10  9:24 ` [PATCH net-next v2 3/3] net: phy: dp83869: Support 1000Base-X SFP Romain Gantois
2025-11-11  1:08   ` Andrew Lunn
2025-11-13  9:27     ` Romain Gantois
2026-06-10 15:11     ` Romain Gantois
2026-06-10 20:39       ` Andrew Lunn
2026-06-11  7:35         ` Romain Gantois [this message]
2026-02-13 12:31 ` [PATCH net-next v2 0/3] " Álvaro G. M.
2026-06-05 13:19   ` Romain Gantois

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=uKjb5R6hQWGmAlZw6eSfBw@bootlin.com \
    --to=romain.gantois@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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