mbox series

[v1,0/1] s390/archrandom: use buffered random data

Message ID 20220705112712.4433-1-dengler@linux.ibm.com (mailing list archive)
Headers show
Series s390/archrandom: use buffered random data | expand

Message

Holger Dengler July 5, 2022, 11:27 a.m. UTC
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(-)