Thread View: linux.kernel.netdev
1 messages
1 total messages
Started by Hans Zhang
Fri, 27 Nov 2026 07:46
[RFC] PCIe host controller async probe vs PHY request_module deadlock
Author: Hans Zhang
Date: Fri, 27 Nov 2026 07:46
Date: Fri, 27 Nov 2026 07:46
55 lines
10660 bytes
10660 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
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