[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <cover.1723817900.git.christophe.leroy@csgroup.eu>
Date: Fri, 16 Aug 2024 16:36:47 +0200
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Naveen N Rao <naveen@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>,
"Theodore Ts'o" <tytso@....edu>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Andy Lutomirski <luto@...nel.org>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Arnd Bergmann <arnd@...db.de>
Cc: Christophe Leroy <christophe.leroy@...roup.eu>,
linux-kernel@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org,
linux-arch@...r.kernel.org
Subject: [PATCH 0/9] Wire up getrandom() vDSO implementation on powerpc
This series wires up getrandom() vDSO implementation on powerpc.
Tested on PPC32.
Performance on powerpc 885 (using kernel selftest):
~# ./vdso_test_getrandom bench-single
vdso: 2500000 times in 7.897495392 seconds
libc: 2500000 times in 56.091632232 seconds
syscall: 2500000 times in 55.704851989 seconds
Performance on powerpc 8321 (using kernel selftest):
~# ./vdso_test_getrandom bench-single
vdso: 2500000 times in 2.017183250 seconds
libc: 2500000 times in 13.088533630 seconds
syscall: 2500000 times in 12.952458068 seconds
Only build tested on PPC64.
It doesn't build with CONFIG_COMPAT. This is because unlike
gettimeofday.c, getrandom.c includes a lot of headers from outside
of include/vdso/ . The same work as done by
commit 8c59ab839f52 ("lib/vdso: Enable common headers") needs to
be done on lib/vdso/getrandom.c
Among the few strange things to be clarified, there is the format
on the key passed to __arch_chacha20_blocks_nostack(). In
struct vgetrandom_state it is declared as a table of u32, but in
reality it seems it is a flat storage that needs to be loaded in
reversed byte order, so it should either be defined as a table of
bytes, or as a table of __le32 but not a table of u32.
Christophe Leroy (9):
powerpc/vdso: Don't discard rela sections
powerpc/vdso32: Add crtsavres
vdso: Add __arch_get_k_vdso_rng_data()
vdso: Add missing c-getrandom-y in Makefile
vdso: Avoid call to memset() by getrandom
vdso: Only use MAP_DROPPABLE when VM_DROPPABLE exists
powerpc: Add little endian variants of LHZX_BE and friends
powerpc/vdso: Wire up getrandom() vDSO implementation
selftests: [NOT TO BE MERGED] Modifications for testing VDSO getrandom
implementation on PPC32
arch/powerpc/Kconfig | 1 +
arch/powerpc/include/asm/asm-compat.h | 40 ++-
arch/powerpc/include/asm/vdso/getrandom.h | 61 ++++
arch/powerpc/include/asm/vdso/vsyscall.h | 7 +
arch/powerpc/include/asm/vdso_datapage.h | 2 +
arch/powerpc/kernel/asm-offsets.c | 1 +
arch/powerpc/kernel/vdso/Makefile | 44 ++-
arch/powerpc/kernel/vdso/getrandom.S | 62 ++++
arch/powerpc/kernel/vdso/gettimeofday.S | 13 -
arch/powerpc/kernel/vdso/vdso32.lds.S | 5 +-
arch/powerpc/kernel/vdso/vdso64.lds.S | 5 +-
arch/powerpc/kernel/vdso/vgetrandom-chacha.S | 297 ++++++++++++++++++
arch/powerpc/kernel/vdso/vgetrandom.c | 12 +
arch/x86/include/asm/vdso/vsyscall.h | 7 +
drivers/char/random.c | 5 +-
include/asm-generic/vdso/vsyscall.h | 7 +
include/vdso/limits.h | 4 +-
lib/vdso/Makefile | 1 +
lib/vdso/getrandom.c | 18 +-
tools/testing/selftests/vDSO/Makefile | 2 +-
.../selftests/vDSO/vdso_test_getrandom.c | 6 +-
21 files changed, 553 insertions(+), 47 deletions(-)
create mode 100644 arch/powerpc/include/asm/vdso/getrandom.h
create mode 100644 arch/powerpc/kernel/vdso/getrandom.S
create mode 100644 arch/powerpc/kernel/vdso/vgetrandom-chacha.S
create mode 100644 arch/powerpc/kernel/vdso/vgetrandom.c
--
2.44.0
Powered by blists - more mailing lists