All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: alexandru.tachici@analog.com
Cc: d.michailidis@fungible.com, davem@davemloft.net,
	devicetree@vger.kernel.org, edumazet@google.com,
	geert+renesas@glider.be, geert@linux-m68k.org,
	gerhard@engleder-embedded.com, joel@jms.id.au,
	krzysztof.kozlowski+dt@linaro.org, kuba@kernel.org,
	l.stelmach@samsung.com, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, robh+dt@kernel.org,
	stefan.wahren@i2se.com, stephen@networkplumber.org,
	wellslutw@gmail.com
Subject: Re: [net-next,v2,2/3] net: ethernet: adi: Add ADIN1110 support
Date: Wed, 27 Jul 2022 15:26:27 +0200	[thread overview]
Message-ID: <YuE9AxMmw4+/9Joy@lunn.ch> (raw)
In-Reply-To: <20220727132612.31445-1-alexandru.tachici@analog.com>

On Wed, Jul 27, 2022 at 04:26:12PM +0300, alexandru.tachici@analog.com wrote:
> > > +static irqreturn_t adin1110_irq(int irq, void *p)
> > > +{
> > > +	struct adin1110_priv *priv = p;
> > > +	u32 status1;
> > > +	u32 val;
> > > +	int ret;
> > > +	int i;
> > > +
> > > +	mutex_lock(&priv->lock);
> > 
> > The MDIO bus operations are using the same lock. MDIO can be quite
> > slow. Do you really need mutual exclusion between MDIO and interrupts?
> > What exactly is this lock protecting?
> > 
> >   Andrew
> 
> Hi Andrew,
> 
> Thanks for all the help here.
> 
> With this lock I am mainly protecting SPI read/writes. The hardware doesn't expose the MDIO pins.
> In order to read/write a PHY reg, there has to be a SPI read/write to the device, the same
> line where the MAC is programmed and ethernet frames are sent/received, not very efficient I know.

Have you profiled adin1110_mdio_read()?

You could hold the mutex for the "write the clause 22 read command",
and then release it. And then take the mutex in
adin1110_read_mdio_acc(). That will allow for example the interrupt
handler to jump in between polls, etc.

If all you are protecting is SPI read/writes, i wonder if you even
need this mutex, the SPI core has one as well.

	Andrew

  reply	other threads:[~2022-07-27 13:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 16:53 [net-next v2 0/3] net: ethernet: adi: Add ADIN1110 support alexandru.tachici
2022-07-25 16:53 ` [net-next v2 1/3] net: phy: adin1100: add PHY IDs of adin1110/adin2111 alexandru.tachici
2022-07-25 16:53 ` [net-next v2 2/3] net: ethernet: adi: Add ADIN1110 support alexandru.tachici
2022-07-25 20:17   ` Andrew Lunn
2022-07-27 13:26     ` [net-next,v2,2/3] " alexandru.tachici
2022-07-27 13:26       ` Andrew Lunn [this message]
2022-07-26  7:27   ` [net-next v2 2/3] " kernel test robot
2022-07-26 21:55   ` Andrew Lunn
2022-07-25 16:53 ` [net-next v2 3/3] dt-bindings: net: adin1110: Add docs alexandru.tachici
2022-07-25 19:37   ` Krzysztof Kozlowski
2022-07-25 19:52     ` Andrew Lunn
2022-07-25 20:23       ` Krzysztof Kozlowski
2022-07-25 19:50   ` Rob Herring
2022-07-25 20:24   ` Krzysztof Kozlowski

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=YuE9AxMmw4+/9Joy@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexandru.tachici@analog.com \
    --cc=d.michailidis@fungible.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=geert+renesas@glider.be \
    --cc=geert@linux-m68k.org \
    --cc=gerhard@engleder-embedded.com \
    --cc=joel@jms.id.au \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=kuba@kernel.org \
    --cc=l.stelmach@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=stefan.wahren@i2se.com \
    --cc=stephen@networkplumber.org \
    --cc=wellslutw@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.