From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, Will Deacon <will@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>,
Jean-Philippe Brucker <jean-philippe@linaro.org>
Subject: Re: [PATCH v5] random: remove early archrandom abstraction
Date: Tue, 1 Nov 2022 14:02:58 +0100 [thread overview]
Message-ID: <Y2EZAsRA8uS+ppnn@zx2c4.com> (raw)
In-Reply-To: <Y2ESilMCF9eeffW6@FVFF77S0Q05N>
Hi Mark,
On Tue, Nov 01, 2022 at 12:36:07PM +0000, Mark Rutland wrote:
> Hi Jason,
>
> Sorry for joining this late...
>
> On Tue, Nov 01, 2022 at 01:25:28PM +0100, Jason A. Donenfeld wrote:
> > The arch_get_random*_early() abstraction is not completely useful and
> > adds complexity, because it's not a given that there will be no calls to
> > arch_get_random*() between random_init_early(), which uses
> > arch_get_random*_early(), and init_cpu_features(). During that gap,
> > crng_reseed() might be called, which uses arch_get_random*(), since it's
> > mostly not init code.
>
> The original rationale for arch_get_random*_early() was just to seed the RNG
> more robustly rather than to feed every possible arch_get_random() call made
> early in the boot flow, and the rationale for having a separate functions was
> that it was trivial to see by inspection that it was (only) called in the
> expected places.
>
> I'm not wedded to arch_get_random*_early() specifically, but I do think that
> having arch_get_random() behave differently depending on which phase of boot
> we're in has more scope for error than having a separate call of some sort.
>
> Other than removing the lines below, what chages is this going to permit?
Firstly, the issue with the API is having to remember to use it! There's
already been a bug from forgetting to use the _early() call during some
refactoring, and I doubt it'll be the last.
But also, functions such as crng_reseed()->extract_entropy() wind up
being called in both early contexts and normal contexts. It's not
feasible to have different paths there, so by having two functions,
we miss out on having access during early boot.
So I don't want a separate call, both for the API complexity reasons,
and because it doesn't really work as intended in the end.
Jason
next prev parent reply other threads:[~2022-11-01 13:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 23:40 [PATCH] random: remove early archrandom abstraction Jason A. Donenfeld
2022-10-30 17:30 ` Catalin Marinas
2022-10-30 21:07 ` Jason A. Donenfeld
2022-10-30 21:21 ` [PATCH v2] " Jason A. Donenfeld
2022-10-31 10:28 ` [PATCH v3] " Jason A. Donenfeld
2022-11-01 11:39 ` Catalin Marinas
2022-11-01 11:54 ` Jason A. Donenfeld
2022-11-01 11:56 ` [PATCH v4] " Jason A. Donenfeld
2022-11-01 12:25 ` [PATCH v5] " Jason A. Donenfeld
2022-11-01 12:36 ` Mark Rutland
2022-11-01 13:02 ` Jason A. Donenfeld [this message]
2022-11-01 13:07 ` Mark Rutland
2022-11-01 14:05 ` Catalin Marinas
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=Y2EZAsRA8uS+ppnn@zx2c4.com \
--to=jason@zx2c4.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=jean-philippe@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--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