netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Íñigo Huguet" <ihuguet@redhat.com>
Cc: Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
	ecree.xilinx@gmail.com, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-net-drivers@amd.com, Fei Liu <feliu@redhat.com>
Subject: Re: [PATCH net] sfc: use budget for TX completions
Date: Wed, 14 Jun 2023 10:31:31 -0700	[thread overview]
Message-ID: <20230614103131.50a9abf1@kernel.org> (raw)
In-Reply-To: <CACT4oufPV6FbQ7xOU8uPOS2SsA6R-F+D5H80SnrH3BEOe+WoMA@mail.gmail.com>

On Wed, 14 Jun 2023 12:13:11 +0200 Íñigo Huguet wrote:
> On Wed, Jun 14, 2023 at 10:03 AM Martin Habets <habetsm.xilinx@gmail.com> wrote:
> > On Mon, Jun 12, 2023 at 04:42:54PM +0200, Íñigo Huguet wrote:  
> > > Documentations says "drivers can process completions for any number of Tx
> > > packets but should only process up to budget number of Rx packets".
> > > However, many drivers do limit the amount of TX completions that they
> > > process in a single NAPI poll.  
> >
> > I think your work and what other drivers do shows that the documentation is
> > no longer correct. I haven't checked when that was written, but maybe it
> > was years ago when link speeds were lower.
> > Clearly for drivers that support higher link speeds this is an issue, so we
> > should update the documentation. Not sure what constitutes a high link speed,
> > with current CPUs for me it's anything >= 50G.  
> 
> I reproduced with a 10G link (with debug kernel, though)

Ah.

> > > +#define EFX_NAPI_MAX_TX 512  
> >
> > How did you determine this value? Is it what other driver use?  
> 
> A bit of trial and error. I wanted to find a value high enough to not
> decrease performance but low enough to solve the issue.
> 
> Other drivers use lower values too, from 128. However, I decided to go
> to the high values in sfc because otherwise it can affect too much to
> RX. The most common case I saw in other drivers was: First process TX
> completions up to the established limit, then process RX completions
> up to the NAPI budget. But sfc processes TX and RX events serially,
> intermixed. We need to put a limit to TX events, but if it was too
> low, very few RX events would be processed with high TX traffic.
> 
> > > I would better like to hear the opinion from the sfc maintainers, but
> > > I don't mind changing it because I'm neither happy with the chosen
> > > location.  
> >
> > I think we should add it in include/linux/netdevice.h, close to
> > NAPI_POLL_WEIGHT. That way all drivers can use it.
> > Do we need to add this TX poll weight to struct napi_struct and
> > extend netif_napi_add_weight()?
> > That way all drivers could use the value from napi_struct instead of using
> > a hard-coded define. And at some point we can adjust it.  
> 
> That's what I thought too, but then we'd need to determine what's the
> exact meaning for that TX budget (as you see, it doesn't mean exactly
> the same for sfc than for other drivers, and between the other drivers
> there were small differences too).
> 
> We would also need to decide what the default value for the TX budget
> is, so it is used in netif_napi_add. Right now, each driver is using
> different values.
> 
> If something is done in that direction, it can take some time. May I
> suggest including this fix until then?

Agreed. Still needs a fixes tag, tho.

  reply	other threads:[~2023-06-14 17:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-12 14:42 [PATCH net] sfc: use budget for TX completions Íñigo Huguet
2023-06-12 16:04 ` Maciej Fijalkowski
2023-06-13 14:42   ` Íñigo Huguet
2023-06-14  8:10     ` Martin Habets
2023-06-14 10:13       ` Íñigo Huguet
2023-06-14 17:31         ` Jakub Kicinski [this message]
2023-06-15  8:08           ` Martin Habets
2023-06-14  8:03 ` Martin Habets
2023-06-14 17:27   ` Jakub Kicinski
2023-06-15  0:36     ` Edward Cree
2023-06-15  4:04       ` Jakub Kicinski

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=20230614103131.50a9abf1@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=feliu@redhat.com \
    --cc=ihuguet@redhat.com \
    --cc=linux-net-drivers@amd.com \
    --cc=maciej.fijalkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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).