Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	David Miller <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next] net: phy: switch to lockdep_assert_held in phylib
Date: Mon, 12 Nov 2018 18:44:16 +0100	[thread overview]
Message-ID: <20181112174416.GF5075@lunn.ch> (raw)
In-Reply-To: <cdedf273-dfa3-1935-3352-cc86003c2a58@gmail.com>

On Sun, Nov 11, 2018 at 10:33:08PM +0100, Heiner Kallweit wrote:
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index 2e59a8419..5cb06f021 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -541,7 +541,7 @@ int __mdiobus_read(struct mii_bus *bus, int addr, u32 regnum)
>  {
>  	int retval;
>  
> -	WARN_ON_ONCE(!mutex_is_locked(&bus->mdio_lock));
> +	lockdep_assert_held_once(&bus->mdio_lock);

Hi Heiner

I don't think there is a clear right/wrong here. This is not hot path
code. The cost for checking the lock is held is very small compared to
the actual MDIO transaction. So i don't think we really need to
optimise this. I do sometimes build with lockdep on, but not
always. So it is good to know when locking is broken on normal builds.

Florian, what do you think?

	 Andrew

  reply	other threads:[~2018-11-13  3:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 21:33 [PATCH net-next] net: phy: switch to lockdep_assert_held in phylib Heiner Kallweit
2018-11-12 17:44 ` Andrew Lunn [this message]
2018-11-12 18:58   ` Florian Fainelli

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=20181112174416.GF5075@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=netdev@vger.kernel.org \
    /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