[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ygpv/kLWCmTzUTki@linutronix.de>
Date: Mon, 14 Feb 2022 16:06:38 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Theodore Ts'o <tytso@....edu>,
Jonathan Neuschäfer <j.neuschaefer@....net>,
Sultan Alsawaf <sultan@...neltoast.com>,
Dominik Brodowski <linux@...inikbrodowski.net>
Subject: Re: [PATCH v2] random: set fast pool count to zero in cpuhp teardown
On 2022-02-14 15:52:34 [+0100], Jason A. Donenfeld wrote:
> On Mon, Feb 14, 2022 at 3:49 PM Sebastian Andrzej Siewior
> <bigeasy@...utronix.de> wrote:
> >
> > On 2022-02-14 15:42:50 [+0100], Jason A. Donenfeld wrote:
> > > Hi Sebastian,
> > Hi Jason,
> >
> > > If we move this to startup, is there a phase during which no interrupt
> > > will arrive? That is, can this happen very very early in startup, so
> > > that zeroing out count happens *before* ++count?
> >
> > Interrupts will arrive starting with CPUHP_AP_ONLINE_IDLE from the CPU
> > HP point of view. My suggestion had a check for upper most bit and only
> > clear count if that bit was seen. So we wouldn't clear the counter if we
> > wouldn't suspect one of the rare corner cases.
>
> That doesn't work for the other use cases I have for this (see the other patch).
But you acked my question regarding boot-up? So the teardown callback
won't happen during boot-up.
> So I think it seems better to keep it before CPUHP_TIMERS_PREPARE, but
> do it on startup rather than teardown. Seem reasonable? Would that
> mean we zero out before IRQs are enabled?
I would only zero it if the upper-most bit is there.
If you need (want) to reset the get_random_uXX() pools and such, there
is nothing wrong with having an early notifier at CPU up time before the
CPU gets active (say CPUHP_RANDOM_PREPARE) where you make sure that the
pools will re-fill during first usage.
And then have another one after CPUHP_AP_WORKQUEUE_ONLINE to ensure that
a possible scheduled worker between CPUHP_AP_ONLINE_IDLE and
CPUHP_AP_WORKQUEUE_ONLINE runs on the correct CPU. And this covers also
the rollback problem.
Sebastian
Powered by blists - more mailing lists