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 [thread overview]
Message-ID: <20261127074637.748411-1-18255117159@163.com> (raw)
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
next reply other threads:[~2026-11-27 7:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 7:46 Hans Zhang [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-27 7:43 Hans Zhang
2026-11-27 8:02 ` Hans Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261127074637.748411-1-18255117159@163.com \
--to=18255117159@163.com \
--cc=andrew@lunn.ch \
--cc=bhelgaas@google.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mani@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®