回覆: [PATCH] PCI: aspeed: Drop PROBE_PREFER_ASYNCHRONOUS to fix enumeration race
From: Jacky Chou
Date: Mon Nov 23 2026 - 00:21:49 EST
Hi Mani,
Thank you for your reply.
> > The ASPEED PCIe RC driver opts in to asynchronous probing via
> > PROBE_PREFER_ASYNCHRONOUS. This allows the driver core to probe it on
> > a kthread in parallel with other drivers instead of waiting for it to
> > finish during the synchronous probe pass.
> >
> > On boards where a PCIe endpoint driver is bound early (e.g. built into
> > the kernel or probed from an initcall that runs before late_
> > initcall), this races against the RC driver: the EP driver can start
> > probing before the RC driver has finished enumerating the bus, so the
> > EP device is not yet present and the EP driver fails to bind.
> >
> > Remove PROBE_PREFER_ASYNCHRONOUS so the RC driver probes
> synchronously
> > again, guaranteeing that bus enumeration completes before any
> > downstream EP driver's probe() runs.
> >
>
> I don't understand the problem here. EP drivers will get enumerated only
> during bus scan, which depends on the RC driver's pci_host_probe() call.
>
> Are you saying that the PCI devices are created before RC driver probe and
> gettting enumerated? Not sure how that can happen.
>
We found there is a NIC from Realtek (10ec:8168) could reproduce this.
The following log is from dmesg when booting on our system.
```
[ 2.127140] aspeed-pcie 120f0000.pcie: PCI host bridge to bus
** replaying previous printk message **
[ 2.127140] aspeed-pcie 120f0000.pcie: PCI host bridge to bus 0001:00
[ 2.127158] pci_bus 0001:00: root bus resource [bus 00-ff]
[ 2.127168] pci_bus 0001:00: root bus resource [mem 0x80000000-0x9fffffff]
[ 2.127259] pci 0001:00:00.0: [1a03:1150] type 01 class 0x060400 PCIe Root Port
[ 2.127281] pci 0001:00:00.0: PCI bridge to [bus 00]
[ 2.127291] pci 0001:00:00.0: bridge window [io 0x0000-0x0fff]
[ 2.127299] pci 0001:00:00.0: bridge window [mem 0x00000000-0x000fffff]
[ 2.127311] pci 0001:00:00.0: bridge window [mem 0x00000000-0x000fffff 64bit pref]
[ 2.127324] pci 0001:00:00.0: enabling Extended Tags
[ 2.130479] pci 0001:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[ 2.130629] pci 0001:01:00.0: [10ec:8168] type 00 class 0x020000 PCIe Endpoint
[ 2.130780] pci 0001:01:00.0: BAR 0 [io 0x0000-0x00ff]
[ 2.130796] pci 0001:01:00.0: BAR 2 [mem 0x00000000-0x00000fff 64bit]
[ 2.130808] pci 0001:01:00.0: BAR 4 [mem 0x00000000-0x00003fff 64bit pref]
[ 2.130966] pci 0001:01:00.0: supports D1 D2
[ 2.130972] pci 0001:01:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[ 2.131287] pci_bus 0001:01: busn_res: [bus 01-ff] end is updated to 01
[ 2.131324] pci 0001:00:00.0: bridge window [mem 0x80000000-0x800fffff]: assigned
[ 2.131335] pci 0001:00:00.0: bridge window [mem 0x80100000-0x801fffff 64bit pref]: assigned
[ 2.131344] pci 0001:00:00.0: bridge window [io size 0x1000]: can't assign; no space
[ 2.131351] pci 0001:00:00.0: bridge window [io size 0x1000]: failed to assign
[ 2.131368] pci 0001:00:00.0: bridge window [io size 0x1000]: can't assign; no space
[ 2.131375] pci 0001:00:00.0: bridge window [io size 0x1000]: failed to assign
[ 2.131385] pci 0001:01:00.0: BAR 4 [mem 0x80100000-0x80103fff 64bit pref]: assigned
[ 2.131411] pci 0001:01:00.0: BAR 2 [mem 0x80000000-0x80000fff 64bit]: assigned
[ 2.131434] pci 0001:01:00.0: BAR 0 [io size 0x0100]: can't assign; no space
[ 2.131440] pci 0001:01:00.0: BAR 0 [io size 0x0100]: failed to assign
[ 2.131455] pci 0001:01:00.0: BAR 0 [io size 0x0100]: can't assign; no space
[ 2.131462] pci 0001:01:00.0: BAR 0 [io size 0x0100]: failed to assign
[ 2.131476] pci 0001:00:00.0: PCI bridge to [bus 01]
[ 2.131485] pci 0001:00:00.0: bridge window [mem 0x80000000-0x800fffff]
[ 2.131494] pci 0001:00:00.0: bridge window [mem 0x80100000-0x801fffff 64bit pref]
[ 2.131504] pci_bus 0001:00: Some PCI device resources are unassigned, try booting with pci=realloc
[ 2.131510] pci_bus 0001:00: resource 4 [mem 0x80000000-0x9fffffff]
[ 2.131517] pci_bus 0001:01: resource 0 [io size 0x1000]
[ 2.131524] pci_bus 0001:01: resource 1 [mem 0x80000000-0x800fffff]
[ 2.131531] pci_bus 0001:01: resource 2 [mem 0x80100000-0x801fffff 64bit pref]
[ 2.131876] pcieport 0001:00:00.0: enabling device (0000 -> 0002)
[ 2.133870] pcieport 0001:00:00.0: PME: Signaling with IRQ 68
[ 2.134638] r8169 0001:01:00.0: enabling device (0000 -> 0002)
[ 2.135491] ------------[ cut here ]------------
[ 2.135497] WARNING: kernel/module/kmod.c:145 at __request_module+0x1bc/0x2c0, CPU#0: kworker/u16:1/41
[ 2.455514] Modules linked in:
[ 2.458928] CPU: 0 UID: 0 PID: 41 Comm: kworker/u16:1 Tainted: G W T 7.4.0-rc3+ #8 PREEMPT(full)
[ 2.470290] Tainted: [W]=WARN, [T]=RANDSTRUCT
[ 2.475147] Hardware name: AST2700 EVB (DT)
[ 2.479812] Workqueue: async async_run_entry_fn
[ 2.484874] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 2.492645] pc : __request_module+0x1bc/0x2c0
[ 2.497506] lr : __request_module+0x1b8/0x2c0
[ 2.502367] sp : ffff8000820bb370
[ 2.506061] x29: ffff8000820bb370 x28: ffff000006ed6000 x27: ffff000006ed5000
[ 2.514032] x26: ffff000006ed60b8 x25: ffff000005d5ea80 x24: 0000000000000000
[ 2.522004] x23: ffff000006ed5000 x22: ffff80008098fd6c x21: 0000000000000001
[ 2.529976] x20: 00000000001cc915 x19: ffff800081470d78 x18: 0000000000000002
[ 2.537948] x17: 0000000000000000 x16: 0000000000000001 x15: 0000000000000000
[ 2.545920] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000001
[ 2.553891] x11: 0000000000000000 x10: 0000000000000001 x9 : 0000000000000000
[ 2.561861] x8 : ffff8000820bb428 x7 : 0000000000000000 x6 : 0000000000000000
[ 2.569831] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000030
[ 2.577802] x2 : 0000000000000008 x1 : ffff80008008ba74 x0 : 0000000000000001
[ 2.585774] Call trace:
[ 2.588499] __request_module+0x1bc/0x2c0 (P)
[ 2.593363] phy_request_driver_module+0x118/0x17c
[ 2.598713] phy_device_create+0x238/0x264
[ 2.603288] get_phy_device+0x74/0x150
[ 2.607475] mdiobus_scan+0x34/0x114
[ 2.611464] __mdiobus_register+0x1f4/0x458
[ 2.616132] __devm_mdiobus_register+0x70/0xe8
[ 2.621092] rtl_init_one+0xa08/0x167c
[ 2.625278] local_pci_probe+0x40/0xa8
[ 2.629464] pci_call_probe+0x64/0x174
[ 2.633649] pci_device_probe+0xb4/0x144
[ 2.638027] really_probe+0xc0/0x3dc
[ 2.642021] __driver_probe_device+0x1b4/0x1e4
[ 2.646982] driver_probe_device+0xb4/0x114
[ 2.651653] __device_attach_driver+0xbc/0x184
[ 2.656614] bus_for_each_drv+0x84/0xe0
[ 2.660895] __device_attach+0x9c/0x1cc
[ 2.665169] device_initial_probe+0x50/0x68
[ 2.669840] pci_bus_add_device+0x68/0xf4
[ 2.674308] pci_bus_add_devices+0x3c/0x88
[ 2.678879] pci_bus_add_devices+0x68/0x88
[ 2.683451] pci_host_probe+0x8c/0x104
[ 2.687627] aspeed_pcie_probe+0x644/0x6f0
[ 2.692199] platform_probe+0x5c/0x9c
[ 2.696286] really_probe+0xc0/0x3dc
[ 2.700269] __driver_probe_device+0x1b4/0x1e4
[ 2.705230] driver_probe_device+0xb4/0x114
[ 2.709901] __device_attach_driver+0xbc/0x184
[ 2.714862] bus_for_each_drv+0x84/0xe0
[ 2.719144] __device_attach_async_helper+0xf4/0x174
[ 2.724688] async_run_entry_fn+0x34/0x174
[ 2.729251] process_one_work+0x1a4/0x4a0
[ 2.733730] worker_thread+0x18c/0x314
[ 2.737916] kthread+0x120/0x134
[ 2.741521] ret_from_fork+0x10/0x20
[ 2.745513] ---[ end trace 0000000000000000 ]---
[ 2.755666] r8169 0001:01:00.0 eth2: RTL8168f/8111f, 00:e0:62:40:00:c1, XID 480, IRQ 69 (1 total)
[ 2.755688] r8169 0001:01:00.0 eth2: jumbo features [frames: 9194 bytes, tx checksumming: ko]
```
We tried to remove the PROBE_PREFER_ASYNCHRONOUS flags and the warning message will not be shown
in dmesg.
Thanks,
Jacky