From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Peter Zijlstra" <peterz@infradead.org>,
"Theodore Ts'o" <tytso@mit.edu>,
"Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
"Sultan Alsawaf" <sultan@kerneltoast.com>,
"Dominik Brodowski" <linux@dominikbrodowski.net>
Subject: Re: [PATCH v2] random: set fast pool count to zero in cpuhp teardown
Date: Mon, 14 Feb 2022 16:06:38 +0100 [thread overview]
Message-ID: <Ygpv/kLWCmTzUTki@linutronix.de> (raw)
In-Reply-To: <CAHmME9rp+O3+yjX_q-BS8y06PigbkEgi4vn=nzLACnBAWZt-vA@mail.gmail.com>
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@linutronix.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
next prev parent reply other threads:[~2022-02-14 15:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-13 21:53 [PATCH] random: set fast pool count to zero in cpuhp teardown Jason A. Donenfeld
2022-02-14 11:07 ` Sebastian Andrzej Siewior
2022-02-14 13:28 ` Jason A. Donenfeld
2022-02-14 13:37 ` [PATCH v2] " Jason A. Donenfeld
2022-02-14 14:17 ` Sebastian Andrzej Siewior
2022-02-14 14:42 ` Jason A. Donenfeld
2022-02-14 14:49 ` Sebastian Andrzej Siewior
2022-02-14 14:52 ` Jason A. Donenfeld
2022-02-14 15:06 ` Sebastian Andrzej Siewior [this message]
2022-02-14 15:10 ` Jason A. Donenfeld
2022-02-14 15:17 ` Sebastian Andrzej Siewior
2022-02-14 16:15 ` Jason A. Donenfeld
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=Ygpv/kLWCmTzUTki@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=Jason@zx2c4.com \
--cc=j.neuschaefer@gmx.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@dominikbrodowski.net \
--cc=peterz@infradead.org \
--cc=sultan@kerneltoast.com \
--cc=tglx@linutronix.de \
--cc=tytso@mit.edu \
/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