All of lore.kernel.org
 help / color / mirror / Atom feed
* (no subject)
@ 2024-08-16 11:07 Xi Ruoyao
  2024-08-16 11:07 ` [PATCH v3 1/3] LoongArch: vDSO: Wire up getrandom() vDSO implementation Xi Ruoyao
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Xi Ruoyao @ 2024-08-16 11:07 UTC (permalink / raw)
  To: Jason A . Donenfeld, Huacai Chen, WANG Xuerui
  Cc: Xi Ruoyao, linux-crypto, loongarch, Jinyang He, Tiezhu Yang,
	Arnd Bergmann

Subject: [PATCH v3 0/2] LoongArch: Implement getrandom() in vDSO

For the rationale to implement getrandom() in vDSO see [1].

The vDSO getrandom() needs a stack-less ChaCha20 implementation, so we
need to add architecture-specific code and wire it up with the generic
code.  Both generic LoongArch implementation and Loongson SIMD eXtension
based implementation are added.  To dispatch them at runtime without
invoking cpucfg on each call, the alternative runtime patching mechanism
is extended to cover the vDSO.

The implementation is tested with the kernel selftests added by the last
patch in [1].  I had to make some adjustments to make it work on
LoongArch (see [2], I've not submitted the changes as at now because I'm
unsure about the KHDR_INCLUDES addition).  The vdso_test_getrandom
bench-single result:

       vdso: 25000000 times in 0.647855257 seconds (generic)
       vdso: 25000000 times in 0.601068605 seconds (LSX)
       libc: 25000000 times in 6.948168864 seconds
    syscall: 25000000 times in 6.990265548 seconds

The vdso_test_getrandom bench-multi result:

       vdso: 25000000 x 256 times in 35.322187834 seconds (generic)
       vdso: 25000000 x 256 times in 29.183885426 seconds (LSX)
       libc: 25000000 x 256 times in 356.628428409 seconds
       syscall: 25000000 x 256 times in 334.764602866 seconds

[1]:https://lore.kernel.org/all/20240712014009.281406-1-Jason@zx2c4.com/
[2]:https://github.com/xry111/linux/commits/xry111/la-vdso-v3/

[v2]->v3:
- Add a generic LoongArch implementation for which LSX isn't needed.

v1->v2:
- Properly send the series to the list.

[v2]:https://lore.kernel.org/all/20240815133357.35829-1-xry111@xry111.site/

Xi Ruoyao (3):
  LoongArch: vDSO: Wire up getrandom() vDSO implementation
  LoongArch: Perform alternative runtime patching on vDSO
  LoongArch: vDSO: Add LSX implementation of vDSO getrandom()

 arch/loongarch/Kconfig                      |   1 +
 arch/loongarch/include/asm/vdso/getrandom.h |  47 ++++
 arch/loongarch/include/asm/vdso/vdso.h      |   8 +
 arch/loongarch/kernel/asm-offsets.c         |  10 +
 arch/loongarch/kernel/vdso.c                |  14 +-
 arch/loongarch/vdso/Makefile                |   6 +
 arch/loongarch/vdso/memset.S                |  24 ++
 arch/loongarch/vdso/vdso.lds.S              |   7 +
 arch/loongarch/vdso/vgetrandom-chacha-lsx.S | 162 +++++++++++++
 arch/loongarch/vdso/vgetrandom-chacha.S     | 252 ++++++++++++++++++++
 arch/loongarch/vdso/vgetrandom.c            |  19 ++
 11 files changed, 549 insertions(+), 1 deletion(-)
 create mode 100644 arch/loongarch/include/asm/vdso/getrandom.h
 create mode 100644 arch/loongarch/vdso/memset.S
 create mode 100644 arch/loongarch/vdso/vgetrandom-chacha-lsx.S
 create mode 100644 arch/loongarch/vdso/vgetrandom-chacha.S
 create mode 100644 arch/loongarch/vdso/vgetrandom.c

-- 
2.46.0


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

end of thread, other threads:[~2024-08-27  9:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-16 11:07 Xi Ruoyao
2024-08-16 11:07 ` [PATCH v3 1/3] LoongArch: vDSO: Wire up getrandom() vDSO implementation Xi Ruoyao
2024-08-19 12:41   ` Huacai Chen
2024-08-19 13:03     ` Jason A. Donenfeld
2024-08-19 15:36       ` Xi Ruoyao
2024-08-20  0:50         ` Jinyang He
2024-08-20  1:09           ` Xi Ruoyao
2024-08-20  2:03             ` Jinyang He
2024-08-16 11:07 ` [PATCH v3 2/3] LoongArch: Perform alternative runtime patching on vDSO Xi Ruoyao
2024-08-16 11:07 ` [PATCH v3 3/3] LoongArch: vDSO: Add LSX implementation of vDSO getrandom() Xi Ruoyao
2024-08-19 12:40 ` Huacai Chen
2024-08-19 13:01   ` Re: Jason A. Donenfeld
2024-08-19 15:22     ` Re: Xi Ruoyao
2024-08-19 15:54       ` Re: Xi Ruoyao
2024-08-19 15:22   ` Re: Xi Ruoyao
2024-08-27  9:45 ` Re: Jason A. Donenfeld

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.