netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Whitchurch <Vincent.Whitchurch@axis.com>
To: "nbd@nbd.name" <nbd@nbd.name>,
	"kuba@kernel.org" <kuba@kernel.org>,
	Vincent Whitchurch <Vincent.Whitchurch@axis.com>,
	"joabreu@synopsys.com" <joabreu@synopsys.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"peppe.cavallaro@st.com" <peppe.cavallaro@st.com>,
	"alexandre.torgue@st.com" <alexandre.torgue@st.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	kernel <kernel@axis.com>
Subject: Re: [PATCH net] net: stmmac: Use hrtimer for TX coalescing
Date: Fri, 25 Aug 2023 13:42:29 +0000	[thread overview]
Message-ID: <2e1db3c654b4e76c7249e90ecf8fa9d64046cbb8.camel@axis.com> (raw)
In-Reply-To: <732f3c01-a36f-4c9b-8273-a55aba9094d8@nbd.name>

On Wed, 2023-08-23 at 22:18 +0200, Felix Fietkau wrote:
> Based on tests by OpenWrt users, it seems that this one is causing a 
> significant performance regression caused by wasting lots of CPU cycles 
> re-arming the hrtimer on every single packet. More info:
> https://github.com/openwrt/openwrt/issues/11676#issuecomment-1690492666

It looks like there was an attempt to avoid the re-arming of the timer
in ->xmit() a while ago (pre-dating the hrtimer usage) in commit
4ae0169fd1b3c792b66be58995b7e6b629919ecf ("net: stmmac: Do not keep
rearming the coalesce timer in stmmac_xmit"), but that got reverted
later due to regressions.  The coalescing code has been reworked since
then but the removal of the re-arming was never attempted again.

> My suggestion for fixing this properly would be:
> - keep a separate timestamp for last tx packet
> - do not modify the timer if it's scheduled already
> - in the timer function, check the last tx timestamp and re-arm the 
> timer if necessary.

Would you mind explain the reasons for maintaining a timestamp and
checking it in the expiry function?  Is that to obtain the same effect
as the driver's current behaviour of postponing the expiry of the timer
for each packet?  Is that really desired?  According to the commit
message in 4ae0169fd1b3c792b66be58995b7e6b629919ecf, "Once the timer is
armed it should run after the time expires for the first packet sent and
not the last one."

Since the timer expiry function schedules napi, and the napi poll
function stmmac_tx_clean() re-arms the timer if it sees that there are
pending tx packets, shouldn't an implementation similar to hip04_eth.c
(which doesn't save/check the last tx timestamp) be sufficient?

  reply	other threads:[~2023-08-25 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20 15:02 [PATCH net] net: stmmac: Use hrtimer for TX coalescing Vincent Whitchurch
2020-11-24  0:46 ` Jakub Kicinski
2020-11-24  4:11   ` Vincent Whitchurch
2020-11-24 16:50     ` Jakub Kicinski
2023-08-23 20:18 ` Felix Fietkau
2023-08-25 13:42   ` Vincent Whitchurch [this message]
2023-08-25 17:38     ` Felix Fietkau
2023-08-30 14:55       ` Vincent Whitchurch
2023-08-30 18:05         ` Maxim Mikityanskiy
2023-09-18 12:56           ` Vincent Whitchurch
2023-09-19 17:53             ` Maxim Mikityanskiy
2023-08-30 21:06         ` Felix Fietkau
2023-09-01 11:31           ` Vincent Whitchurch
2023-09-01 11:53             ` Felix Fietkau
2023-09-08 10:42               ` Vincent Whitchurch

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=2e1db3c654b4e76c7249e90ecf8fa9d64046cbb8.camel@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=alexandre.torgue@st.com \
    --cc=davem@davemloft.net \
    --cc=joabreu@synopsys.com \
    --cc=kernel@axis.com \
    --cc=kuba@kernel.org \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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).