Re: [PATCH v2] random: remove batched entropy locking

From: Jason A. Donenfeld
Date: Fri Feb 04 2022 - 09:11:54 EST


Hi Sebastian,

On Fri, Feb 4, 2022 at 3:02 PM Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> 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.

> > 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.

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.

Jason