linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dominik Brodowski <linux@dominikbrodowski.net>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2] hw_random: use add_hwgenerator_randomness() for early entropy
Date: Sun, 6 Nov 2022 08:02:56 +0100	[thread overview]
Message-ID: <Y2dcIKWOmczDCGLG@owl.dominikbrodowski.net> (raw)
In-Reply-To: <20221106015042.98538-1-Jason@zx2c4.com>

Am Sun, Nov 06, 2022 at 02:50:42AM +0100 schrieb Jason A. Donenfeld:
> Rather than calling add_device_randomness(), the add_early_randomness()
> function should use add_hwgenerator_randomness(), so that the early
> entropy can be potentially credited, which allows for the RNG to
> initialize earlier without having to wait for the kthread to come up.

We're already at device_initcall() level here, so that shouldn't be much of
an additional delay.

> Since we don't want to sleep from add_early_randomness(), we also
> refactor the API a bit so that hw_random/core.c can do the sleep, this
> time using the correct function, hwrng_msleep, rather than having
> random.c awkwardly do it.

Isn't this something you were quite hesistant about just recently[*]?

| I was thinking the other day that under certain circumstances, it
| would be nice if random.c could ask hwrng for more bytes NOW, rather
| than waiting. With the code as it is currently, this could be
| accomplished by having a completion event or something similar to
| that. With your proposed change, now it's left up to the hwrng
| interface to handle.
| 
| That's not the end of the world, but it does mean we'd have to come up
| with a patch down the line that exports a hwrng function saying, "stop
| the delays and schedule the worker NOW". Now impossible, just more
| complex, as now the state flow is split across two places. Wondering
| if you have any thoughts about this.

Thanks,
	Dominik

[*] https://lore.kernel.org/lkml/CAHmME9rhunb05DEnc=UfGr8k9_LBi1NW2Hi0OsRbGwcCN2NzjQ@mail.gmail.com/

  reply	other threads:[~2022-11-06  7:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05 20:44 [PATCH] hw_random: use add_hwgenerator_randomness() for early entropy Jason A. Donenfeld
2022-11-06  1:31 ` Jason A. Donenfeld
2022-11-06  1:50   ` [PATCH v2] " Jason A. Donenfeld
2022-11-06  7:02     ` Dominik Brodowski [this message]
2022-11-06 14:50       ` Jason A. Donenfeld
2022-11-06 15:02         ` [PATCH v3] " Jason A. Donenfeld
2022-11-07  2:17           ` Herbert Xu
2022-11-07 12:55             ` Jason A. Donenfeld
2022-11-08  9:58               ` Herbert Xu
2022-11-07  7:39           ` Dominik Brodowski
2022-11-08 10:53           ` AngeloGioacchino Del Regno
2022-11-08 11:00             ` Jason A. Donenfeld
2022-11-08 11:24               ` [PATCH v4] " Jason A. Donenfeld
2022-11-08 11:44                 ` AngeloGioacchino Del Regno
2022-11-08 22:05                   ` Marek Szyprowski
2022-11-13 13:48           ` [PATCH v3] " kernel test robot
2022-11-13 14:11             ` Jason A. Donenfeld
2022-11-07  7:37         ` [PATCH v2] " Dominik Brodowski

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=Y2dcIKWOmczDCGLG@owl.dominikbrodowski.net \
    --to=linux@dominikbrodowski.net \
    --cc=Jason@zx2c4.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.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;
as well as URLs for NNTP newsgroup(s).