Messages in this thread | | | Date | Fri, 4 Feb 2022 15:30:45 +0100 | From | Sebastian Andrzej Siewior <> | Subject | Re: [PATCH v2] random: remove batched entropy locking |
| |
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
| |