Article View: linux.kernel.netdev
Article #27370Re: [PATCH net-next 03/12] net: phy: Don't create the sysfs links for PHYs behind a mux
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 12:18
Date: Sat, 05 Dec 2026 12:18
125 lines
13340 bytes
13340 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] For a PHY behind a mux, phy_attach_direct()
(drivers/net/phy/phy_device.c:2022) now skips phy_sysfs_create_links()…
- [Low] The commit message says that two PHYs' sysfs links in the netdev
entry would 'overwrite one another'.
--
net: phy: Don't create the sysfs links for PHYs behind a mux
This commit adds a mux_port pointer to struct phy_device. When that
pointer is set, phy_attach_direct() no longer calls
phy_sysfs_create_links(). The reason given is that a mux can attach
several PHYs to one netdev, and their sysfs links would conflict.
> Attached phys create sysfs links in the netdev entry, pointing to the
> PHY. We can't have two of them (otherwise they'd overwrite one another),
> so let's just not create these.
[Severity: Low]
Is "overwrite one another" accurate here? Sysfs links aren't overwritten.
When the name already exists, sysfs_do_create_link_sd() returns -EEXIST
from kernfs_create_link().
For the netdev side "phydev" link, phy_sysfs_create_links() logs that
failure, treats it as non-fatal, and still sets sysfs_links:
err = sysfs_create_link_nowarn(&dev->dev.kobj,
&phydev->mdio.dev.kobj,
"phydev");
if (err) {
dev_err(...);
/* non-fatal - some net drivers can use one netdevice
* with more then one phy
*/
}
phydev->sysfs_links = true;
So the real problem looks different. An error is logged for each
additional PHY, and phy_detach_internal() removes the "phydev" link by
name:
if (phydev->sysfs_links) {
if (dev)
sysfs_remove_link(&dev->dev.kobj, "phydev");
sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev");
}
Detaching one PHY could then remove a link that belongs to another PHY
that is still attached.
The same collision and remove-by-name behavior already exists for non-mux
drivers that use one netdev with several PHYs, as the in-tree comment
says.
Could the commit message describe the failure more precisely, and say
that only the netdev side link can collide?
> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
> index 60440b62e6c79..9630578a6a5c5 100644
> --- a/drivers/net/phy/phy_device.c
> +++ b/drivers/net/phy/phy_device.c
> @@ -2019,7 +2019,8 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
> */
> phydev->sysfs_links = false;
>
> - phy_sysfs_create_links(phydev);
> + if (!phydev->mux_port)
> + phy_sysfs_create_links(phydev);
[Severity: Medium]
Does skipping the whole helper also drop the attached_dev link for mux
PHYs? phy_sysfs_create_links() creates two links:
err = sysfs_create_link(&phydev->mdio.dev.kobj, &dev->dev.kobj,
"attached_dev");
...
err = sysfs_create_link_nowarn(&dev->dev.kobj,
&phydev->mdio.dev.kobj,
"phydev");
The attached_dev link is created under each PHY's own mdio device kobject.
Several PHYs behind the same mux therefore can't collide on it. Only the
netdev side "phydev" link can conflict.
Later in the series, phy_mux_attach() calls phy_mux_port_bind_phy(), which
sets phydev->mux_port, and then calls phy_attach_direct():
ret = phy_mux_port_bind_phy(port);
...
ret = phy_attach_direct(dev, port->phydev, phy_flags,
port->interface);
phy_attach_direct() still sets phydev->attached_dev = dev and adds the PHY
to the link topology. Every mux PHY is attached to the netdev, but
/sys/class/mdio_bus/<bus>/<device>/attached_dev is never created for any
of them.
Documentation/ABI/testing/sysfs-class-net-phydev describes attached_dev as
a symbolic link to the network device this PHY device is attached to. It
makes no exception for muxes. The phydev entry in
Documentation/ABI/testing/sysfs-class-net doesn't mention the mux case
either.
Skipping the netdev side phydev link seems fine, because phy_mux_attach()
sets dev->phydev = NULL anyway.
Would it make sense to keep creating attached_dev for mux PHYs and only
skip the netdev side link? If not, could the exception be documented in
the ABI files?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204110622.1106492-1-maxime.chevallier%40bootlin.com
Technical Details
Message-ID:
<179647310509.3146.4826722371590579464@kernel.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377976-linux-kernel-netdev=dewy.ruReferences:
<20261204110622.1106492-4-maxime.chevallier@bootlin.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377976-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next 03/12] net: phy: Don't create the sysfs links for PHYs behind a mux Date: Sat, 05 Dec 2026 12:18:25 +0000 Organization: Usenet Network Message-ID: <179647310509.3146.4826722371590579464@kernel.org> References: <20261204110622.1106492-4-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3022930"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:p0LJs902JuYaryHshj/aDi3iULs= sha256:IMdCkjdCxnF5Mqi4BzOhD85f7YNSdwV06yjsCDAL7W8= sha1:kkJ5j+2xA2oQj1tPKWYhb6w8Jf0= sha256:MpfpusjRe2F2qpjm0CdM5mxiuSkYxnQYF/FTL27CF9s= 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 38570117E17; Sat, 5 Dec 2026 15:18:47 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 Wmf5WLQ_sk9T; Sat, 5 Dec 2026 15:18:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377976-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 5D708117E10; Sat, 5 Dec 2026 15:18:34 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 420DD2A2A5; Sat, 5 Dec 2026 12:18:32 +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=1796473108; b=tjhM/Go/J7VhP4l0Ho9ZP41LM/zyqlvvQ2jDOav7fYs4vDWrwcR3lLtN9zk8U6PeaRbJ dvFUlAvPqxlqRhGh0eBUNssFDM2HCC70s9nYHkaCNDtUNYRWFKyq40We2/WP3xBdDYqxc joys+UKj0a2jtKIdMIO3rwRzHl8h/n7AGcU3BaUCseSGSW2+fVqnqkH2T6cdUJFxye2H+ da9ckPW4K5YzCPw2Df6gXSa5dzS46WM+EKSAi3w11eufXk8tHHyJVE1MhgH0n5AV8evFq N3Ysfp7E0bVu19w92Tl7ew/Gkef4PeuPIgyAJdEpQ9UKwE6DZtjPg02VLjFSc0IKUfA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796473108; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=98HDtdYceyH1sVTjx9YM/4TadLeBbUPmtzntEXs28HE=; b=VmsAF3rgG2DZdXmZ1mt04HEPhZ/ePDOKKaiDFvaoa4kczo99qgs5UnW1+AGdP07vfmNt v/qMYYulr5ip97xY5bAzVyRtytBWYl4oRvzrTJdyHUdyCYt6/OTl7RNrySnoJDIywxqey 45u7F7qTb5jNY/gTPVWSxpY22zfG4sr9tzKufydICl55Px4r2wMfwru1TTmK5bzDg0AIQ zgfxD3rh8fXmMemzWo0kbrnz/cI4av/hhn8BTUrEkAOOoOti87FODlqp6++csGHcltSZS iuLP7VLdPGlo85N/dQ+QcM2oyFIWR3LaUjhmx3ivJFOvcgobJ2nKPTUmiY/NWdXL7GA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SX2OVH2l; 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 951F0606A68F; Sat, 5 Dec 2026 12:18:28 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SX2OVH2l X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796473107; b=dyEeVF1QmlhtcGSVQH5tQWdX2zxU1Tz5HcJmUHO77ZaNHwobdxa0mpsV5ecjpCG8bn48 9HhlcmP1TC/aV6z0aBMkBjUwo/xOFsflrklwNZS9n0JjUaakWgmXngWee9eHVngewyuRj Xhd/f3/1RFawLKcmVNVUzZZdKVlrjZ+MYH609soAG+2SftdECzib9cZZt4/GSIZzb8RWi B8oaHUZ9et8zwo9Wv5oTcG24tj0OXyvsreNHHJowrgMUCFVm6j/Kos+1re26AGwtrHOLF A2Pe22BX88+5DL/g0vTwS6NkV/gYGPU7lYLnnCBW8n4cJh3ePVJegajpTlJmGdOj5qg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796473107; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=98HDtdYceyH1sVTjx9YM/4TadLeBbUPmtzntEXs28HE=; b=aNmwCmgbsB03cr0Qrxgw3QPkowf16m5GDYk5e9meXOyXH9Dsua8ShiJ7J0ExcG/pzxNP RmEIXKXSw2ZJvnRv7R0uSQEzviJ7T3N2Z1aZt5h43pqS/abYw0JAaWPi/12tR1rVi3Dcd kDvEpc58yowdlYRCo0WRsmJTvf0mZR2oYoS/f/MSLx43fi1TT2xRAIZmFlFzhe1FDdd9Y 3jDdCMPPfAtmkirIrTScOPc+qPoN51nodXrAoVGGpr6l83nST4qeMcjGZoByhq0zmX+Ag vFgz+8cJFExg0Lli90MG2S5Mh3xBmgQeXFpQK8cDV8UQoBQey5hJqoaLFodPcoWGuFA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=SX2OVH2l; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B28AB606A685; Sat, 5 Dec 2026 12:18:27 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 870501F0092B; Sat, 5 Dec 2026 12:18:25 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796473107; bh=98HDtdYceyH1sVTjx9YM/4TadLeBbUPmtzntEXs28HE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=SX2OVH2lnkTHU0ptNX9gafBC7pjjNfRhepriE/2pEBLErYXeaUc/JR2v8dK0Mdpn1 yXHOBPz9MRxqBuDprn0O060CrUcwkHRCl3HQOBtlBvxI+OlU9nFTkHX0vxN+GPNPfH DZnRxIFzcweA6VMTjbNGK7AexECzSlhEyr0UDz6pkp1SGtH5UJ/p9o4B9uKy5f7B+d 8S7wfdDeYEZGf1COVWM+xzfEEvGBJOavqF276VjctjS1MAT14aqdjuHSe2dEP//1R4 hoQMwGOuxRAnz+8uH26aUc5evjG9rkmVw/cAC55ydVqo0OUxagF3w+9Jkeh4rcL4pa UmpwY45y1eN+A== X-Cc: davem@davemloft.net, andrew+netdev@lunn.ch, kuba@kernel.org, edumazet@kernel.org, willemb@google.com, pabeni@redhat.com, linux@armlinux.org.uk, kabel@kernel.org, sebastian.hesselbarth@gmail.com, gregory.clement@bootlin.com, hkallweit1@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, thomas.petazzoni@bootlin.com, devicetree@vger.kernel.org, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, christophe.leroy@csgroup.eu, herve.codina@bootlin.com, f.fainelli@gmail.com, vladimir.oltean@nxp.com, kory.maincent@bootlin.com, o.rempel@pengutronix.de, nicveronese@gmail.com, horms@kernel.org, marcin.s.wojtas@gmail.com, daniel@makrotopia.org, dimitri.fedrau@liebherr.com, frank.wunderlich@linux.dev, p.ameruoso@live.it, f@lex.la X-In-Reply-To: <20261204110622.1106492-4-maxime.chevallier@bootlin.com> X-sashiko-severity: Medium 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