public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: "Andy Lutomirski" <luto@amacapital.net>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Will Deacon" <will@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Waiman Long" <longman@redhat.com>,
	"Sultan Alsawaf" <sultan@kerneltoast.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	LKML <linux-kernel@vger.kernel.org>,
	"Thomas Gleixner" <tglx@linutronix.de>
Subject: Re: [PATCH v2] random: remove batched entropy locking
Date: Fri, 4 Feb 2022 15:30:45 +0100	[thread overview]
Message-ID: <Yf04lcQIatnGspAb@linutronix.de> (raw)
In-Reply-To: <CAHmME9oOMhRVybTgHXT+oOXhMkdx7FVY7oSc-rHr=6AvZCVo=w@mail.gmail.com>

On 2022-02-04 15:11:34 [+0100], Jason A. Donenfeld wrote:
> Hi Sebastian,
Hi Jason,

> On Fri, Feb 4, 2022 at 3:02 PM Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
> > The commit in tree you cited is b43db859a36cb553102c9c80431fc44618703bda.
> > It does not mention anything regarding faster nor the performance
> > improvement and conditions (hoth path, etc). It still has a stable tag.
> 
> It dropped the Cc: stable@. It still has the Fixes:. I can get rid of
> the Fixes: too. I'll improve that message a bunch for a potential v3.

Either you argue for bug fixing or performance improvement and I made it
clear that it is not bug fixing. That Fixes: tag is enough for Greg to
backport it.

> > > Maybe it'd be best to retain the spinlock_t, which will amount to
> > > disabling interrupts on !PREEMPT_RT, since it'll never be contended,
> > > but will turn into a mutex on PREEMPT_RT, where it'll do the right
> > > thing from an exclusivity perspective. Would this be reasonable?
> >
> > what does retain the spinlock_t mean since we already have a spinlock_t?
> 
> The idea would be to keep using spinlock_t like we do now -- no change
> there -- but move to using this atomic generation counter so that
> there's never any contention. Actually, though, I worry that that
> approach would throw out the gains we're getting by chucking the
> spinlock in the first place.

It is a per-CPU spinlock_t so there should be no contention if there is
no cross-CPU access. The overhead are two atomic operations.

> What if we keep a spinlock_t there on PREEMPT_RT but stick with
> disabling interrupts on !PREEMPT_RT? I wish there was a solution or an
> API that amounted to the same thing so there wouldn't need to be an
> #ifdef, but I don't know what that'd be.

If it is still to much try to look for locallock_t and
local_lock_irqsave(). This is kind of like your local_irq_save() but
you have lockdep annotations and PREEMPT_RT has a spinlock_t like
behaviour. It also documents in-code what the scope of your locking is.

> Jason

Sebastian

  reply	other threads:[~2022-02-04 14:30 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 22:21 "BUG: Invalid wait context" in invalidate_batched_entropy Jonathan Neuschäfer
2022-01-27 22:26 ` Jason A. Donenfeld
2022-01-28  8:34   ` Sebastian Andrzej Siewior
2022-01-28 16:04     ` Jason A. Donenfeld
2022-01-28 16:19       ` Sebastian Andrzej Siewior
2022-01-28 16:28         ` Jason A. Donenfeld
2022-01-28 17:02           ` Sebastian Andrzej Siewior
2022-01-28 15:33   ` [PATCH] random: remove batched entropy locking Jason A. Donenfeld
2022-01-28 15:44     ` Sebastian Andrzej Siewior
2022-01-28 15:54       ` Jason A. Donenfeld
2022-01-28 16:15         ` Sebastian Andrzej Siewior
2022-01-28 16:36           ` Jason A. Donenfeld
2022-01-28 15:48     ` Jason A. Donenfeld
2022-01-28 22:35       ` [PATCH v2] " Jason A. Donenfeld
2022-01-29 21:03         ` Jonathan Neuschäfer
2022-02-04  0:27         ` Jason A. Donenfeld
2022-02-04 11:10           ` Sebastian Andrzej Siewior
2022-02-04 13:42             ` Jason A. Donenfeld
2022-02-04 14:01               ` Sebastian Andrzej Siewior
2022-02-04 14:11                 ` Jason A. Donenfeld
2022-02-04 14:30                   ` Sebastian Andrzej Siewior [this message]
2022-02-04 15:39                     ` Jason A. Donenfeld
2022-02-04 15:51                       ` [PATCH v3] " Jason A. Donenfeld
2022-02-04 15:57                         ` Sebastian Andrzej Siewior
2022-02-04 16:12                           ` Jason A. Donenfeld
2022-02-16 20:01                           ` Jann Horn
2022-02-16 20:58                             ` Jason A. Donenfeld
2022-02-17 17:33                               ` Sebastian Andrzej Siewior
2022-01-28 18:05     ` [PATCH] " Jonathan Neuschäfer
2022-01-29 18:22       ` Jason A. Donenfeld
2022-01-29  7:10     ` [random] 1e1724f9dd: UBSAN:array-index-out-of-bounds_in_drivers/char/random.c kernel test robot

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=Yf04lcQIatnGspAb@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=Jason@zx2c4.com \
    --cc=boqun.feng@gmail.com \
    --cc=j.neuschaefer@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=luto@amacapital.net \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sultan@kerneltoast.com \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    --cc=will@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