mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: SeungJong Ha <engineer.jjhama@gmail.com>
Cc: netdev-bot+sashiko@kernel.org, fujita.tomonori@gmail.com,
	tmgross@umich.edu, davem@davemloft.net, edumazet@kernel.org,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net,
	bjorn3_gh@protonmail.com, lossin@kernel.org,
	a.hindborg@kernel.org, aliceryhl@google.com, dakr@kernel.org,
	daniel.almeida@collabora.com, tamird@kernel.org,
	acourbot@nvidia.com, work@onurozkan.dev, hkallweit1@gmail.com,
	linux@armlinux.org.uk, netdev@vger.kernel.org,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 2/3] rust: net: phy: make Device generic over a lock context
Date: Mon, 23 Nov 2026 05:31:30 +0100	[thread overview]
Message-ID: <bfd7a44f-2bba-4aee-9758-1dd88f94566f@lunn.ch> (raw)
In-Reply-To: <CAGAB667HcHxS-XboSz559SG3tT-RhVmZKt5McWoez8iwuUGq5A@mail.gmail.com>

On Mon, Nov 23, 2026 at 12:11:55PM +0900, SeungJong Ha wrote:
> 2026년 11월 20일 (금) 오전 10:37, <netdev-bot+sashiko@kernel.org>님이 작성:
> 
> 
> > [Severity: Medium]
> >
> > Does this SAFETY comment justify the from_raw() call?
> >
> > The new Locked invariant says that no other thread accesses the
> > lock-protected phy_device state for the lifetime of a &mut Device<Locked>.
> > from_raw() now also requires the caller to be in the Ctx context.
> >
> > However, this comment and the Locked docs above both say that
> > phy_mii_ioctl() reaches this callback without phydev->lock while the
> > state machine may be running.
> [...]
> > Would one of these work instead?
> >
> > - take phydev->lock around phy_init_hw() in phy_mii_ioctl()
> > - weaken the Locked invariant and drop the accessors that rely on it
> > - give soft_reset a context that does not claim exclusive access
> 
> This is why the Locked docs list these exceptions. Taking phydev->lock
> around phy_init_hw() in phy_mii_ioctl() does not look safe as is:
> vsc85xx_config_init() takes the lock itself through vsc85xx_mac_if_set(),
> so it would deadlock. Fixing that race belongs in phy_mii_ioctl() and
> seems separate from this patch.

phy_mii_ioctl() is meant to be a foot gun, bad things are expected to
happen if you use it. 

/**
 * phy_mii_ioctl - generic PHY MII ioctl interface
 * @phydev: the phy_device struct
 * @ifr: &struct ifreq for socket ioctl's
 * @cmd: ioctl cmd to execute
 *
 * Note that this function is currently incompatible with the
 * PHYCONTROL layer.  It changes registers without regard to
 * current state.  Use at own risk.
 */

I would not spend any time on this.

  Andrew

  reply	other threads:[~2026-11-23  4:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 10:36 [PATCH net-next v3 0/3] rust: net: phy: suspend may run without phy_device->lock SeungJong Ha
2026-11-17 10:36 ` [PATCH net-next v3 1/3] rust: net: phy: drop unused read_mmd, write_mmd and match_phy_device SeungJong Ha
2026-11-17 10:36 ` [PATCH net-next v3 2/3] rust: net: phy: make Device generic over a lock context SeungJong Ha
2026-11-20  1:37   ` netdev-bot+sashiko
2026-11-23  3:11     ` SeungJong Ha
2026-11-23  4:31       ` Andrew Lunn [this message]
2026-11-17 10:36 ` [PATCH net-next v3 3/3] rust: net: phy: pass a MaybeLocked device to suspend SeungJong Ha

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=bfd7a44f-2bba-4aee-9758-1dd88f94566f@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=engineer.jjhama@gmail.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lossin@kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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

all inboxes | Powered by JetHome®