[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHmME9rhunb05DEnc=UfGr8k9_LBi1NW2Hi0OsRbGwcCN2NzjQ@mail.gmail.com>
Date: Fri, 16 Sep 2022 15:50:41 +0100
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Sven van Ashbrook <svenva@...omium.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Herbert Xu <herbert@...dor.apana.org.au>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Olivia Mackall <olivia@...enic.com>,
Alex Levin <levinale@...gle.com>,
Andrey Pronin <apronin@...gle.com>,
Stephen Boyd <swboyd@...gle.com>,
Rajat Jain <rajatja@...gle.com>,
Eric Biggers <ebiggers@...gle.com>,
Petr Mladek <pmladek@...e.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
"Theodore Ts'o" <tytso@....edu>, linux-crypto@...r.kernel.org
Subject: Re: [PATCH v2 1/2] random: move add_hwgenerator_randomness()'s wait
outside function
Hi Sven,
On Thu, Sep 15, 2022 at 1:22 AM Sven van Ashbrook <svenva@...omium.org> wrote:
> - if (!kthread_should_stop() && crng_ready())
> - schedule_timeout_interruptible(CRNG_RESEED_INTERVAL);
> + return crng_ready() ? CRNG_RESEED_INTERVAL : 0;
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.
The other thing that occurred to me when reading this patch in context
of the other one is that this sleep you're removing here is not the
only sleep in the call chain. Each hwrng driver can also sleep, and
many do, sometimes for a long time, blocking until there's data
available, which might happen after minutes in some cases. So maybe
that's something to think about in context of this patchset -- that
just moving this to a delayed worker might not actually fix the issue
you're having with sleeps.
Jason
Powered by blists - more mailing lists