Article View: linux.kernel.netdev
Article #26227Re: [PATCH 0/4] prepare MDIO callers for -EPROBE_DEFER from __mdiobus_register()
From: Hans Zhang
Date: Thu, 03 Dec 2026 09:05
Date: Thu, 03 Dec 2026 09:05
124 lines
13918 bytes
13918 bytes
On 12/2/26 23:09, Hans Zhang wrote:
>
>
> On 12/1/26 21:40, Andrew Lunn wrote:
>> On Tue, Dec 01, 2026 at 12:19:54PM +0800, Hans Zhang wrote:
>>> Hi sashiko,
>>>
>>>
>>> Thank you for the review. The High issues are valid.
>>>
>>> v2 will:
>>> - drop the smsc9420 change, since its mdiobus_register() call is in
>>> ndo_open rather than a probe path, and the v1 version could return
>>> success after a PHY probe failure;
>>
>> You need to be careful here. What context is open called in? Can you
>> return EPROBE_DEFER here? Generally no.
>>
>> What makes this interesting is things like NFS root. You pass on the
>> kernel command line all the parameters needed to connect to the NFS
>> server. Deep within netdev_register(), generally called from probe, it
>> can open the device, and start sending packets in order to connect to
>> the NFS server. So the device is alive and running before
>> netdev_register() even returns.
>>
>> If probe was called in async mode, can open be called in async mode,
>> resulting in an EPROBE_DEFER from mdiobus_register? What happens then?
>> Does it all correctly unwind and the probe is tried again later in
>> sync mode?
>>
>
>
> Hello Andrew,
>
> You're right to push on the open path. I traced it: smsc9420 registers
> its MDIO bus from smsc9420_open() via smsc9420_mii_init(), and open()
> folds any error into -ENODEV. __dev_open() just does ret = ops-
> >ndo_open(dev); return ret; with no deferred-probe handling, and NFS
> root reaches ndo_open via ip_auto_config() -> dev_change_flags(IFF_UP) -
> > dev_open(). So returning -EPROBE_DEFER from open is wrong, and
> current_is_async() cannot distinguish probe from open in a leaf like
> mdiobus_register().
>
> That confirms the defer-from-async approach in phylib does not hold.
> Combined with Sashiko's other findings (the deferred retry can be re-
> queued async and defer forever, and get_phy_device() callers fold -
> EPROBE_DEFER into -EINVAL / -ENODEV / -EIO), I'll drop the phylib core
> change.
>
> For now I've sent v2 as a standalone cleanup: propagate the real
> mdiobus_register() errors, and convert the callers in a real probe
> context to dev_err_probe() so the existing reset-GPIO -EPROBE_DEFER path
> no longer prints a misleading message. Jijie Shao pointed out one hns3
> hclge_mdio.c spot that should be return dev_err_probe(...) instead of
> the braces; I'll fold that into v3.
>
> Since v2 only folds in Sashiko's review comments, I'll hold off on the
> next version until I've heard back from you and the other reviewers,
> rather than respinning quickly.
>
> For the original deadlock, I found this exact problem was discussed in
> the dw-rockchip async-probe thread [1], where Robin Murphy proposed
> fixing it in the driver core: in __device_attach_driver(), defer a child
> device whose driver wants a synchronous probe while the parent probes
> asynchronously:
>
>
> if (!async_allowed && current_is_async()) {
> driver_deferred_probe_add(dev);
> return 0;
> }
>
> That "fix the context" approach avoids the open-vs-probe and permanent-
> deferral problems, since it never lets a sync-request_module caller run
> in async context. I'm testing Robin's patch on my Sky1 board now and
> will report back with the results. Does that look like the right
> direction to pursue with the driver-core maintainers?
>
> [1] https://lore.kernel.org/driver-core/55c28218-1638-4b90-a9cd-
> a177fb5abcb6@arm.com/
>
Hello Andrew,
Follow-up on the direction question from my last mail: I've now tested
Robin Murphy's driver-core patch from the dw-rockchip thread [1] on the
Sky1 board — two RTL8126A NICs behind a PCIe controller that sets
PROBE_PREFER_ASYNCHRONOUS, i.e. the exact async + request_module() case.
Robin's patch as posted doesn't actually work: the child device is
silently dropped — never probed and never queued.
driver_deferred_probe_add() returns early when dev_can_match() is false,
and in this path that flag is only set later in __driver_probe_device(),
which the early return in __device_attach_driver() never reaches. So
the device ends up neither
bound nor on the deferred list.
Setting the flag first fixes it:
if (!async_allowed && current_is_async()) {
dev_set_can_match(dev);
driver_deferred_probe_add(dev);
return 0;
}
With that one line, on Sky1 both RTL8126A NICs bind (eth0/eth1 up, link
running), the __request_module() WARN_ON_ONCE() is gone, and boot time
is unchanged (the NICs probe slightly faster than the splatting baseline).
So the driver-core defer is the right fix: it makes the driver core
honor a synchronous child even when the parent probes asynchronously,
rather than teaching phylib to detect async. I'll take the results and
the one-line dev_set_can_match() delta back to the dw-rockchip thread,
and see whether Robin wants to post it himself or would like me to —
happy to add my Tested-by either way.
[1]
https://lore.kernel.org/driver-core/55c28218-1638-4b90-a9cd-a177fb5abcb6@arm.com/
Best regards,
Hans
Technical Details
Message-ID:
<e253cb94-2145-49d7-b13d-2fe3d5b9829e@163.com>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376423-linux-kernel-netdev=dewy.ruReferences:
<20261130023745.820141-1-18255117159@163.com> <8e19948b-2376-4913-82cc-281bd924c668@163.com> <8541a0f4-8f25-47ab-89ec-4e37a48358e8@lunn.ch> <0ac68808-10b0-49fd-8057-2f9b0ce35319@163.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!3.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!peer04.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376423-linux-kernel-netdev=dewy.ru From: 18255117159@163.com (Hans Zhang) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH 0/4] prepare MDIO callers for -EPROBE_DEFER from __mdiobus_register() Date: Thu, 3 Dec 2026 17:05:11 +0800 Organization: Usenet Network Message-ID: <e253cb94-2145-49d7-b13d-2fe3d5b9829e@163.com> References: <20261130023745.820141-1-18255117159@163.com> <8e19948b-2376-4913-82cc-281bd924c668@163.com> <8541a0f4-8f25-47ab-89ec-4e37a48358e8@lunn.ch> <0ac68808-10b0-49fd-8057-2f9b0ce35319@163.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2443623"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:cQnFtF1dWDLl3hOUaFqFoUkjMXo= sha256:pf664YqC+fdTDUfsWbQfQgZrKrVqZY3WFLxBqJK8wGc= sha1:UTsSJEbpP9Sezu1GJHeHR+4HhDI= sha256:OJEunsq1WgTR2yGcLrymbTtd8egnYe9Ylc0svssy+UU= Content-Language: en-US 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 9B463117889; Thu, 3 Dec 2026 12:06:28 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.717 X-Spam-Status: No, score=-2.717 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, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, FROM_LOCAL_DIGITS=0.001, FROM_LOCAL_HEX=0.331, 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] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=163.com 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 A3T_-Oa741Lp; Thu, 3 Dec 2026 12:06:20 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376423-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 8710211786F; Thu, 3 Dec 2026 12:06:07 +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 0D97E2767C; Thu, 3 Dec 2026 09:06:06 +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=1796288765; b=wHm3BOc0Zm/lUQMwx6srlDko3Z7deytWMZmzGIKXVdz0fs93b+/qpsrE7VoA5BKQWwDe sghORh8n0E1JdADxWniCGrfEiq3iGJVPAhGMJp19O8SLZO4OGLnx8ipQLNxwbhSy/zbsk /lTNVKWzNs1Wl9UgZVy35rF93rHdtjgiAiscR6G8m3Ct4+GaFey4MdsXXCiGAm9JQ7sii 1v2Eim+vQ3d68VerItcq5HUUGxDRPTYXjeypFBiG2N4/z5vFj4XHDsET49YeR91dMyH3+ QkvtYaLtkGnJv+LWQv9VU2aqWXOCrwlQi3wzCQV39Saim41rp0olaekAJimjOFkN1Tg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796288765; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Message-ID:Date: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:User-Agent: Subject:From:To:Cc:References:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=4J7UbEgcv1b5ATFmkTUeVFKn8+6HcaYhiXGfL+npoyg=; b=akRO3a3QD6c2iPgnbWcJu2z78udx56Hn/ZJq71OWrymXObUsGa9gcAMkv1MAJqGe/O/q SseeQ/w/bWKru7gE/CvdTGlswCidBw43UI+SU4Obs3Xv0b/a1S2iY0mRO9OUfgSXMcuw3 82l+RQGJ1k+lrbFydiSA+/BTJtzzNe45PNuO2BowajSHiMBqy+rm+JJMuHhBftWeu68fi xiQTASJLgAc8dbjgKfe/UeVlZDPgIjGWoIY4p/ryXTwQ9whMmHgU5h8hRIHlxEEJemp5o KrwOTaGRU5mz/sAsczf1zwDvJEa/35xZK1K0ZMomWRR4RfrMDOTQL51J0EuUrJ0YGKg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Rq2nS5E8; dmarc=pass header.from=163.com; spf=pass smtp.mailfrom=163.com; 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 DA045606A333; Thu, 3 Dec 2026 09:06:05 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Rq2nS5E8 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=117.135.210.3 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796288765; b=ZyVXIRjUZvAwAGl7ry1qvCBBpo98ZBWSu7ls7fv5LdsPFlNyDCmAuOVx4RI1NemXoIhh T5BNljpSy9SwrvzAv5V02KQYbgKY70gDMlQIsIcZ/z/l9J4lbMUp6Mjz0Zu/WxFmlKzl/ FCmY67F3JCK08g+khj9PLHDyzclykZLLF2RQ9zGjmCBzJmeMf0eNI4lIfRO8f9mTOpJwx XkuDZZq+mhaxv2RQRqcq+n453Brtsod2JUI+6XVVb0gDfJbWM5t94iB0G1Svn7pdWar6S ORwwhikuRSZrbac1M4Us8B00MORaWaRRkdwELCl/OLyi+J87goxEP7o5AA/o2pnL2eA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796288765; h=DMARC-Filter:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:From:To:Cc:References:Content-Language:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=4J7UbEgcv1b5ATFmkTUeVFKn8+6HcaYhiXGfL+npoyg=; b=ZZFbmwrjOPZbsx9kgA261E0CCOmq4Ay9zPRHbvIp8684Q/XgGMyP+GOGe+WX3SXjvy80 f10S+jyXoJ9CfHUEWW8/wmgAH3LRQGb77jmmOQXq2lF6/rjFuRBB7yLiXriGOtPRNoiEM y0IoCDHH6ydfoqnmkxGGKQv0CZMvUjKBI7OuU/RVnX9v1DcyIczGDb02UJhV6Qde0zKPV SdQeUIf03iKe0Hn0DmwCdZf7nV393R7yxIJACEd09nDYN6cV4372OEwTcB9wIEA2NIcbe fe3TXNvg1JGWFjFFyT5H5NhzDn3qZTUfSQpgcrWoRD8dusjxuHUy5WT+Ff14i8G008A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Rq2nS5E8; arc=none smtp.remote-ip=117.135.210.3 X-Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C670B606A32C for <netdev@vger.kernel.org>; Thu, 3 Dec 2026 09:06:01 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C670B606A32C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:From:To: Content-Type; bh=4J7UbEgcv1b5ATFmkTUeVFKn8+6HcaYhiXGfL+npoyg=; b=Rq2nS5E82ZflrRsDHRdeOQpbXr5Yiyp6ts+7Tf9PPUAZ1kQEusjI8DetjMbJL5 WJCRWrx35xYXZlQmmqMjf32SaIbruVVjjnYk8JyXsbnuzN/YAowKf2dmtYcEoV/a jMzVpqgE2AbhIewuEPxEDzdKwheh+qBflMODCe/K381Ds= 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-User-Agent: Mozilla Thunderbird X-Cc: hkallweit1@gmail.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, linux@armlinux.org.uk, netdev@vger.kernel.org, netdev-bot+sashiko@kernel.org X-In-Reply-To: <0ac68808-10b0-49fd-8057-2f9b0ce35319@163.com> X-CM-TRANSID: PygvCgCX6G_HMBFr4ciwJg--.52471S2 X-Coremail-Antispam: 1Uf129KBjvJXoW3JF4UJw4xKFW5Gr4rWrW8Xrb_yoW7GFW5pF Z5JFyYkr4DKrWIvFs7uF47Aa40yw4fZr45Grn5W343uas0kr1xZrWxJr47uFykurs3C3W2 qr4jqayrCFWUAaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zR5xhJUUUUU= X-CM-SenderInfo: rpryjkyvrrlimvzbiqqrwthudrp/xtbC6wldAWsRMMlyVAAA3b X-Received-Bytes: 13585