netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Frank <Frank.Sae@motor-comm.com>
Cc: Peter Geis <pgwipeout@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	yinghong.zhang@motor-comm.com, fei.zhang@motor-comm.com,
	hua.sun@motor-comm.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v7] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet phy
Date: Tue, 18 Oct 2022 09:02:19 +0100	[thread overview]
Message-ID: <Y05diwTQdqr9za3G@shell.armlinux.org.uk> (raw)
In-Reply-To: <20221018011439.1169-1-Frank.Sae@motor-comm.com>

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@motor-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!

      reply	other threads:[~2022-10-18  8:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18  1:14 [PATCH net-next v7] net: phy: Add driver for Motorcomm yt8521 gigabit ethernet phy Frank
2022-10-18  8:02 ` Russell King (Oracle) [this message]

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=Y05diwTQdqr9za3G@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=Frank.Sae@motor-comm.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fei.zhang@motor-comm.com \
    --cc=hkallweit1@gmail.com \
    --cc=hua.sun@motor-comm.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pgwipeout@gmail.com \
    --cc=yinghong.zhang@motor-comm.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;
as well as URLs for NNTP newsgroup(s).