netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Waldekranz <tobias@waldekranz.com>
To: David Laight <David.Laight@ACULAB.COM>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"kuba@kernel.org" <kuba@kernel.org>, Andrew Lunn <andrew@lunn.ch>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: RE: [PATCH v2 net-next 0/2] net: dsa: mv88e6xxx: Improve indirect addressing performance
Date: Fri, 28 Jan 2022 16:58:02 +0100	[thread overview]
Message-ID: <87k0ejc0ol.fsf@waldekranz.com> (raw)
In-Reply-To: <c3bc08f82f1c435ca6fd47e30eb65405@AcuMS.aculab.com>

On Fri, Jan 28, 2022 at 14:10, David Laight <David.Laight@ACULAB.COM> wrote:
> From: Tobias Waldekranz
>> Sent: 28 January 2022 10:50
>> 
>> The individual patches have all the details. This work was triggered
>> by recent work on a platform that took 16s (sic) to load the mv88e6xxx
>> module.
>> 
>> The first patch gets rid of most of that time by replacing a very long
>> delay with a tighter poll loop to wait for the busy bit to clear.
>> 
>> The second patch shaves off some more time by avoiding redundant
>> busy-bit-checks, saving 1 out of 4 MDIO operations for every register
>> read/write in the optimal case.
>
> I don't think you should fast-poll for the entire timeout period.
> Much better to drop to a usleep_range() after the first 2 (or 3)
> reads fail.

You could, I suppose. Andrew, do you want a v3?

> Also I presume there is some lock that ensures this is all single threaded?

Yes, all callers must hold chip->reg_lock, which is asserted by
mv88e6xxx_{read,write}.

> If you remember the 'busy state' you can defer the 'busy check' after
> a write until the next request.
> That may well reduce the number of 'double checks' needed.

With 2/2 in place, we have already reduced it to:

read:
  Write command
  Poll  command
  Read  data

write:
  Write data
  Write command
  Poll  command

The poll in read is always required to that you know that the value in
the data register is valid. The poll in write is always required because
most of the writes are going to have side-effects on how the fabric
operates. So you want callers to be able to rely on the data being in
place once the function returns.

Am I missing something?

  reply	other threads:[~2022-01-28 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28 10:49 [PATCH v2 net-next 0/2] net: dsa: mv88e6xxx: Improve indirect addressing performance Tobias Waldekranz
2022-01-28 10:49 ` [PATCH v2 net-next 1/2] net: dsa: mv88e6xxx: Improve performance of busy bit polling Tobias Waldekranz
2022-01-28 14:13   ` Andrew Lunn
2022-01-28 10:49 ` [PATCH v2 net-next 2/2] net: dsa: mv88e6xxx: Improve indirect addressing performance Tobias Waldekranz
2022-01-28 14:10 ` [PATCH v2 net-next 0/2] " David Laight
2022-01-28 15:58   ` Tobias Waldekranz [this message]
2022-01-28 16:10     ` Andrew Lunn
2022-01-28 16:18       ` Tobias Waldekranz
2022-01-28 16:31       ` David Laight

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=87k0ejc0ol.fsf@waldekranz.com \
    --to=tobias@waldekranz.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).