linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefano Radaelli <stefano.radaelli21@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	 "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>, Xu Liang <lxu@maxlinear.com>
Subject: Re: [PATCH] net: phy: add driver for MaxLinear MxL86110 PHY
Date: Fri, 16 May 2025 12:43:12 +0200	[thread overview]
Message-ID: <CAK+owojG1yfUy8rYzP1Q3q1ogq8dwwAK8ekk2AS+ABjH50e7ZQ@mail.gmail.com> (raw)
In-Reply-To: <63727423-9d19-40d1-b8d3-7c292529b16f@lunn.ch>

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@lunn.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
>
>

  reply	other threads:[~2025-05-16 10:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-15 18:48 [PATCH] net: phy: add driver for MaxLinear MxL86110 PHY Stefano Radaelli
2025-05-15 19:03 ` Andrew Lunn
2025-05-16 10:43   ` Stefano Radaelli [this message]
2025-05-15 19:15 ` Heiner Kallweit
2025-05-16 10:46   ` Stefano Radaelli
  -- strict thread matches above, loose matches on Subject: below --
2025-05-15 15:24 Stefano Radaelli
2025-05-15 16:33 ` Andrew Lunn
2025-05-15 17:23   ` Stefano Radaelli
2025-05-15 17:54     ` Andrew Lunn
2025-05-15 16:36 ` 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=CAK+owojG1yfUy8rYzP1Q3q1ogq8dwwAK8ekk2AS+ABjH50e7ZQ@mail.gmail.com \
    --to=stefano.radaelli21@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lxu@maxlinear.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).