On 11/30/26 00:05, Hans Zhang wrote:
> > > On 11/29/26 23:38, Andrew Lunn wrote:
>>> Hi Andrew, >>> >>> After testing PROBE_FORCE_SYNCHRONOUS on the r8169 MAC driver, the WARN >>> still fires. The trace still starts at async_run_entry_fn and goes >>> through the parent Sky1 controller probe, so a child driver's probe_type >>> does not move it out of the async context.
>> >> I suggest you work on this. This seems like a driver code bug, or >> maybe a PCI bug. PROBE_FORCE_SYNCHRONOUS should be respected. >> >> As far as i know, there is nothing which requires a subsystem to >> support async probe. It is an opt-in option. I'm not sure phylib can >> be made to work in async mode. Here is a reply to a different thread, >> which explains some background how phylib probes drivers: >> >> https://patchew.org/linux/20261109-device-trust-core- v2-0…@nvidia.com/20261109-device-trust-core- v2-1…@nvidia.com/ >> >> Scroll down to  "Maybe some background will help". >> >>     Andrew
> > > Hello Andrew, > > I dug into the driver core to check this. PROBE_FORCE_SYNCHRONOUS only > makes driver_allows_async_probing() return false, so the child is probed > inline in the first pass of __device_attach(); it cannot move the probe out of the parent's async context. r8169's probe runs inline inside > sky1_pcie_probe() because pci_bus_add_devices()/device_add() is called from within that async worker, so the trace starting at sync_run_entry_fn is expected rather than a driver or PCI bug. > > This is also how the driver-core folks see it. In a recent thread [1], > Danilo Krummrich puts the same constraint: > > "we are already in async context at this point and can't magically go back to initcall context." > > and the PROBE_FORCE_SYNCHRONOUS documentation explicitly carves out the > deferred-probe case: > > "with the exception of -EPROBE_DEFER handling - re-probing always ends up being done asynchronously". > > In that thread Robin Murphy and Danilo point at the deferred-probe > mechanism as the appropriate tool, and Manivannan (PCI) adds: > > "I'd love to handle this corner case in the driver core and not spawn a > workqueue/thread in the bus drivers as we would end up duplicating it all over defeating the purpose of PROBE_PREFER_ASYNCHRONOUS flag." > > The phylib change does exactly that: __mdiobus_register() returns > -EPROBE_DEFER and lets the driver core's existing deferred-probe mechanism do the re-probe, rather than spawning any workqueue in phylib or the MAC drivers. For the corner cases you raised, I audited the mdiobus_register() callers and found three that fold -EPROBE_DEFER into a hard -ENXIO: lantiq_etop, smsc911x and smsc9420; the 4-patch series fixes those alongside the __mdiobus_register() defer. > > A fully general driver-core fix may be the eventual endgame, but for the > phylib case this is the minimal, sanctioned mechanism. Would you prefer the phylib defer (with the caller fixes), or should this wait for a > driver-core-level change? > > > [1] https://lore.kernel.org/driver-core/ gm7p…@tknda7rvjklv/ > > > Hello Mani, this is your previous reply. I wonder what your opinion is on this? >
Hello Mani, This is the thread for the discussion. https://patchwork.kernel.org/project/netdevbpf/patch/2026…@163.com/ Best regards, Hans