All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Daniel Wagner <dwagner@suse.de>,
	netdev@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com,
	Stefan Wahren <wahrenst@gmx.net>,
	linux-arm-kernel@lists.infradead.org,
	linux-rpi-kernel@lists.infradead.org
Subject: Re: lan78xx and phy_state_machine
Date: Wed, 16 Oct 2019 17:36:46 +0200	[thread overview]
Message-ID: <20191016153646.GG17013@lunn.ch> (raw)
In-Reply-To: <20191015220925.GW25745@shell.armlinux.org.uk>

> > - lan78xx_phy_init() (incl. the call to phy_connect_direct()) is called
> >   after register_netdev(). This may cause races.
> 
> That isn't a problem.  We have lots of network device drivers that do
> this - in their open() function.

Hi Russell

Actually, here is it. lan7801_phy_init() finds the PHY device and
connects it to the MAC. lan78xx_open() calls phy_start(), with the
assumption lan7801_phy_init() has been called.

But the stack trace just provided shows this assumption is wrong. As
soon a register_netdev() is called, the kernel auto configuration is
kicking in and opening the device.

lan78xx_phy_init() needs to happen before register_netdev(), or inside
lan78xx_open().

	Andrew

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lunn <andrew@lunn.ch>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Woojung Huh <woojung.huh@microchip.com>,
	linux-rpi-kernel@lists.infradead.org,
	Florian Fainelli <f.fainelli@gmail.com>,
	Daniel Wagner <dwagner@suse.de>,
	netdev@vger.kernel.org,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	bcm-kernel-feedback-list@broadcom.com,
	Stefan Wahren <wahrenst@gmx.net>,
	linux-arm-kernel@lists.infradead.org,
	Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: lan78xx and phy_state_machine
Date: Wed, 16 Oct 2019 17:36:46 +0200	[thread overview]
Message-ID: <20191016153646.GG17013@lunn.ch> (raw)
In-Reply-To: <20191015220925.GW25745@shell.armlinux.org.uk>

> > - lan78xx_phy_init() (incl. the call to phy_connect_direct()) is called
> >   after register_netdev(). This may cause races.
> 
> That isn't a problem.  We have lots of network device drivers that do
> this - in their open() function.

Hi Russell

Actually, here is it. lan7801_phy_init() finds the PHY device and
connects it to the MAC. lan78xx_open() calls phy_start(), with the
assumption lan7801_phy_init() has been called.

But the stack trace just provided shows this assumption is wrong. As
soon a register_netdev() is called, the kernel auto configuration is
kicking in and opening the device.

lan78xx_phy_init() needs to happen before register_netdev(), or inside
lan78xx_open().

	Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-10-16 15:36 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-14 14:06 lan78xx and phy_state_machine Daniel Wagner
2019-10-14 14:32 ` Daniel Wagner
2019-10-14 18:15   ` Stefan Wahren
2019-10-14 19:28     ` Daniel Wagner
2019-10-14 16:30 ` Russell King - ARM Linux admin
2019-10-14 19:25   ` Daniel Wagner
2019-10-14 19:51     ` Stefan Wahren
2019-10-14 19:51       ` Stefan Wahren
2019-10-14 20:20       ` Heiner Kallweit
2019-10-14 20:20         ` Heiner Kallweit
2019-10-14 22:12         ` Russell King - ARM Linux admin
2019-10-14 22:12           ` Russell King - ARM Linux admin
2019-10-15 19:38           ` Heiner Kallweit
2019-10-15 19:38             ` Heiner Kallweit
2019-10-15 22:09             ` Russell King - ARM Linux admin
2019-10-15 22:09               ` Russell King - ARM Linux admin
2019-10-16 15:36               ` Andrew Lunn [this message]
2019-10-16 15:36                 ` Andrew Lunn
2019-10-16  5:48             ` Stefan Wahren
2019-10-16  5:48               ` Stefan Wahren
2019-10-15  0:14   ` Andrew Lunn
2019-10-14 23:53 ` Andrew Lunn
2019-10-15  0:53 ` Andrew Lunn
2019-10-15 17:16   ` Daniel Wagner
2019-10-15 17:16     ` Daniel Wagner
2019-10-16 14:25     ` Daniel Wagner
2019-10-16 14:25       ` Daniel Wagner
2019-10-16 15:51       ` Andrew Lunn
2019-10-16 15:51         ` Andrew Lunn
2019-10-17  6:52         ` Daniel Wagner
2019-10-17  6:52           ` Daniel Wagner
2019-10-17 13:15           ` Andrew Lunn
2019-10-17 13:15             ` Andrew Lunn
2019-10-17 17:05           ` Stefan Wahren
2019-10-17 17:05             ` Stefan Wahren
2019-10-17 17:41             ` Daniel Wagner
2019-10-17 17:41               ` Daniel Wagner
2019-10-17 17:52               ` Stefan Wahren
2019-10-17 17:52                 ` Stefan Wahren
2019-10-17 18:14                 ` Daniel Wagner
2019-10-17 18:14                   ` Daniel Wagner
2019-10-17 18:25                 ` Andrew Lunn
2019-10-17 18:25                   ` 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=20191016153646.GG17013@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dwagner@suse.de \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=wahrenst@gmx.net \
    --cc=woojung.huh@microchip.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.