[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK+owojG1yfUy8rYzP1Q3q1ogq8dwwAK8ekk2AS+ABjH50e7ZQ@mail.gmail.com>
Date: Fri, 16 May 2025 12:43:12 +0200
From: Stefano Radaelli <stefano.radaelli21@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
Heiner Kallweit <hkallweit1@...il.com>, Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Xu Liang <lxu@...linear.com>
Subject: Re: [PATCH] net: phy: add driver for MaxLinear MxL86110 PHY
Hi Andrew,
Thanks for the review and for pointing this out.
> Why are these two special and use the locked variant, when all the
> others don't?
> Please think about locking, when can unlocked versions be used? When
> should they not be used?
> Are you testing this with CONFIG_PROVE_LOCKING enabled?
You're right, the use of the _locked variants was confusing and inconsistent.
After enabling CONFIG_PROVE_LOCKING and testing, I identified where
locking is necessary.
Functions like get_wol, set_wol, config_init, and LED controls can be called
concurrently from userspace or asynchronous contexts, so they require locking
the MDIO bus. Without proper locking, I got warnings like:
WARNING: ... at drivers/net/phy/mdio_bus.c:920 __mdiobus_write
WARNING: ... at drivers/net/phy/mdio_bus.c:891 __mdiobus_read
To clean up, I removed the locked helpers and instead wrapped extended
register accesses with phy_lock_mdio_bus() where needed.
Now, no warnings appear with CONFIG_PROVE_LOCKING enabled
after testing every implemented functionality.
> Please also take a read of:
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
> https://docs.kernel.org/process/submitting-patches.html
Thanks, I have reread those documents, updated the code accordingly,
and plan to send my patch today with the [PATCH net-next] tag.
Best Regards,
Stefano
Il giorno gio 15 mag 2025 alle ore 21:03 Andrew Lunn <andrew@...n.ch>
ha scritto:
>
> > +static void mxl86110_get_wol(struct phy_device *phydev, struct ethtool_wolinfo *wol)
> > +{
> > + int value;
> > +
> > + wol->supported = WAKE_MAGIC;
> > + wol->wolopts = 0;
> > + value = mxl86110_locked_read_extended_reg(phydev, MXL86110_EXT_WOL_CFG_REG);
>
>
> > +static int mxl86110_led_hw_control_set(struct phy_device *phydev, u8 index,
> > + unsigned long rules)
> ..
>
> > + ret = mxl86110_locked_write_extended_reg(phydev, MXL86110_LED0_CFG_REG + index, val);
>
> Why are these two special and use the _locked_ variant, when all the
> others don't?
>
> Please think about locking, when can unlocked versions be used? When
> should they not be used?
>
> Are you testing this with CONFIG_PROVE_LOCKING enabled?
>
> Please also take a read of:
>
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
> https://docs.kernel.org/process/submitting-patches.html
>
> Andrew
>
> ---
> pw-bot: cr
>
>
Powered by blists - more mailing lists