From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Stafford Horne <shorne@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH v7 11/17] openrisc: account for 0 starting value in random_get_entropy()
Date: Sat, 30 Apr 2022 03:29:37 +0200 [thread overview]
Message-ID: <YmyRATzJBQX+wnIP@zx2c4.com> (raw)
In-Reply-To: <YmyOh/YbgGJ3DK79@antec>
Hi Stafford,
On Sat, Apr 30, 2022 at 10:19:03AM +0900, Stafford Horne wrote:
> Hi Jason,
>
> On Fri, Apr 29, 2022 at 02:16:48AM +0200, Jason A. Donenfeld wrote:
> > As a sanity check, this series makes sure that during early boot, the
> > cycle counter isn't returning all zeros. However, OpenRISC's TTCR timer
> > can be rather slow and starts out as zero during stages of early boot.
> > We know it works, however. So just always add 1 to random_get_entropy()
> > so that it doesn't trigger these checks.
>
> Just one nit, you might want to qualify that this is related to simulators/qemu:
> * "However, in simulators OpenRISC's TTCR timer can be rather slow..."
Nice catch, will do.
Jason
>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > Cc: Arnd Bergmann <arnd@arndb.de>
> > Cc: Jonas Bonn <jonas@southpole.se>
> > Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> > Acked-by: Stafford Horne <shorne@gmail.com>
> > Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
> > ---
> > Changes v6->v7:
> > - Add 1 to cycle counter to account for functional but slow-to-begin
> > counter on QEMU.
> >
> > arch/openrisc/include/asm/timex.h | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/arch/openrisc/include/asm/timex.h b/arch/openrisc/include/asm/timex.h
> > index d52b4e536e3f..a78a5807c927 100644
> > --- a/arch/openrisc/include/asm/timex.h
> > +++ b/arch/openrisc/include/asm/timex.h
> > @@ -23,6 +23,9 @@ static inline cycles_t get_cycles(void)
> > {
> > return mfspr(SPR_TTCR);
> > }
> > +#define get_cycles get_cycles
> > +
> > +#define random_get_entropy() ((unsigned long)get_cycles() + 1)
> >
> > /* This isn't really used any more */
> > #define CLOCK_TICK_RATE 1000
>
> Thanks,
>
> -Stafford
next prev parent reply other threads:[~2022-04-30 1:29 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-23 21:26 [PATCH v6 00/17] archs/random: fallback to best raw ktime when no cycle counter Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 01/17] ia64: define get_cycles macro for arch-override Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 02/17] s390: " Jason A. Donenfeld
2022-04-25 9:43 ` Heiko Carstens
2022-04-25 9:48 ` Jason A. Donenfeld
2022-04-25 10:21 ` Heiko Carstens
2022-04-23 21:26 ` [PATCH v6 03/17] parisc: " Jason A. Donenfeld
2022-04-24 18:35 ` Helge Deller
2022-04-23 21:26 ` [PATCH v6 04/17] alpha: " Jason A. Donenfeld
2022-04-26 20:31 ` Matt Turner
2022-04-23 21:26 ` [PATCH v6 05/17] powerpc: " Jason A. Donenfeld
2022-04-28 5:19 ` Michael Ellerman
2022-04-23 21:26 ` [PATCH v6 06/17] timekeeping: add raw clock fallback for random_get_entropy() Jason A. Donenfeld
2022-04-25 12:37 ` Thomas Gleixner
2022-04-25 13:22 ` Jason A. Donenfeld
2022-05-02 9:37 ` Thomas Gleixner
2022-05-05 0:19 ` [PATCH v7] timekeeping: Add " Jason A. Donenfeld
2022-05-05 0:29 ` Jason A. Donenfeld
2022-05-06 3:20 ` [timekeeping] 3aeaac747d: PANIC:early_exception kernel test robot
2022-05-06 7:59 ` Thomas Gleixner
2022-05-06 10:12 ` Jason A. Donenfeld
2022-05-06 16:01 ` Thomas Gleixner
2022-05-06 10:21 ` [PATCH v8] timekeeping: Add raw clock fallback for random_get_entropy() Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 07/17] m68k: use fallback for random_get_entropy() instead of zero Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 08/17] riscv: " Jason A. Donenfeld
2022-04-25 14:55 ` Palmer Dabbelt
2022-04-25 15:02 ` Jason A. Donenfeld
2022-04-25 15:20 ` Palmer Dabbelt
2022-04-23 21:26 ` [PATCH v6 09/17] mips: use fallback for random_get_entropy() instead of just c0 random Jason A. Donenfeld
2022-04-26 20:28 ` Maciej W. Rozycki
2022-04-27 1:29 ` Jason A. Donenfeld
2022-06-24 13:04 ` Jason A. Donenfeld
2022-06-24 13:25 ` Maciej W. Rozycki
2022-09-25 10:00 ` Jason A. Donenfeld
2022-09-25 14:17 ` Maciej W. Rozycki
2022-04-23 21:26 ` [PATCH v6 10/17] arm: use fallback for random_get_entropy() instead of zero Jason A. Donenfeld
2022-04-25 14:30 ` Russell King (Oracle)
2022-04-23 21:26 ` [PATCH v6 11/17] openrisc: " Jason A. Donenfeld
2022-04-27 21:42 ` Stafford Horne
2022-04-27 23:26 ` Jason A. Donenfeld
2022-04-29 0:16 ` [PATCH v7 11/17] openrisc: account for 0 starting value in random_get_entropy() Jason A. Donenfeld
2022-04-30 1:19 ` Stafford Horne
2022-04-30 1:29 ` Jason A. Donenfeld [this message]
2022-04-30 22:11 ` Stafford Horne
2022-04-30 22:34 ` Jason A. Donenfeld
2022-04-30 22:44 ` Stafford Horne
2022-04-23 21:26 ` [PATCH v6 12/17] nios2: use fallback for random_get_entropy() instead of zero Jason A. Donenfeld
2022-05-23 13:56 ` Dinh Nguyen
2022-04-23 21:26 ` [PATCH v6 13/17] x86: " Jason A. Donenfeld
2022-04-25 12:35 ` Thomas Gleixner
2022-04-25 13:41 ` Jason A. Donenfeld
2022-04-25 13:51 ` Jason A. Donenfeld
2022-04-25 17:03 ` Thomas Gleixner
2022-04-25 17:24 ` Jason A. Donenfeld
2022-04-26 8:33 ` [PATCH v7 13/17] x86/asm: " Jason A. Donenfeld
2022-05-02 9:40 ` Thomas Gleixner
2022-04-23 21:26 ` [PATCH v6 14/17] um: " Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 15/17] sparc: " Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 16/17] xtensa: " Jason A. Donenfeld
2022-04-23 21:26 ` [PATCH v6 17/17] random: insist on random_get_entropy() existing in order to simplify 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=YmyRATzJBQX+wnIP@zx2c4.com \
--to=jason@zx2c4.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shorne@gmail.com \
/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).