public inbox for linux-crypto@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/1] s390/archrandom: use buffered random data
@ 2022-07-05 11:27 Holger Dengler
  2022-07-05 11:27 ` [PATCH v1 1/1] s390/arch_random: Buffer true " Holger Dengler
  0 siblings, 1 reply; 15+ messages in thread
From: Holger Dengler @ 2022-07-05 11:27 UTC (permalink / raw)
  To: Jason A . Donenfeld, Harald Freudenberger, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Christian Borntraeger
  Cc: Juergen Christ, Holger Dengler, linux-crypto, linux-s390

The trng instruction on s390 is a long-running instruction and also
condition the raw random data. The result size is always an integer multiple
of 32 bytes. The runtime for the minimum result of 32 bytes is 20-190us
(depending on the machine generation).

To call trng for each arch_get_random_seed_long() call wastes a lot of time.
Doing so in interrupt context as well, can have dramatically impact on
machines with a huge interrupt load, e.g. machines with multiple 10GB
Ethernet cards and high network traffic.

The following patch introduces a buffering for the trng call results, which
reduces the number of calls by factor 4. In interrupt context, the trng call
will be completely avoided, but if buffered random data is available, it
will be used there.

Holger Dengler (1):
  s390/arch_random: Buffer true random data

 arch/s390/crypto/arch_random.c     | 51 +++++++++++++++++++++++++++++-
 arch/s390/include/asm/archrandom.h | 17 ++++------
 2 files changed, 56 insertions(+), 12 deletions(-)

-- 
2.36.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-07-06 22:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-05 11:27 [PATCH v1 0/1] s390/archrandom: use buffered random data Holger Dengler
2022-07-05 11:27 ` [PATCH v1 1/1] s390/arch_random: Buffer true " Holger Dengler
2022-07-05 13:18   ` Jason A. Donenfeld
2022-07-05 13:42     ` Jason A. Donenfeld
2022-07-05 14:58     ` Holger Dengler
2022-07-05 15:11       ` Jason A. Donenfeld
2022-07-05 16:27         ` Holger Dengler
2022-07-05 16:35           ` Jason A. Donenfeld
2022-07-05 17:47             ` Holger Dengler
2022-07-05 18:19               ` Jason A. Donenfeld
2022-07-05 19:28                 ` Holger Dengler
2022-07-06 16:18           ` Harald Freudenberger
2022-07-06 16:26             ` Jason A. Donenfeld
2022-07-06 18:29               ` Christian Borntraeger
2022-07-06 22:34                 ` Jason A. Donenfeld

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox