πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20716

Re: [PATCH net-next v3 2/3] rust: net: phy: make Device generic over a lock context

#20716
From: Andrew Lunn
Date: Mon, 23 Nov 2026 04:31
46 lines
10415 bytes
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
Technical Details
Message-ID: <bfd7a44f-2bba-4aee-9758-1dd88f94566f@lunn.ch>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369032-linux-kernel-netdev=dewy.ru
References: <20261117-exp-phy-rs-maybelocked-v3-2-4e183a7366a7@gmail.com> <179513866237.3136.3197734576083995986@kernel.org> <CAGAB667HcHxS-XboSz559SG3tT-RhVmZKt5McWoez8iwuUGq5A@mail.gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder2.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369032-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <bfd7a44f-2bba-4aee-9758-1dd88f94566f@lunn.ch>
References: <20261117-exp-phy-rs-maybelocked-v3-2-4e183a7366a7@gmail.com> <179513866237.3136.3197734576083995986@kernel.org> <CAGAB667HcHxS-XboSz559SG3tT-RhVmZKt5McWoez8iwuUGq5A@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="3790027"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:vypCWDbIDyoRx1+/NLxXJZ4maok= sha256:pGmbcvgINHRbUaT0BePKXSvh5kDApvRJPVET3FaIlYo= sha1:kKA7eWmiLigVHlpBF3kmTT/cdSI= sha256:h1MKC+kSAFFbhFyw+5vx+m4zmqwVZUnj3mfs+ud77m8=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id B8C81125D8D; Mon, 23 Nov 2026 07:32:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z65VvaabJMU5; Mon, 23 Nov 2026 07:32:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369032-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 8A3BE125D8B; Mon, 23 Nov 2026 07:32:12 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 05B12298D1; Mon, 23 Nov 2026 04:32:11 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795408330; b=41ZhV9t1dCbBw6zxWx4amxz/2rba7Z1cSEJaVmyBoOENuFs3vg/3Nx7b+2O3JAziUhyv /mkU/K7pe83VQrG0dsDqn6sb0VfizsHEiyd3FlbLMkdusqDa1pk6pa/a3+XAN6WRYltSC E7VLle/bqhFL9Xkb/VtU+WKY9P+3c2h7F+j8JIHK/YXHA7XIpS3PZkSpcn0PN2rZC2Zkr 815N6K4OSsr4/NMBC9JVgu/J9O2y41FJHgk3AqptDZwS+YZqT12ikMp1eDBrOyR5gf3ch 4LhFMipkSfXbk0A6ZiIlV7+3268j56BtMNM9q/KUNuG5hExIzwPCEbIdT+7RwNISu4g==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795408330; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=qg/kJeOBkORTxeX5fcxRClbAV/v8KBYiSMusiaVJKno=; b=I3cNWCcfSBZJj1xrR0y30Lwuig6iUEeSaTnfQZzxbK9rVIjuX0x8y6uVVeQwDLnklU8P wX7uieL03MZttdQ0rRYY6/K3NgUHjPJKl6jENX8FHDDIllyAK/Ruwa6w2PR10rFjsRok5 0ax/PK2QaoIMO9Ryvq2q7fndFqnCA7fCsROYQnkE0U/8evODKOrmMTWleNRmwNpoeOAAU S/5Lb8teWYxKgHsxxLv3D23F1IULS1h2Dz6JQETJmnjNAbeCiXu91snGSXLPkawzaOm02 Xw3Y6D40T3s+Xy+h4risOB0uR3h2oEgpX8cIzLseh+sQKSoG/JYKe2SBVSiDIQ0nQvw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=WOttlwxa; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EF73E606A32C; Mon, 23 Nov 2026 04:32:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=WOttlwxa
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795408324; b=HIIaZZI6vJdGuCxhO2CShUi60I8HpHX8hxtyFnHIYHCods05CNZa+ewAwITZv+zwTItc Vtl0QLHuvjs8muxd8tUhOON8dV5h8fMyOeI1thWmN/kTHQjHwYZGdfvBiOD2LpShc/QOi yQ/nrKh/JfXjeZDvEwxZNe3vGDGWTswYhZEslIr+jaryb80krWBWuILthDr4wzzvoUsae gn9DyG+I1GNzaUwp60iUUx/Y0Alpa3D97UjZpUhocVbKEEpYYvk1Ukh3Le+U68+BkNI33 nscRIRYsU7RMzjl7orgVXpAqq5FUB0CJWnfpCOKtDMxFS+7zGIJAgvVCLx0Uba6cRuQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795408324; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: Content-Transfer-Encoding:In-Reply-To; bh=qg/kJeOBkORTxeX5fcxRClbAV/v8KBYiSMusiaVJKno=; b=y6oKa55NXbXFYQU6Pk4MkSjjjXU7pU69PlgTTMzzxIJeB33RXnBBiAJj0mJYVPaTvGV6 gCxz/CPgxGPAH99R59j2lAcJZXmcr9uZv2ryeA/VSI+p/9LsgchONZr/Ks8ZIxByv6FKn Khjvm0E13xygA1MN3gzebAbi5U7Wc99IJXhEqcXDIXhmSop2CqYdPZE2LhZAyvEgxSEWf JEzWz2PPZZ/3BUCeF/JiZHncYWnhDbLcJdT6GDHEH6owk3+ZUTomD5Gys0nimXYe6wi6P 4mQQ02xEYm0O/3kAKPEN2NXXLq9cAYEvaob8K6RzOmwVItE/x0DEaBSygbW1wz0w6hg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=WOttlwxa; arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0EC4606A31A; Mon, 23 Nov 2026 04:32:03 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B0EC4606A31A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding:Content-Disposition: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:From: Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Content-Disposition: In-Reply-To:References; bh=qg/kJeOBkORTxeX5fcxRClbAV/v8KBYiSMusiaVJKno=; b=WO ttlwxav6/WRXMtpDRzgT7DlGf6XYq4BfMZE2fARkj7uTlyMCHvNM2lAq/o0iO9ZtSG/9tUT95Q1lI 6fOikqF/7kAhtx2XfSf8a2TRSLMxUdF4NoRaixYKtkDHktRRaLrJ02irL87ohOUH1Wn7FGWkogCoM 0gRYobqS3YuVTwo=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xVLiE-000h2b-7O; Mon, 23 Nov 2026 05:31:30 +0100
X-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
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <CAGAB667HcHxS-XboSz559SG3tT-RhVmZKt5McWoez8iwuUGq5A@mail.gmail.com>