[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y05diwTQdqr9za3G@shell.armlinux.org.uk>
Date: Tue, 18 Oct 2022 09:02:19 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Frank <Frank.Sae@...or-comm.com>
Cc: Peter Geis <pgwipeout@...il.com>, Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, yinghong.zhang@...or-comm.com,
fei.zhang@...or-comm.com, hua.sun@...or-comm.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v7] net: phy: Add driver for Motorcomm yt8521
gigabit ethernet phy
On Tue, Oct 18, 2022 at 09:14:39AM +0800, Frank wrote:
> Add a driver for the motorcomm yt8521 gigabit ethernet phy. We have verified
> the driver on StarFive VisionFive development board, which is developed by
> Shanghai StarFive Technology Co., Ltd.. On the board, yt8521 gigabit ethernet
> phy works in utp mode, RGMII interface, supports 1000M/100M/10M speeds, and
> wol(magic package).
>
> Signed-off-by: Frank <Frank.Sae@...or-comm.com>
> ---
> patch v7:
> Hi Russell
>
> > As previously pointed out, dropping the MDIO bus lock in a
> > phy_select_page()..phy_restore_page() region unsafe. I think you need
> > to ensure that yt8521_fiber_config_aneg() is safe to be called under
> > the lock, and I suspect having a version of genphy_config_aneg() which
> > can be called with the lock held would be a better approach.
>
> with your suggestion we add yt8521_set_page() which does not hold the lock.
And so you don't understand the locking issues...
If you drop the lock, it means that some other thread (e.g. userspace) can
come in and change the page register under you, which will completely
change which register(s) you are accessing.
Please implement locking properly, don't bodge around with it. I made my
suggestion above specifically after having thought about the issues and
what would be possible to give a correct locking implementation.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists