[PATCH v3] PCI: dw-rockchip: Enable async probe by default

Shawn Lin shawn.lin at rock-chips.com
Wed Mar 11 18:33:10 PDT 2026


Hi Mani and Danilo,

在 2026/03/12 星期四 5:09, Danilo Krummrich 写道:
> On Wed Mar 11, 2026 at 1:28 PM CET, Manivannan Sadhasivam wrote:
>> On Wed, Mar 11, 2026 at 12:46:03PM +0100, Danilo Krummrich wrote:
>>> On Wed Mar 11, 2026 at 6:24 AM CET, Manivannan Sadhasivam wrote:
>>>> I have a contrary view here. If just a single driver or lib doesn't handle async
>>>> probe, it cannot just force other drivers to not take the advantage of async
>>>> probe. As I said above, enabling async probe easily saves a few hunderd ms or
>>>> even more if there are more than one Root Port or Root Complex in an SoC.
>>>
>>> Then the driver or lib has to be fixed / improved first or the driver core has
>>> to be enabled to deal with a case where PROBE_FORCE_SYNCHRONOUS is requested
>>> from an async path, etc.
>>>
>>> In any case, applying the patch and breaking things (knowingly?) doesn't seem
>>> like the correct approach.
>>>
>>>> I strongly agree with you here that the underlying issue should be fixed. But
>>>> the real impact to end users is not this splat, but not having the boot time
>>>> optimization that this patch brings in. As an end user, one would want their
>>>> systems to boot quickly and they wouldn't bother much about a harmless warning
>>>> splat appearing in the dmesg log.
>>>
>>> You mean quickly booting into a "harmless" potential deadlock condition the
>>> warning splat tries to make people aware of? :)
>>>
>>
>> Hmm, I overlooked the built-as-module part where the deadlock could be possible
>> as indicated by the comment about the WARN_ON_ONCE().
>>
>> But what is the path forward here? Do you want the phylib to fix the
>> request_module() call or fix the driver core instead?
> 
> Here are a few thoughts.
> 
> In general, I think the best would be to get rid of the (affected)
> PROBE_FORCE_SYNCHRONOUS cases.
> 
> Now, I guess this can be pretty hard for a PCI controller driver, as you can't
> really predict what ends up being probed from you async context, i.e. it could
> even be some other bus controller and things could even propagate further.
> 
> Not sure how big of a deal it is in practice though, there are not a lot of
> PROBE_FORCE_SYNCHRONOUS drivers (left), but note that specifying neither
> PROBE_FORCE_SYNCHRONOUS nor PROBE_PREFER_ASYNCHRONOUS currently results in
> synchronous by default.
> 
> (Also, quite some other PCI controller drivers do set PROBE_PREFER_ASYNCHRONOUS
> and apparently got lucky with it.)
> 
>>From a driver-core perspective I think we're rather limited on what we can do;
> we are already in async context at this point and can't magically go back to
> initcall context.
> 
> So, the only thing I can think of is to kick off work on a workqueue, which in
> the end would be the same as the deferred probe handling.
> 
> Another alternative would be to let the subsystem handle such cases, which in
> this case would probably mean to handle the current_is_async() case in
> pci_host_probe() or pci_bus_add_devices().
> 
> On the other hand, this would probably end up to be a subsystem specific
> implementation of "kick of work on a workqueue".

Actually, this is exactly what we've been doing in our downstream
code[1] for quite a long time. We've even pushed this optimization down
to the individual driver level.

To be honest, I'm not particularly fond of this approach either.
However, on our platform, we have more than 5 Root Port instances that
need to be initialized during boot. When all of them probe
synchronously, it significantly delays the execution of many other
critical drivers. Our customers have been complaining about the boot
time, and our downstream team had no real choice but to kick off a
kthread similar to your suggestion.

The code is very ugly and expose a lot of corner cases problem which
wasted quite lot of time to fix. That's why I was hesitant to bring
up the this approach upstream initially. But since you mentioned it, I
think it's worth evaluating whether we can implement this at the
subsystem level instead of forcing each driver to handle it
individually. This way, the complexity would be centralized, and drivers
that benefit from async probe (like multi-Root-Port SoCs) could opt-in
without worrying about the request_module() deadlock scenario.

What do you think?


[1] 
https://github.com/rockchip-linux/kernel/blob/develop-6.6/drivers/pci/controller/dwc/pcie-dw-rockchip.c#L1764

> 
>> I can drop this patch in the meantime. But holding this prolong wouldn't help.
> 



More information about the Linux-rockchip mailing list