netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sherry Yang <sherry.yang@oracle.com>,
	Paul Webb <paul.x.webb@oracle.com>,
	Phillip Goerl <phillip.goerl@oracle.com>,
	Jack Vogel <jack.vogel@oracle.com>,
	Nicky Veitch <nicky.veitch@oracle.com>,
	Colm Harrington <colm.harrington@oracle.com>,
	Ramanan Govindarajan <ramanan.govindarajan@oracle.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Tejun Heo <tj@kernel.org>,
	Sultan Alsawaf <sultan@kerneltoast.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v3] random: use expired per-cpu timer rather than wq for mixing fast pool
Date: Wed, 28 Sep 2022 18:15:46 +0200	[thread overview]
Message-ID: <YzRzMsORHpzFydO7@zx2c4.com> (raw)
In-Reply-To: <YzQ41ZhCojbyZq6L@linutronix.de>

Hi Sebastian,

On Wed, Sep 28, 2022 at 02:06:45PM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-09-27 12:42:33 [+0200], Jason A. Donenfeld wrote:
> …
> > This is an ordinary pattern done all over the kernel. However, Sherry
> > noticed a 10% performance regression in qperf TCP over a 40gbps
> > InfiniBand card. Quoting her message:
> > 
> > > MT27500 Family [ConnectX-3] cards:
> > > Infiniband device 'mlx4_0' port 1 status:
> …
> 
> While looking at the mlx4 driver, it looks like they don't use any NAPI
> handling in their interrupt handler which _might_ be the case that they
> handle more than 1k interrupts a second. I'm still curious to get that
> ACKed from Sherry's side.

Are you sure about that? So far as I can tell drivers/net/ethernet/
mellanox/mlx4 has plenty of napi_schedule/napi_enable and such. Or are
you looking at the infiniband driver instead? I don't really know how
these interact.

But yea, if we've got a driver not using NAPI at 40gbps that's obviously
going to be a problem.

> Jason, from random's point of view: deferring until 1k interrupts + 1sec
> delay is not desired due to low entropy, right?

Definitely || is preferable to &&.

> 
> > Rather than incur the scheduling latency from queue_work_on, we can
> > instead switch to running on the next timer tick, on the same core. This
> > also batches things a bit more -- once per jiffy -- which is okay now
> > that mix_interrupt_randomness() can credit multiple bits at once.
> 
> Hmmm. Do you see higher contention on input_pool.lock? Just asking
> because if more than once CPUs invokes this timer callback aligned, then
> they block on the same lock.

I've been doing various experiments, sending mini patches to Oracle and
having them test this in their rig. So far, it looks like the cost of
the body of the worker itself doesn't matter much, but rather the cost
of the enqueueing function is key. Still investigating though.

It's a bit frustrating, as all I have to work with are results from the
tests, and no perf analysis. It'd be great if an engineer at Oracle was
capable of tackling this interactively, but at the moment it's just me
sending them patches. So we'll see. Getting closer though, albeit very
slowly.

Jason

  reply	other threads:[~2022-09-28 16:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <B1BC4DB8-8F40-4975-B8E7-9ED9BFF1D50E@oracle.com>
     [not found] ` <CAHmME9rUn0b5FKNFYkxyrn5cLiuW_nOxUZi3mRpPaBkUo9JWEQ@mail.gmail.com>
     [not found]   ` <04044E39-B150-4147-A090-3D942AF643DF@oracle.com>
     [not found]     ` <CAHmME9oKcqceoFpKkooCp5wriLLptpN=+WrrG0KcDWjBahM0bQ@mail.gmail.com>
     [not found]       ` <BD03BFF6-C369-4D34-A38B-49653F1CBC53@oracle.com>
2022-09-21 22:32         ` 10% regression in qperf tcp latency after introducing commit "4a61bf7f9b18 random: defer fast pool mixing to worker" Jason A. Donenfeld
2022-09-21 23:35           ` Jason A. Donenfeld
2022-09-21 23:54           ` Tejun Heo
2022-09-22 16:45             ` Jason A. Donenfeld
2022-09-22 16:55               ` [PATCH] random: use tasklet rather than workqueue for mixing fast pool Jason A. Donenfeld
2022-09-26 22:04                 ` [PATCH v2] random: use immediate per-cpu timer " Jason A. Donenfeld
2022-09-27  7:41                   ` David Laight
2022-09-27  8:23                     ` Jason A. Donenfeld
2022-09-27 10:42                       ` [PATCH v3] random: use expired per-cpu timer rather than wq " Jason A. Donenfeld
2022-09-28 12:06                         ` Sebastian Andrzej Siewior
2022-09-28 16:15                           ` Jason A. Donenfeld [this message]
2022-09-29 14:18                             ` Sebastian Andrzej Siewior
2022-09-28 11:23             ` 10% regression in qperf tcp latency after introducing commit "4a61bf7f9b18 random: defer fast pool mixing to worker" Sebastian Siewior

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=YzRzMsORHpzFydO7@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=bigeasy@linutronix.de \
    --cc=colm.harrington@oracle.com \
    --cc=jack.vogel@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=netdev@vger.kernel.org \
    --cc=nicky.veitch@oracle.com \
    --cc=paul.x.webb@oracle.com \
    --cc=phillip.goerl@oracle.com \
    --cc=ramanan.govindarajan@oracle.com \
    --cc=sherry.yang@oracle.com \
    --cc=stable@vger.kernel.org \
    --cc=sultan@kerneltoast.com \
    --cc=tj@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).