[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2204212018540.9383@angie.orcam.me.uk>
Date: Thu, 21 Apr 2022 20:25:53 +0100 (BST)
From: "Maciej W. Rozycki" <macro@...am.me.uk>
To: "Jason A. Donenfeld" <Jason@...c4.com>
cc: linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org,
tglx@...utronix.de, arnd@...db.de, Theodore Ts'o <tytso@....edu>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Russell King <linux@...linux.org.uk>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
"David S . Miller" <davem@...emloft.net>,
Richard Weinberger <richard@....at>,
Anton Ivanov <anton.ivanov@...bridgegreys.com>,
Johannes Berg <johannes@...solutions.net>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H . Peter Anvin" <hpa@...or.com>, Chris Zankel <chris@...kel.net>,
Max Filippov <jcmvbkbc@...il.com>,
Stephen Boyd <sboyd@...nel.org>,
Dinh Nguyen <dinguyen@...nel.org>,
linux-arm-kernel@...ts.infradead.org,
linux-m68k@...ts.linux-m68k.org, linux-mips@...r.kernel.org,
linux-riscv@...ts.infradead.org, sparclinux@...r.kernel.org,
linux-um@...ts.infradead.org, x86@...nel.org,
linux-xtensa@...ux-xtensa.org
Subject: Re: [PATCH v5 04/11] mips: use fallback for random_get_entropy()
instead of just c0 random
On Tue, 19 Apr 2022, Jason A. Donenfeld wrote:
> For situations in which we don't have a c0 counter register available,
> we've been falling back to reading the c0 "random" register, which is
> usually bounded by the amount of TLB entries and changes every other
> cycle or so. This means it wraps extremely often. We can do better by
> combining this fast-changing counter with a potentially slower-changing
> counter from random_get_entropy_fallback() in the more significant bits.
> This commit combines the two, taking into account that the changing bits
> are in a different bit position depending on the CPU model. In addition,
> we previously were falling back to 0 for ancient CPUs that Linux does
> not support anyway; remove that dead path entirely.
Tested-by: Maciej W. Rozycki <macro@...am.me.uk>
I've pushed the algorithm through testing with a number of suitable
systems:
- an R2000A and an R3000A with no timer of any kind, only jiffies,
- an R3400 with a chipset timer only,
- an R4400SC with a usable buggy CP0 counter and a chipset timer,
- a 5Kc with a good CP0 counter only,
with no obvious issues spotted. Thank you for working on this!
Maciej
Powered by blists - more mailing lists