From: Andrew Lunn <andrew@lunn.ch>
To: Andy Duan <fugang.duan@nxp.com>
Cc: David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Chris Healy <Chris.Healy@zii.aero>,
Chris Heally <cphealy@gmail.com>
Subject: Re: [EXT] [PATCH] net: ethernet: fec: Replace interrupt driven MDIO with polled IO
Date: Tue, 14 Apr 2020 05:49:20 +0200 [thread overview]
Message-ID: <20200414034920.GA611399@lunn.ch> (raw)
In-Reply-To: <VI1PR0402MB3600B82EE105E43BD20E2190FFDA0@VI1PR0402MB3600.eurprd04.prod.outlook.com>
On Tue, Apr 14, 2020 at 03:07:09AM +0000, Andy Duan wrote:
> From: Andrew Lunn <andrew@lunn.ch> Sent: Tuesday, April 14, 2020 8:46 AM
> > Measurements of the MDIO bus have shown that driving the MDIO bus using
> > interrupts is slow. Back to back MDIO transactions take about 90uS, with
> > 25uS spent performing the transaction, and the remainder of the time the bus
> > is idle.
> >
> > Replacing the completion interrupt with polled IO results in back to back
> > transactions of 40uS. The polling loop waiting for the hardware to complete
> > the transaction takes around 27uS. Which suggests interrupt handling has an
> > overhead of 50uS, and polled IO nearly halves this overhead, and doubles the
> > MDIO performance.
> >
>
> Although the mdio performance is better, but polling IO by reading register
> cause system/bus loading more heavy.
Hi Andy
I actually think is reduces the system bus load. With interrupts we
have 27uS waiting for the interrupt when the bus is idle, followed by
63uS the CPU is busy handling the interrupt and setting up the next
transfer, which will case the bus to be loaded. So the system bus is
busy for 63uS per transaction. With polled IO, yes the system bus is
busy for 27uS polling while the transaction happens, and then another
13uS setting up the next transaction. But in total, that is only 40uS.
So with interrupts we have 63uS of load per transaction, vs 40uS of
load per transaction for polled IO. Polled IO is better for the bus.
I also have follow up patches which allows the bus to be run at higher
speeds. The Ethernet switch i have on the bus is happy to run a 5MHz
rather than the default 2.5MHz. That reduces the transaction time by a
1/2. The switch will also work without the MDIO preamble, again
reducing the size of the MDIO transaction by 1/2. Combining all these,
interrupt handling becomes very expensive. You do not want to be doing
interrupts every 7uS.
Andrew
next prev parent reply other threads:[~2020-04-14 3:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-14 0:45 [PATCH] net: ethernet: fec: Replace interrupt driven MDIO with polled IO Andrew Lunn
2020-04-14 3:07 ` [EXT] " Andy Duan
2020-04-14 3:49 ` Andrew Lunn [this message]
2020-04-14 5:12 ` Andy Duan
2020-04-14 12:55 ` Andrew Lunn
2020-04-14 23:38 ` David Miller
2020-04-15 0:20 ` Andrew Lunn
2020-04-27 15:19 ` Leonard Crestez
2020-04-27 15:29 ` Andy Duan
2020-04-27 15:37 ` Andrew Lunn
2020-04-27 16:37 ` Andrew Lunn
2020-04-27 16:48 ` Fabio Estevam
2020-04-27 16:46 ` Andrew Lunn
2020-04-27 17:48 ` [EXT] " Andy Duan
2020-04-27 20:00 ` Leonard Crestez
2020-04-27 20:13 ` Andrew Lunn
2020-04-28 7:50 ` [EXT] " Andy Duan
2020-04-28 13:34 ` Andrew Lunn
2020-04-28 13:50 ` Andy Duan
2020-04-28 14:29 ` 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=20200414034920.GA611399@lunn.ch \
--to=andrew@lunn.ch \
--cc=Chris.Healy@zii.aero \
--cc=cphealy@gmail.com \
--cc=davem@davemloft.net \
--cc=fugang.duan@nxp.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;
as well as URLs for NNTP newsgroup(s).