Thread View: linux.kernel.netdev
8 messages
8 total messages
Started by Hans Zhang
Fri, 27 Nov 2026 07:43
[RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Hans Zhang
Date: Fri, 27 Nov 2026 07:43
Date: Fri, 27 Nov 2026 07:43
55 lines
10640 bytes
10640 bytes
Hi Andrew, Bjorn, Mani, I'd like to raise a cross-subsystem issue before sending a one-line fix. Several PCIe host controller drivers set PROBE_PREFER_ASYNCHRONOUS so their root complexes are enumerated in parallel. On the CIX Sky1 SoC the driver probes up to five root complexes. When it enumerates an RTL8126A NIC, the NIC's mdiobus_register() runs in an async worker, and phy_device_create() then calls request_module() synchronously. That hits: WARN_ON_ONCE(wait && current_is_async()); and can deadlock, because module init may call async_synchronize_full(). This is not specific to Sky1. The same pattern exists in many PCIe host drivers, for example: pcie-mediatek-gen3.c, pcie-rzg3s-host.c, pcie-aspeed.c, pcie-stm32.c, pcie-qcom.c, pcie-spacemit-k1.c, pcie-rcar-gen4.c, pcie-andes-qilai.c, pci-layerscape.c, pci-imx6.c, pcie-nxp-s32g.c So any of them could hit the same problem when a downstream device probes an MDIO bus. I see two possible fixes: 1. PCI side: force synchronous probing on the affected host controller driver (PROBE_FORCE_SYNCHRONOUS). This is self-contained and low-risk, but serializes the root complex enumeration. On sky1-xcp (three root complexes) the measured boot time is close to the async baseline, but that measurement does not include PCIe PHY enumeration or link-training timeouts. Serializing the root complexes would sum those latencies, so the real cost grows with the number of root complexes and PHYs. 2. net/phy side: return -EPROBE_DEFER from __mdiobus_register() when current_is_async() is true. This keeps async probing and fixes all MAC drivers, but I audited the in-tree mdiobus_register() callers and found some (lantiq_etop, smsc911x, smsc9420) that convert any error to -ENXIO and would not defer correctly. Could you advise which layer should carry the fix? If the preference is the general net/phy approach, I can follow up with a more detailed audit of the callers. Test data on sky1-xcp: - unpatched async kernel: the kmod WARN is present; - PROBE_FORCE_SYNCHRONOUS: WARN is gone, both RTL8126A NICs still probe and bind their PHY driver, NVMe/root and the serial console are normal. Init starts at ~2.63s versus ~2.79s for the async baseline in this three-root-complex configuration. This measurement has no PCIe PHY or link-training timeout in the path, so it is a lower bound. Best regards, Hans
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Hans Zhang
Date: Fri, 27 Nov 2026 08:02
Date: Fri, 27 Nov 2026 08:02
251 lines
19856 bytes
19856 bytes
Hi all,
The patching process under discussion:
https://patchwork.kernel.org/project/netdevbpf/patch/20261124070753.25972-1-18255117159@163.com/
(include v3 patch)
https://patchwork.kernel.org/project/netdevbpf/patch/20261124070753.25972-1-18255117159@163.com/
drivers/pci/controller
grep -nr .probe_type
pcie-mediatek-gen3.c:1447: .probe_type =
PROBE_PREFER_ASYNCHRONOUS,
pcie-rzg3s-host.c:2185: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
pci-hyperv.c:4196: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
pcie-aspeed.c:1107: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
cadence/pci-sky1.c:238: .probe_type = PROBE_FORCE_SYNCHRONOUS,
dwc/pcie-stm32.c:360: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
dwc/pcie-qcom.c:2642: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
dwc/pcie-spacemit-k1.c:352: .probe_type =
PROBE_PREFER_ASYNCHRONOUS,
dwc/pcie-rcar-gen4.c:1161: .probe_type =
PROBE_PREFER_ASYNCHRONOUS,
dwc/pcie-andes-qilai.c:189: .probe_type =
PROBE_PREFER_ASYNCHRONOUS,
dwc/pci-layerscape.c:422: .probe_type =
PROBE_PREFER_ASYNCHRONOUS,
dwc/pci-imx6.c:2287: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
dwc/pcie-nxp-s32g.c:396: .probe_type =
PROBE_PREFER_ASYNCHRONOUS,
Andrew suggested:
drivers/pci/controller/cadence/pci-sky1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pci/controller/cadence/pci-sky1.c
b/drivers/pci/controller/cadence/pci-sky1.c
index 82f4ae5c04a8..4448ee3d5e73 100644
--- a/drivers/pci/controller/cadence/pci-sky1.c
+++ b/drivers/pci/controller/cadence/pci-sky1.c
@@ -235,7 +235,7 @@ static struct platform_driver sky1_pcie_driver = {
.driver = {
.name = "sky1-pcie",
.of_match_table = of_sky1_pcie_match,
- .probe_type = PROBE_PREFER_ASYNCHRONOUS,
+ .probe_type = PROBE_FORCE_SYNCHRONOUS,
},
};
module_platform_driver(sky1_pcie_driver);
Best regards,
Hans
On 11/27/26 15:43, Hans Zhang wrote:
> Hi Andrew, Bjorn, Mani,
>
> I'd like to raise a cross-subsystem issue before sending a one-line fix.
>
> Several PCIe host controller drivers set PROBE_PREFER_ASYNCHRONOUS so
> their root complexes are enumerated in parallel. On the CIX Sky1 SoC the
> driver probes up to five root complexes. When it enumerates an RTL8126A
> NIC, the NIC's mdiobus_register() runs in an async worker, and
> phy_device_create() then calls request_module() synchronously. That hits:
>
> WARN_ON_ONCE(wait && current_is_async());
>
> and can deadlock, because module init may call async_synchronize_full().
>
> This is not specific to Sky1. The same pattern exists in many PCIe host
> drivers, for example:
>
> pcie-mediatek-gen3.c, pcie-rzg3s-host.c, pcie-aspeed.c,
> pcie-stm32.c, pcie-qcom.c, pcie-spacemit-k1.c, pcie-rcar-gen4.c,
> pcie-andes-qilai.c, pci-layerscape.c, pci-imx6.c, pcie-nxp-s32g.c
>
> So any of them could hit the same problem when a downstream device probes
> an MDIO bus.
>
> I see two possible fixes:
>
> 1. PCI side: force synchronous probing on the affected host controller
> driver (PROBE_FORCE_SYNCHRONOUS). This is self-contained and low-risk,
> but serializes the root complex enumeration. On sky1-xcp (three root
> complexes) the measured boot time is close to the async baseline, but
> that measurement does not include PCIe PHY enumeration or link-training
> timeouts. Serializing the root complexes would sum those latencies, so
> the real cost grows with the number of root complexes and PHYs.
>
> 2. net/phy side: return -EPROBE_DEFER from __mdiobus_register() when
> current_is_async() is true. This keeps async probing and fixes all MAC
> drivers, but I audited the in-tree mdiobus_register() callers and found
> some (lantiq_etop, smsc911x, smsc9420) that convert any error to
> -ENXIO and would not defer correctly.
>
> Could you advise which layer should carry the fix? If the preference is
> the general net/phy approach, I can follow up with a more detailed audit
> of the callers.
>
> Test data on sky1-xcp:
> - unpatched async kernel: the kmod WARN is present;
> - PROBE_FORCE_SYNCHRONOUS: WARN is gone, both RTL8126A NICs still probe
> and bind their PHY driver, NVMe/root and the serial console are normal.
> Init starts at ~2.63s versus ~2.79s for the async baseline in this
> three-root-complex configuration. This measurement has no PCIe PHY or
> link-training timeout in the path, so it is a lower bound.
>
> Best regards,
> Hans
>
>
> From mboxrd@z Thu Jan 1 00:00:00 1970
> Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.4
> ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
> t=1795765658;
> b=RjoyypZgbZDwyd3QkV/OiZgDapLyNcxzJz6NKIsLEmSYH4sJpIC63er0ybcJN1Lj3V8I
> 41xKXM0pKHvgRKEYboloC02uUTTjSquCG/sXbDg4j0Mmr9XhxmdoLkfSvirMa/0YbHzqE
> 0WIhxbAEgkwaXtDrNoWtrr3DO1cKiQmITsc5z4TXfQI0dbSYrWUqgiQhWVWNrSK/N2GIe
> 5u0s/t7nPwy1KKPEyZycZBzcal2guSmOUsGmVvzh+Oi/X6FCzeElMS3fYeXn+FvJp4wZP
> zLFSHcg1QuTESediE2SSqnmSNB9IIacY74P7lBN9KT+9maBjFl9pPtafck17nVKNrqg==
> ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
> a=rsa-sha256; c=relaxed/relaxed; t=1795765658;
> h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
> Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
> X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
> bh=FPV4ZeWzsKzafgZAHwIqdOFaSmYfPco7h5vg+lLApZ8=;
> b=f7V9AxZegDZlT2urAaY66WTPD8oVyDkNf5Byw6Jy2MaV3z0CDfrpQlgw7wj7sEXKsGlC
> O9dHxH2OIuwr+GJZLELrUw0PlOxWvpQ95FtF/ReGvSPfrxwhlh7/lUKeDpMQG/TIram9h
> Aq9k5/HUSWTu1SEjtabOO7IsbV/fM4GlKP9DE7IPTUEV+kQ14xTFXgi6PDwfLj6hxAzey
> vokiqZKIvFfZa/1bgzv/wjHjp7yubJkURFUTotMzspejMzUFuV+16BRg7emFMw1nyWPpA
> Cy5B/RlCvcrL52DNqKz+12o4HvkFxtis25pij0+FgfMU6laoeD7h/4VAvCwJYsR9CjA==
> 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=AbVrbcqV;
> arc=none smtp.remote-ip=220.197.31.4
> Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4])
> (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 4704F606A31C;
> Fri, 27 Nov 2026 07:47:34 +0000 (UTC)
> DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4704F606A31C
> Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
> Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
> 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=AbVrbcqV
> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
> s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=FP
> V4ZeWzsKzafgZAHwIqdOFaSmYfPco7h5vg+lLApZ8=; b=AbVrbcqV/0M88jZSTk
> SiKRtOelmVWH4Q/Xjy1DmQSjPJCbOl5PNQPy1D4yQoNwSbTSLYnibm9PhTqAmfnl
> zG/ime7KojEsB0MXiicY2pRjiBpcSAwtxw0Neyv7RN3Ni2WXuZ+7CYqDdgmnHKxT
> zNzLE1W55GiA3gixCsx/oEixY=
> Received: from Precision-7960.. (unknown [])
> by gzga-smtp-mtada-g0-0 (Coremail) with SMTP id _____wD338tdNQlr9DA1LQ--.31255S2;
> Fri, 27 Nov 2026 15:46:38 +0800 (CST)
> From: Hans Zhang <18255117159@163.com>
> To: andrew@lunn.ch,
> hkallweit1@gmail.com,
> davem@davemloft.net,
> edumazet@kernel.org,
> kuba@kernel.org,
> pabeni@redhat.com,
> bhelgaas@google.com,
> mani@kernel.org
> Cc: linux@armlinux.org.uk,
> netdev@vger.kernel.org,
> linux-pci@vger.kernel.org,
> linux-kernel@vger.kernel.org
> Subject: [RFC] PCIe host controller async probe vs PHY request_module deadlock
> Date: Fri, 27 Nov 2026 15:46:37 +0800
> Message-ID: <20261127074637.748411-1-18255117159@163.com>
> X-Mailer: git-send-email 2.43.0
> X-Mailing-List: netdev@vger.kernel.org
> List-Id: <netdev.vger.kernel.org>
> List-Post: <mailto:netdev@vger.kernel.org>
> List-Help: <mailto:netdev+help@vger.kernel.org>
> List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
> List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
> List-Owner: <mailto:netdev+owner@vger.kernel.org>
> Precedence: list
> MIME-Version: 1.0
> Content-Transfer-Encoding: 8bit
> X-CM-TRANSID:_____wD338tdNQlr9DA1LQ--.31255S2
> X-Coremail-Antispam: 1Uf129KBjvJXoW7KF45Ar15ur4xuF1rAr43Wrg_yoW5Jr4rpF
> WrWa9Iyr4qqrZ2vr4kAr4DZFySg3yxCay7tFn5J3y5A3Z0y34q9FWjk3y3ZF4DGrZ2k3W2
> qF4j9rW5u34DAFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
> 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjc_fUUUUU=
> X-CM-SenderInfo: rpryjkyvrrlimvzbiqqrwthudrp/xtbC7B6BJWsJNV71yAAA3i
>
> Hi Andrew, Bjorn, Mani,
>
> I'd like to raise a cross-subsystem issue before sending a one-line fix.
>
> Several PCIe host controller drivers set PROBE_PREFER_ASYNCHRONOUS so
> their root complexes are enumerated in parallel. On the CIX Sky1 SoC the
> driver probes up to five root complexes. When it enumerates an RTL8126A
> NIC, the NIC's mdiobus_register() runs in an async worker, and
> phy_device_create() then calls request_module() synchronously. That hits:
>
> WARN_ON_ONCE(wait && current_is_async());
>
> and can deadlock, because module init may call async_synchronize_full().
>
> This is not specific to Sky1. The same pattern exists in many PCIe host
> drivers, for example:
>
> pcie-mediatek-gen3.c, pcie-rzg3s-host.c, pcie-aspeed.c,
> pcie-stm32.c, pcie-qcom.c, pcie-spacemit-k1.c, pcie-rcar-gen4.c,
> pcie-andes-qilai.c, pci-layerscape.c, pci-imx6.c, pcie-nxp-s32g.c
>
> So any of them could hit the same problem when a downstream device probes
> an MDIO bus.
>
> I see two possible fixes:
>
> 1. PCI side: force synchronous probing on the affected host controller
> driver (PROBE_FORCE_SYNCHRONOUS). This is self-contained and low-risk,
> but serializes the root complex enumeration. On sky1-xcp (three root
> complexes) the measured boot time is close to the async baseline, but
> that measurement does not include PCIe PHY enumeration or link-training
> timeouts. Serializing the root complexes would sum those latencies, so
> the real cost grows with the number of root complexes and PHYs.
>
> 2. net/phy side: return -EPROBE_DEFER from __mdiobus_register() when
> current_is_async() is true. This keeps async probing and fixes all MAC
> drivers, but I audited the in-tree mdiobus_register() callers and found
> some (lantiq_etop, smsc911x, smsc9420) that convert any error to
> -ENXIO and would not defer correctly.
>
> Could you advise which layer should carry the fix? If the preference is
> the general net/phy approach, I can follow up with a more detailed audit
> of the callers.
>
> Test data on sky1-xcp:
> - unpatched async kernel: the kmod WARN is present;
> - PROBE_FORCE_SYNCHRONOUS: WARN is gone, both RTL8126A NICs still probe
> and bind their PHY driver, NVMe/root and the serial console are normal.
> Init starts at ~2.63s versus ~2.79s for the async baseline in this
> three-root-complex configuration. This measurement has no PCIe PHY or
> link-training timeout in the path, so it is a lower bound.
>
> Best regards,
> Hans
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Andrew Lunn
Date: Fri, 27 Nov 2026 14:59
Date: Fri, 27 Nov 2026 14:59
34 lines
9735 bytes
9735 bytes
> Andrew suggested:
>
> drivers/pci/controller/cadence/pci-sky1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/cadence/pci-sky1.c
> b/drivers/pci/controller/cadence/pci-sky1.c
> index 82f4ae5c04a8..4448ee3d5e73 100644
> --- a/drivers/pci/controller/cadence/pci-sky1.c
> +++ b/drivers/pci/controller/cadence/pci-sky1.c
> @@ -235,7 +235,7 @@ static struct platform_driver sky1_pcie_driver = {
> .driver = {
> .name = "sky1-pcie",
> .of_match_table = of_sky1_pcie_match,
> - .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> + .probe_type = PROBE_FORCE_SYNCHRONOUS,
Sorry, i was ambiguous. I meant the MAC driver should probe
synchronous, not the PCIe bus driver.
I don't know the details, but i assume this is some sort of tree, and
a list. The root node enumerates, and adds to the list of things to be
probed. The device core then has a bunch of workers which take stuff
off the list and does the probe. Those probes can add more things to
the list, and it works its way down the tree. The first iteration will
only pull jobs of the list which have PROBE_PREFER_ASYNCHRONOUS, so
you can prevent branches of the tree from enumerating by setting
PROBE_FORCE_SYNCHRONOUS on the driver at that level in the tree.
So i assume you can mark the MAC driver hanging of the PCIe bus probe
to happen later, while other sorts of PCIe devices probe async?
Andrew
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Shawn Lin
Date: Fri, 27 Nov 2026 15:01
Date: Fri, 27 Nov 2026 15:01
296 lines
21506 bytes
21506 bytes
Hi Hans
在 2026/11/27 星期五 16:02, Hans Zhang 写道:
> Hi all,
>
> The patching process under discussion:
>
> https://patchwork.kernel.org/project/netdevbpf/
> patch/20261124070753.25972-1-18255117159@163.com/ (include v3 patch)
> https://patchwork.kernel.org/project/netdevbpf/
> patch/20261124070753.25972-1-18255117159@163.com/
>
This had been discussed for several times and the lastest one I
remembered is from here:
https://lists.infradead.org/pipermail/linux-rockchip/2026-March/068879.html
>
> drivers/pci/controller
>
> grep -nr .probe_type
> pcie-mediatek-gen3.c:1447: .probe_type =
> PROBE_PREFER_ASYNCHRONOUS,
> pcie-rzg3s-host.c:2185: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> pci-hyperv.c:4196: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> pcie-aspeed.c:1107: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> cadence/pci-sky1.c:238: .probe_type = PROBE_FORCE_SYNCHRONOUS,
> dwc/pcie-stm32.c:360: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> dwc/pcie-qcom.c:2642: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> dwc/pcie-spacemit-k1.c:352: .probe_type =
> PROBE_PREFER_ASYNCHRONOUS,
> dwc/pcie-rcar-gen4.c:1161: .probe_type =
> PROBE_PREFER_ASYNCHRONOUS,
> dwc/pcie-andes-qilai.c:189: .probe_type =
> PROBE_PREFER_ASYNCHRONOUS,
> dwc/pci-layerscape.c:422: .probe_type =
> PROBE_PREFER_ASYNCHRONOUS,
> dwc/pci-imx6.c:2287: .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> dwc/pcie-nxp-s32g.c:396: .probe_type =
> PROBE_PREFER_ASYNCHRONOUS,
>
>
>
> Andrew suggested:
>
> drivers/pci/controller/cadence/pci-sky1.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pci/controller/cadence/pci-sky1.c b/drivers/pci/
> controller/cadence/pci-sky1.c
> index 82f4ae5c04a8..4448ee3d5e73 100644
> --- a/drivers/pci/controller/cadence/pci-sky1.c
> +++ b/drivers/pci/controller/cadence/pci-sky1.c
> @@ -235,7 +235,7 @@ static struct platform_driver sky1_pcie_driver = {
> .driver = {
> .name = "sky1-pcie",
> .of_match_table = of_sky1_pcie_match,
> - .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> + .probe_type = PROBE_FORCE_SYNCHRONOUS,
> },
> };
> module_platform_driver(sky1_pcie_driver);
>
>
>
> Best regards,
> Hans
>
>
> On 11/27/26 15:43, Hans Zhang wrote:
>> Hi Andrew, Bjorn, Mani,
>>
>> I'd like to raise a cross-subsystem issue before sending a one-line fix.
>>
>> Several PCIe host controller drivers set PROBE_PREFER_ASYNCHRONOUS so
>> their root complexes are enumerated in parallel. On the CIX Sky1 SoC the
>> driver probes up to five root complexes. When it enumerates an RTL8126A
>> NIC, the NIC's mdiobus_register() runs in an async worker, and
>> phy_device_create() then calls request_module() synchronously. That hits:
>>
>> WARN_ON_ONCE(wait && current_is_async());
>>
>> and can deadlock, because module init may call async_synchronize_full().
>>
>> This is not specific to Sky1. The same pattern exists in many PCIe host
>> drivers, for example:
>>
>> pcie-mediatek-gen3.c, pcie-rzg3s-host.c, pcie-aspeed.c,
>> pcie-stm32.c, pcie-qcom.c, pcie-spacemit-k1.c, pcie-rcar-gen4.c,
>> pcie-andes-qilai.c, pci-layerscape.c, pci-imx6.c, pcie-nxp-s32g.c
>>
>> So any of them could hit the same problem when a downstream device probes
>> an MDIO bus.
>>
>> I see two possible fixes:
>>
>> 1. PCI side: force synchronous probing on the affected host controller
>> driver (PROBE_FORCE_SYNCHRONOUS). This is self-contained and low-
>> risk,
>> but serializes the root complex enumeration. On sky1-xcp (three root
>> complexes) the measured boot time is close to the async baseline, but
>> that measurement does not include PCIe PHY enumeration or link-
>> training
>> timeouts. Serializing the root complexes would sum those
>> latencies, so
>> the real cost grows with the number of root complexes and PHYs.
>>
>> 2. net/phy side: return -EPROBE_DEFER from __mdiobus_register() when
>> current_is_async() is true. This keeps async probing and fixes all
>> MAC
>> drivers, but I audited the in-tree mdiobus_register() callers and
>> found
>> some (lantiq_etop, smsc911x, smsc9420) that convert any error to
>> -ENXIO and would not defer correctly.
>>
>> Could you advise which layer should carry the fix? If the preference is
>> the general net/phy approach, I can follow up with a more detailed audit
>> of the callers.
>>
>> Test data on sky1-xcp:
>> - unpatched async kernel: the kmod WARN is present;
>> - PROBE_FORCE_SYNCHRONOUS: WARN is gone, both RTL8126A NICs still probe
>> and bind their PHY driver, NVMe/root and the serial console are
>> normal.
>> Init starts at ~2.63s versus ~2.79s for the async baseline in this
>> three-root-complex configuration. This measurement has no PCIe PHY or
>> link-training timeout in the path, so it is a lower bound.
>>
>> Best regards,
>> Hans
>>
>>
>> From mboxrd@z Thu Jan 1 00:00:00 1970
>> Authentication-Results: smtp.subspace.kernel.org; arc=none
>> smtp.remote-ip=220.197.31.4
>> ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256;
>> cv=none;
>> t=1795765658;
>> b=RjoyypZgbZDwyd3QkV/
>> OiZgDapLyNcxzJz6NKIsLEmSYH4sJpIC63er0ybcJN1Lj3V8I
>> 41xKXM0pKHvgRKEYboloC02uUTTjSquCG/
>> sXbDg4j0Mmr9XhxmdoLkfSvirMa/0YbHzqE
>> 0WIhxbAEgkwaXtDrNoWtrr3DO1cKiQmITsc5z4TXfQI0dbSYrWUqgiQhWVWNrSK/
>> N2GIe
>> 5u0s/t7nPwy1KKPEyZycZBzcal2guSmOUsGmVvzh+Oi/
>> X6FCzeElMS3fYeXn+FvJp4wZP
>>
>> zLFSHcg1QuTESediE2SSqnmSNB9IIacY74P7lBN9KT+9maBjFl9pPtafck17nVKNrqg==
>> ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
>> a=rsa-sha256; c=relaxed/relaxed; t=1795765658;
>> h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
>> Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
>> X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
>> bh=FPV4ZeWzsKzafgZAHwIqdOFaSmYfPco7h5vg+lLApZ8=;
>> b=f7V9AxZegDZlT2urAaY66WTPD8oVyDkNf5Byw6Jy2MaV3z0CDfrpQlgw7wj7sEXKsGlC
>> O9dHxH2OIuwr+GJZLELrUw0PlOxWvpQ95FtF/ReGvSPfrxwhlh7/lUKeDpMQG/
>> TIram9h
>> Aq9k5/HUSWTu1SEjtabOO7IsbV/
>> fM4GlKP9DE7IPTUEV+kQ14xTFXgi6PDwfLj6hxAzey
>> vokiqZKIvFfZa/1bgzv/
>> wjHjp7yubJkURFUTotMzspejMzUFuV+16BRg7emFMw1nyWPpA
>> Cy5B/
>> RlCvcrL52DNqKz+12o4HvkFxtis25pij0+FgfMU6laoeD7h/4VAvCwJYsR9CjA==
>> 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=AbVrbcqV;
>> arc=none smtp.remote-ip=220.197.31.4
>> Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4])
>> (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 4704F606A31C;
>> Fri, 27 Nov 2026 07:47:34 +0000 (UTC)
>> DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org
>> 4704F606A31C
>> Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none
>> dis=none) header.from=163.com
>> Authentication-Results: smtp.subspace.kernel.org; spf=pass
>> smtp.mailfrom=163.com
>> 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=AbVrbcqV
>> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
>> s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=FP
>> V4ZeWzsKzafgZAHwIqdOFaSmYfPco7h5vg+lLApZ8=; b=AbVrbcqV/0M88jZSTk
>> SiKRtOelmVWH4Q/Xjy1DmQSjPJCbOl5PNQPy1D4yQoNwSbTSLYnibm9PhTqAmfnl
>> zG/ime7KojEsB0MXiicY2pRjiBpcSAwtxw0Neyv7RN3Ni2WXuZ+7CYqDdgmnHKxT
>> zNzLE1W55GiA3gixCsx/oEixY=
>> Received: from Precision-7960.. (unknown [])
>> by gzga-smtp-mtada-g0-0 (Coremail) with SMTP id
>> _____wD338tdNQlr9DA1LQ--.31255S2;
>> Fri, 27 Nov 2026 15:46:38 +0800 (CST)
>> From: Hans Zhang <18255117159@163.com>
>> To: andrew@lunn.ch,
>> hkallweit1@gmail.com,
>> davem@davemloft.net,
>> edumazet@kernel.org,
>> kuba@kernel.org,
>> pabeni@redhat.com,
>> bhelgaas@google.com,
>> mani@kernel.org
>> Cc: linux@armlinux.org.uk,
>> netdev@vger.kernel.org,
>> linux-pci@vger.kernel.org,
>> linux-kernel@vger.kernel.org
>> Subject: [RFC] PCIe host controller async probe vs PHY request_module
>> deadlock
>> Date: Fri, 27 Nov 2026 15:46:37 +0800
>> Message-ID: <20261127074637.748411-1-18255117159@163.com>
>> X-Mailer: git-send-email 2.43.0
>> X-Mailing-List: netdev@vger.kernel.org
>> List-Id: <netdev.vger.kernel.org>
>> List-Post: <mailto:netdev@vger.kernel.org>
>> List-Help: <mailto:netdev+help@vger.kernel.org>
>> List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
>> List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
>> List-Owner: <mailto:netdev+owner@vger.kernel.org>
>> Precedence: list
>> MIME-Version: 1.0
>> Content-Transfer-Encoding: 8bit
>> X-CM-TRANSID:_____wD338tdNQlr9DA1LQ--.31255S2
>> X-Coremail-Antispam: 1Uf129KBjvJXoW7KF45Ar15ur4xuF1rAr43Wrg_yoW5Jr4rpF
>> WrWa9Iyr4qqrZ2vr4kAr4DZFySg3yxCay7tFn5J3y5A3Z0y34q9FWjk3y3ZF4DGrZ2k3W2
>> qF4j9rW5u34DAFJanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
>> 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jjc_fUUUUU=
>> X-CM-SenderInfo: rpryjkyvrrlimvzbiqqrwthudrp/xtbC7B6BJWsJNV71yAAA3i
>>
>> Hi Andrew, Bjorn, Mani,
>>
>> I'd like to raise a cross-subsystem issue before sending a one-line fix.
>>
>> Several PCIe host controller drivers set PROBE_PREFER_ASYNCHRONOUS so
>> their root complexes are enumerated in parallel. On the CIX Sky1 SoC the
>> driver probes up to five root complexes. When it enumerates an RTL8126A
>> NIC, the NIC's mdiobus_register() runs in an async worker, and
>> phy_device_create() then calls request_module() synchronously. That hits:
>>
>> WARN_ON_ONCE(wait && current_is_async());
>>
>> and can deadlock, because module init may call async_synchronize_full().
>>
>> This is not specific to Sky1. The same pattern exists in many PCIe host
>> drivers, for example:
>>
>> pcie-mediatek-gen3.c, pcie-rzg3s-host.c, pcie-aspeed.c,
>> pcie-stm32.c, pcie-qcom.c, pcie-spacemit-k1.c, pcie-rcar-gen4.c,
>> pcie-andes-qilai.c, pci-layerscape.c, pci-imx6.c, pcie-nxp-s32g.c
>>
>> So any of them could hit the same problem when a downstream device probes
>> an MDIO bus.
>>
>> I see two possible fixes:
>>
>> 1. PCI side: force synchronous probing on the affected host controller
>> driver (PROBE_FORCE_SYNCHRONOUS). This is self-contained and low-
>> risk,
>> but serializes the root complex enumeration. On sky1-xcp (three root
>> complexes) the measured boot time is close to the async baseline, but
>> that measurement does not include PCIe PHY enumeration or link-
>> training
>> timeouts. Serializing the root complexes would sum those
>> latencies, so
>> the real cost grows with the number of root complexes and PHYs.
>>
>> 2. net/phy side: return -EPROBE_DEFER from __mdiobus_register() when
>> current_is_async() is true. This keeps async probing and fixes all
>> MAC
>> drivers, but I audited the in-tree mdiobus_register() callers and
>> found
>> some (lantiq_etop, smsc911x, smsc9420) that convert any error to
>> -ENXIO and would not defer correctly.
>>
>> Could you advise which layer should carry the fix? If the preference is
>> the general net/phy approach, I can follow up with a more detailed audit
>> of the callers.
>>
>> Test data on sky1-xcp:
>> - unpatched async kernel: the kmod WARN is present;
>> - PROBE_FORCE_SYNCHRONOUS: WARN is gone, both RTL8126A NICs still probe
>> and bind their PHY driver, NVMe/root and the serial console are
>> normal.
>> Init starts at ~2.63s versus ~2.79s for the async baseline in this
>> three-root-complex configuration. This measurement has no PCIe PHY or
>> link-training timeout in the path, so it is a lower bound.
>>
>> Best regards,
>> Hans
>
>
>
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Hans Zhang
Date: Fri, 27 Nov 2026 16:00
Date: Fri, 27 Nov 2026 16:00
31 lines
9254 bytes
9254 bytes
On 11/27/26 23:01, Shawn Lin wrote: > Hi Hans > > > 在 2026/11/27 星期五 16:02, Hans Zhang 写道: >> Hi all, >> >> The patching process under discussion: >> >> https://patchwork.kernel.org/project/netdevbpf/ >> patch/20261124070753.25972-1-18255117159@163.com/ (include v3 patch) >> https://patchwork.kernel.org/project/netdevbpf/ >> patch/20261124070753.25972-1-18255117159@163.com/ >> > > This had been discussed for several times and the lastest one I > remembered is from here: > > https://lists.infradead.org/pipermail/linux-rockchip/2026-March/068879.html > Hi Shawn, Thank you for your reminder. I missed the discussion of this series. But it seems that I haven't witnessed the final plan being implemented. Best regards, Hans
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Hans Zhang
Date: Fri, 27 Nov 2026 16:03
Date: Fri, 27 Nov 2026 16:03
51 lines
10551 bytes
10551 bytes
On 11/27/26 22:59, Andrew Lunn wrote:
>> Andrew suggested:
>>
>> drivers/pci/controller/cadence/pci-sky1.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/pci/controller/cadence/pci-sky1.c
>> b/drivers/pci/controller/cadence/pci-sky1.c
>> index 82f4ae5c04a8..4448ee3d5e73 100644
>> --- a/drivers/pci/controller/cadence/pci-sky1.c
>> +++ b/drivers/pci/controller/cadence/pci-sky1.c
>> @@ -235,7 +235,7 @@ static struct platform_driver sky1_pcie_driver = {
>> .driver = {
>> .name = "sky1-pcie",
>> .of_match_table = of_sky1_pcie_match,
>> - .probe_type = PROBE_PREFER_ASYNCHRONOUS,
>> + .probe_type = PROBE_FORCE_SYNCHRONOUS,
>
> Sorry, i was ambiguous. I meant the MAC driver should probe
> synchronous, not the PCIe bus driver.
>
> I don't know the details, but i assume this is some sort of tree, and
> a list. The root node enumerates, and adds to the list of things to be
> probed. The device core then has a bunch of workers which take stuff
> off the list and does the probe. Those probes can add more things to
> the list, and it works its way down the tree. The first iteration will
> only pull jobs of the list which have PROBE_PREFER_ASYNCHRONOUS, so
> you can prevent branches of the tree from enumerating by setting
> PROBE_FORCE_SYNCHRONOUS on the driver at that level in the tree.
>
> So i assume you can mark the MAC driver hanging of the PCIe bus probe
> to happen later, while other sorts of PCIe devices probe async?
>
Hello Andrew,
Would you have time to review the previous discussion? Additionally, I
will continue to conduct tests based on your previous reply.
https://lore.kernel.org/driver-core/DGZJBMG2Y738.2MU5LXVGEDD47@kernel.org/
The modification will be made in the MAC driver.
Best regards,
Hans
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Andrew Lunn
Date: Sat, 28 Nov 2026 16:28
Date: Sat, 28 Nov 2026 16:28
14 lines
8703 bytes
8703 bytes
> Hello Andrew,
>
>
> Would you have time to review the previous discussion? Additionally, I will
> continue to conduct tests based on your previous reply.
>
> https://lore.kernel.org/driver-core/DGZJBMG2Y738.2MU5LXVGEDD47@kernel.org/
That discussion seems to stop without coming to a conclusion. And i
don't remember anybody coming to the phylib Maintainers to say there
was a problem, ask for changes, etc.
Andrew
Re: [RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Hans Zhang
Date: Sun, 29 Nov 2026 07:54
Date: Sun, 29 Nov 2026 07:54
26 lines
9294 bytes
9294 bytes
On 11/29/26 00:28, Andrew Lunn wrote: >> Hello Andrew, >> >> >> Would you have time to review the previous discussion? Additionally, I will >> continue to conduct tests based on your previous reply. >> >> https://lore.kernel.org/driver-core/DGZJBMG2Y738.2MU5LXVGEDD47@kernel.org/ > > That discussion seems to stop without coming to a conclusion. And i > don't remember anybody coming to the phylib Maintainers to say there > was a problem, ask for changes, etc. > > Andrew Hello Andrew, Let's return to the discussion at https://patchwork.kernel.org/project/netdevbpf/patch/20261124070753.25972-1-18255117159@163.com/. Best regards, Hans
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads