Netdev List
 help / color / mirror / Atom feed
From: Hans Zhang <18255117159@163.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev-bot+sashiko@kernel.org, hkallweit1@gmail.com,
	davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, linux@armlinux.org.uk, netdev@vger.kernel.org,
	Manivannan Sadhasivam <mani@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Shawn Lin <shawn.lin@rock-chips.com>
Subject: Re: [PATCH] net: phy: avoid synchronous module request in async probe context
Date: Mon, 30 Nov 2026 00:12:29 +0800	[thread overview]
Message-ID: <13337c63-1529-4347-b4a5-0d4e90c70d05@163.com> (raw)
In-Reply-To: <7a5a6aa7-d521-4346-b2f2-d3548d726d9d@163.com>



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-3b12d9a9f861@nvidia.com/20261109-device-trust-core- 
>> v2-10-3b12d9a9f861@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/ 
> gm7p37yom64doo3bbrcri3chbrzpm5zifqk256qqla2krhrrrw@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/20261124070753.25972-1-18255117159@163.com/


Best regards,
Hans


  reply	other threads:[~2026-11-29 16:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  7:07 [PATCH] net: phy: avoid synchronous module request in async probe context Hans Zhang
2026-11-25  7:37 ` netdev-bot+sashiko
2026-11-25  7:55   ` Hans Zhang
2026-11-25 13:58     ` Andrew Lunn
2026-11-26  3:52       ` Hans Zhang
2026-11-26 14:35         ` Andrew Lunn
2026-11-29  7:16           ` Hans Zhang
2026-11-29  7:46             ` Hans Zhang
2026-11-29 15:38               ` Andrew Lunn
2026-11-29 16:05                 ` Hans Zhang
2026-11-29 16:12                   ` Hans Zhang [this message]
2026-11-29 16:34                   ` Andrew Lunn

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=13337c63-1529-4347-b4a5-0d4e90c70d05@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@armlinux.org.uk \
    --cc=mani@kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shawn.lin@rock-chips.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