Article View: linux.kernel.netdev
Article #25854Re: [PATCH 0/4] prepare MDIO callers for -EPROBE_DEFER from __mdiobus_register()
From: Hans Zhang
Date: Wed, 02 Dec 2026 15:09
Date: Wed, 02 Dec 2026 15:09
83 lines
12180 bytes
12180 bytes
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/
Best regards,
Hans
Technical Details
Message-ID:
<0ac68808-10b0-49fd-8057-2f9b0ce35319@163.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375888-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>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-375888-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: Wed, 2 Dec 2026 23:09:05 +0800 Organization: Usenet Network Message-ID: <0ac68808-10b0-49fd-8057-2f9b0ce35319@163.com> References: <20261130023745.820141-1-18255117159@163.com> <8e19948b-2376-4913-82cc-281bd924c668@163.com> <8541a0f4-8f25-47ab-89ec-4e37a48358e8@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1996981"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:D6yrn7xLRNKUW0vuLonJovYeZpE= sha256:qerAosJ0e3n+tPThqaJ3mCtDvaqpgef9ZlXjaNCKAsk= sha1:HHxtIuEdqaFa5jbnhusHJAHZD5E= sha256:VSPSTei0W4q/pY2N1FGcuv41zBwL297td4hX23FwusQ= 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 14661117685; Wed, 2 Dec 2026 18:11:02 +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 Q0dcF6gLgOeO; Wed, 2 Dec 2026 18:10:58 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375888-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 9290611764A; Wed, 2 Dec 2026 18:10:44 +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 199A62CA41; Wed, 2 Dec 2026 15:10:33 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796224232; b=M9PkmqEXXr9yDsx0GYm8QK6v7eFrzzjE2+w47vZt9RKVSs+rY2ZtQfvYvBhdjvJO9UeA LwiMJ7ouXY1eKJRO3L1D2Gxviyq1MQAv0oIha98854zKu8g+6QIKN8j6FIDz2TRMipReQ Nz610Rfsp+q1ygi+byekdoRM3nw5XLx5LtGSWxkqvA12YJXMXXaCHCgznXqDuRV78VbmW b34n7QnUwcN4OZ9hqg//Uv0sjsd1IIlvJAnRA+vRJCvHOn3fmZ0+mrDewwtMY4m4sDvLR r3VO6/n2M5CgsqSH5RQeT4V3ru+IvcSak0/TGuCV2ovZbUqYt0SW5Ckwr2JxYSQ4jbw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796224232; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received: Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=OroQFg9f8lb0c/gvLb7bNkFX/pQbVEblaN00XhMmrWk=; b=uuzqbQirCEI9XPvrpnL8oVlRyMoHybqQYyG7/K5fL3UKEdvNR88Ezno927whJxM6voCP MJZZCXMgMCQNynksHDYHsvw3ka6XbyGngxiIA0bO7QLc738Ec0F5SDGZYXSuI6uz9xJsO A2Do6ZNBNm2A9lKL2yaQivxzhYmnFqvn0b8Yakv9ua7M49xN1CspV99jHAzt7yy+TrDyg t5TY0A8efaLZ3kiNeunaQNEFqmHJsEF4gtiMTgYAiCVkFUUPCxQEI8IpTSrZjUCMyHBBa jGnivjpEhpzPNqb9CJUyXDzvh5g8NuPq+Gplc7kswmRkH5EJtpdImxccmYHkUi6956g== 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=liuyKxfC; dmarc=pass header.from=163.com; spf=pass smtp.mailfrom=163.com; arc=fail 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 D4112606A323; Wed, 2 Dec 2026 15:10:32 +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=liuyKxfC X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.5 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796224232; b=CDpOPOOeFIEIWaPf0SgZ/ifhLLNTUNk63TOAJjSYPzAvYBVr/3FLYCrN+XsqttCDQaQt /80u8YsNnuspUXmtlSVZkQAUBKqjDqAwqgRcTyGanlAkkh5894P19DXCvFJgwZG8cVXyt vQCHU+RnC+sytQc2ep1ujxk4+/WySBu7Nxo9+t06wAjf5WisKZ0Yt28DYNZsXRZNjtwKj c7g/m8XFhhanYnRSHR1rm7w0c7NaSnhtnQyqtmmscl6gVIOxYnrgvzQZFSppmb09m/Rb7 8iRNCQeRLuJl4xCqzfWWGw2TmnoUfsJcdWtd4g0as0CWTO5UPppOl8tLO3Sd4Q3zBLQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796224232; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-Originating-IP:X-CM-SenderInfo; bh=OroQFg9f8lb0c/gvLb7bNkFX/pQbVEblaN00XhMmrWk=; b=P2g9S2RE59ZhVJIgQau+tyY4ZxauvZFTHTUd+N/tD/yoD59xJl61p0DiB421lGTnkeys M1lSKwm4n4g6wX5PydxHPEfMsG5TcQ9IdOcgK1OlKI6BteEuTcrEVZJ//mz7/Cl0ezGr7 1sH5dkS66E7oOZt4BPHlPT+9ryVW4eOf4YODC6r9jj+2rMhJEKFsYCzfWsVscQYLPbGIp I+6gTHvNZ82cWhIlRrY+dg7PPvRKFoSgVMur+6v4aywmx/H3pLL8O14/KQ0qR/xkkfjt1 phuztv64JJ05FTrEK8aYi//avJ06Q8W+dn/L/p3IsA1+1zm/RzJRAyHcFaAaR4PYGmw== 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=liuyKxfC; arc=none smtp.remote-ip=220.197.31.5 X-Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.5]) (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 95029606A327 for <netdev@vger.kernel.org>; Wed, 2 Dec 2026 15:10:28 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 95029606A327 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:To:From: Content-Type; bh=OroQFg9f8lb0c/gvLb7bNkFX/pQbVEblaN00XhMmrWk=; b=liuyKxfCZz31PKgvPh7EryQFbiD9yFmL45a/ht49eoz9Ybw9fPo+jwBOwhVS/q XLGjtDITFPGxIQ66XjIX7EMUf4zT5yDcdIPaER9mPQqs26u7w0NkH7LjbuYz6pAR jEzfaPdIErGl5cgDtbtgoJt0fnQhECOm4i5pZNyqEyBrA= X-Received: from [IPV6:240e:b8f:91b3:d000:18af:b7a2:4ba2:35b3] (unknown []) by gzsmtp4 (Coremail) with SMTP id PygvCgD336SQNBBrfdwTJg--.31762S2; Wed, 02 Dec 2026 23:09:05 +0800 (CST) 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: <8541a0f4-8f25-47ab-89ec-4e37a48358e8@lunn.ch> X-CM-TRANSID: PygvCgD336SQNBBrfdwTJg--.31762S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxWF4rtryfZFWDWw1rZryDtrb_yoW5uF43pF Z5GF90yr4DJrWIvFs7CF4UZa40yryxur45GrnYg343ua4Ykr97XrWIqr429Fykurn7Ca12 qrWjqayrCFWUAaDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x0zRwXoxUUUUU= X-CM-SenderInfo: rpryjkyvrrlimvzbiqqrwthudrp/xtbC6xIQs2sQNJKe9wAA3u