netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: probe PHY drivers synchronously
@ 2020-03-26 18:16 Heiner Kallweit
  2020-03-26 23:34 ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2020-03-26 18:16 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, Russell King - ARM Linux, David Miller
  Cc: netdev

If we have scenarios like

mdiobus_register()
	-> loads PHY driver module(s)
	-> registers PHY driver(s)
	-> may schedule async probe
phydev = mdiobus_get_phy()
<phydev action involving PHY driver>

or

phydev = phy_device_create()
	-> loads PHY driver module
	-> registers PHY driver
	-> may schedule async probe
<phydev action involving PHY driver>

then we expect the PHY driver to be bound to the phydev when triggering
the action. This may not be the case in case of asynchronous probing.
Therefore ensure that PHY drivers are probed synchronously.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/phy/phy_device.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index d6024b678..ac2784192 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2575,6 +2575,7 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner)
 	new_driver->mdiodrv.driver.probe = phy_probe;
 	new_driver->mdiodrv.driver.remove = phy_remove;
 	new_driver->mdiodrv.driver.owner = owner;
+	new_driver->mdiodrv.driver.probe_type = PROBE_FORCE_SYNCHRONOUS;
 
 	retval = driver_register(&new_driver->mdiodrv.driver);
 	if (retval) {
-- 
2.26.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: phy: probe PHY drivers synchronously
  2020-03-26 18:16 [PATCH net-next] net: phy: probe PHY drivers synchronously Heiner Kallweit
@ 2020-03-26 23:34 ` Andrew Lunn
  2020-03-26 23:42   ` Heiner Kallweit
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2020-03-26 23:34 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Florian Fainelli, Russell King - ARM Linux, David Miller, netdev

On Thu, Mar 26, 2020 at 07:16:23PM +0100, Heiner Kallweit wrote:
> If we have scenarios like
> 
> mdiobus_register()
> 	-> loads PHY driver module(s)
> 	-> registers PHY driver(s)
> 	-> may schedule async probe
> phydev = mdiobus_get_phy()
> <phydev action involving PHY driver>
> 
> or
> 
> phydev = phy_device_create()
> 	-> loads PHY driver module
> 	-> registers PHY driver
> 	-> may schedule async probe
> <phydev action involving PHY driver>
> 
> then we expect the PHY driver to be bound to the phydev when triggering
> the action. This may not be the case in case of asynchronous probing.
> Therefore ensure that PHY drivers are probed synchronously.

Hi Heiner

We have been doing asynchronous driver loads since forever, and not
noticed any problem. Do you have a real example of it going wrong?

	Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: phy: probe PHY drivers synchronously
  2020-03-26 23:34 ` Andrew Lunn
@ 2020-03-26 23:42   ` Heiner Kallweit
  2020-03-26 23:44     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2020-03-26 23:42 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Florian Fainelli, Russell King - ARM Linux, David Miller, netdev

On 27.03.2020 00:34, Andrew Lunn wrote:
> On Thu, Mar 26, 2020 at 07:16:23PM +0100, Heiner Kallweit wrote:
>> If we have scenarios like
>>
>> mdiobus_register()
>> 	-> loads PHY driver module(s)
>> 	-> registers PHY driver(s)
>> 	-> may schedule async probe
>> phydev = mdiobus_get_phy()
>> <phydev action involving PHY driver>
>>
>> or
>>
>> phydev = phy_device_create()
>> 	-> loads PHY driver module
>> 	-> registers PHY driver
>> 	-> may schedule async probe
>> <phydev action involving PHY driver>
>>
>> then we expect the PHY driver to be bound to the phydev when triggering
>> the action. This may not be the case in case of asynchronous probing.
>> Therefore ensure that PHY drivers are probed synchronously.
> 
> Hi Heiner
> 
Hi Andrew,

> We have been doing asynchronous driver loads since forever, and not
> noticed any problem. Do you have a real example of it going wrong?
> 
it's not about async driver loading, but about async probing once
the driver was loaded. See driver_allows_async_probing().
Default still is sync probing, except you explicitly request async
probing. But I saw some comments that the intention is to promote
async probing for more parallelism in boot process. I want to be
prepared for the case that the default is changed to async probing.
I'm not aware of any current issues, therefore I submitted it
for net-next.

> 	Andrew
> 
Heiner

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: phy: probe PHY drivers synchronously
  2020-03-26 23:42   ` Heiner Kallweit
@ 2020-03-26 23:44     ` Andrew Lunn
  2020-03-26 23:57       ` Heiner Kallweit
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2020-03-26 23:44 UTC (permalink / raw)
  To: Heiner Kallweit
  Cc: Florian Fainelli, Russell King - ARM Linux, David Miller, netdev

> Default still is sync probing, except you explicitly request async
> probing. But I saw some comments that the intention is to promote
> async probing for more parallelism in boot process. I want to be
> prepared for the case that the default is changed to async probing.

Right. So this should be in the commit message. This is the real
reason you are proposing the change.

       Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net: phy: probe PHY drivers synchronously
  2020-03-26 23:44     ` Andrew Lunn
@ 2020-03-26 23:57       ` Heiner Kallweit
  0 siblings, 0 replies; 5+ messages in thread
From: Heiner Kallweit @ 2020-03-26 23:57 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Florian Fainelli, Russell King - ARM Linux, David Miller, netdev

On 27.03.2020 00:44, Andrew Lunn wrote:
>> Default still is sync probing, except you explicitly request async
>> probing. But I saw some comments that the intention is to promote
>> async probing for more parallelism in boot process. I want to be
>> prepared for the case that the default is changed to async probing.
> 
> Right. So this should be in the commit message. This is the real
> reason you are proposing the change.
> 
OK, I'll add it to the commit message.

>        Andrew
> 
Heiner

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-26 23:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26 18:16 [PATCH net-next] net: phy: probe PHY drivers synchronously Heiner Kallweit
2020-03-26 23:34 ` Andrew Lunn
2020-03-26 23:42   ` Heiner Kallweit
2020-03-26 23:44     ` Andrew Lunn
2020-03-26 23:57       ` Heiner Kallweit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).