linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc
@ 2024-08-22  7:13 Christophe Leroy
  2024-08-22  7:13 ` [PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO Christophe Leroy
                   ` (17 more replies)
  0 siblings, 18 replies; 64+ messages in thread
From: Christophe Leroy @ 2024-08-22  7:13 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Andy Lutomirski, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Theodore Ts'o,
	Jason A. Donenfeld, Arnd Bergmann, Andrew Morton, Steven Rostedt,
	Masami Hiramatsu, Mathieu Desnoyers, Vincenzo Frascino,
	Shuah Khan
  Cc: linuxppc-dev, linux-kernel, linux-fsdevel, linux-arch, linux-mm,
	linux-trace-kernel, linux-kselftest

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. There is a problem with vdso_test_getrandom
selftest, it doesn't find vDSO symbol __kernel_getrandom. There is the
same problem with vdso_test_gettimeofday so it is not related to
getrandom.

On strange things to be clarified, there is the format of 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. But this has no impact and can be clarified later and fixed in a
follow-up patch.

Changes in v2:
- Define VM_DROPPABLE for powerpc/32
- Fixes generic vDSO getrandom headers to enable CONFIG_COMPAT build.
- Fixed size of generation counter
- Fixed selftests to work on non x86 architectures

Christophe Leroy (17):
  asm-generic/unaligned.h: Extract common header for vDSO
  vdso: Clean header inclusion in getrandom
  vdso: Add __arch_get_k_vdso_rng_data()
  vdso: Add missing c-getrandom-y in Makefile
  vdso: Avoid call to memset() by getrandom
  vdso: Change getrandom's generation to unsigned long
  mm: Define VM_DROPPABLE for powerpc/32
  powerpc: Add little endian variants of LWZX_BE and STWX_BE
  powerpc/vdso32: Add crtsavres
  powerpc/vdso: Refactor CFLAGS for CVDSO build
  powerpc/vdso: Wire up getrandom() vDSO implementation
  selftests: vdso: Fix powerpc64 vdso_config
  selftests: vdso: Don't hard-code location of vDSO sources
  selftests: vdso: Make test_vdso_getrandom look for the right vDSO
    function
  selftests: vdso: Fix build of test_vdso_chacha
  selftests: vdso: Make VDSO function call more generic
  selftests: vdso: Add support for vdso_test_random for powerpc

 arch/powerpc/Kconfig                          |   1 +
 arch/powerpc/include/asm/asm-compat.h         |   8 +
 arch/powerpc/include/asm/mman.h               |   2 +-
 arch/powerpc/include/asm/vdso/getrandom.h     |  67 ++++
 arch/powerpc/include/asm/vdso/vsyscall.h      |   6 +
 arch/powerpc/include/asm/vdso_datapage.h      |   2 +
 arch/powerpc/kernel/asm-offsets.c             |   1 +
 arch/powerpc/kernel/vdso/Makefile             |  45 ++-
 arch/powerpc/kernel/vdso/getrandom.S          |  58 ++++
 arch/powerpc/kernel/vdso/gettimeofday.S       |  13 -
 arch/powerpc/kernel/vdso/vdso32.lds.S         |   1 +
 arch/powerpc/kernel/vdso/vdso64.lds.S         |   1 +
 arch/powerpc/kernel/vdso/vgetrandom-chacha.S  | 297 ++++++++++++++++++
 arch/powerpc/kernel/vdso/vgetrandom.c         |  14 +
 arch/x86/entry/vdso/vma.c                     |   3 +
 arch/x86/include/asm/pvclock.h                |   1 +
 arch/x86/include/asm/vdso/vsyscall.h          |  10 +-
 drivers/char/random.c                         |   5 +-
 fs/proc/task_mmu.c                            |   4 +-
 include/asm-generic/unaligned.h               |  11 +-
 include/linux/mm.h                            |   4 +-
 include/trace/events/mmflags.h                |   4 +-
 include/vdso/datapage.h                       |   2 +-
 include/vdso/getrandom.h                      |   2 +-
 include/vdso/helpers.h                        |   1 +
 include/vdso/unaligned.h                      |  15 +
 lib/vdso/Makefile                             |   1 +
 lib/vdso/getrandom.c                          |  30 +-
 tools/arch/powerpc/vdso                       |   1 +
 tools/arch/x86/vdso                           |   1 +
 tools/include/linux/linkage.h                 |   4 +
 tools/testing/selftests/vDSO/Makefile         |  12 +-
 tools/testing/selftests/vDSO/vdso_call.h      |  52 +++
 tools/testing/selftests/vDSO/vdso_config.h    |  14 +-
 .../selftests/vDSO/vdso_test_getrandom.c      |  11 +-
 35 files changed, 628 insertions(+), 76 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
 create mode 100644 include/vdso/unaligned.h
 create mode 120000 tools/arch/powerpc/vdso
 create mode 120000 tools/arch/x86/vdso
 create mode 100644 tools/testing/selftests/vDSO/vdso_call.h

-- 
2.44.0


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

end of thread, other threads:[~2024-08-30 10:02 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-22  7:13 [PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 01/17] asm-generic/unaligned.h: Extract common header for vDSO Christophe Leroy
2024-08-26  7:20   ` Jason A. Donenfeld
2024-08-26  7:32     ` Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 02/17] vdso: Clean header inclusion in getrandom Christophe Leroy
2024-08-26  8:07   ` Jason A. Donenfeld
2024-08-26  8:37     ` Christophe Leroy
2024-08-26  8:58       ` Jason A. Donenfeld
2024-08-26 10:45         ` Christophe Leroy
2024-08-26 13:17           ` Jason A. Donenfeld
2024-08-26 13:24           ` Thomas Gleixner
2024-08-22  7:13 ` [PATCH v2 03/17] vdso: Add __arch_get_k_vdso_rng_data() Christophe Leroy
2024-08-26  7:24   ` Jason A. Donenfeld
2024-08-22  7:13 ` [PATCH v2 04/17] vdso: Add missing c-getrandom-y in Makefile Christophe Leroy
2024-08-26  7:40   ` Jason A. Donenfeld
2024-08-22  7:13 ` [PATCH v2 05/17] vdso: Avoid call to memset() by getrandom Christophe Leroy
2024-08-26  8:01   ` Jason A. Donenfeld
2024-08-27 18:08   ` Eric Biggers
2024-08-27 18:22     ` Jason A. Donenfeld
2024-08-27 22:53     ` Segher Boessenkool
2024-08-28 11:18       ` Jason A. Donenfeld
2024-08-28 12:24         ` Arnd Bergmann
2024-08-28 12:26           ` Jason A. Donenfeld
2024-08-28 12:51             ` Segher Boessenkool
2024-08-28 12:45           ` Segher Boessenkool
2024-08-28 15:40             ` Ard Biesheuvel
2024-08-28 16:20               ` Segher Boessenkool
2024-08-28 17:12                 ` Ard Biesheuvel
2024-08-28 17:25                   ` Segher Boessenkool
2024-08-29 17:36                     ` Christophe Leroy
2024-08-29 18:02                       ` Segher Boessenkool
2024-08-29 18:50                         ` Christophe Leroy
2024-08-30 10:01                         ` Michael Ellerman
2024-08-28 12:33         ` Segher Boessenkool
2024-08-28 12:51           ` Jason A. Donenfeld
2024-08-22  7:13 ` [PATCH v2 06/17] vdso: Change getrandom's generation to unsigned long Christophe Leroy
2024-08-26  7:50   ` Jason A. Donenfeld
2024-08-26  8:01     ` Christophe Leroy
2024-08-26  8:16       ` Jason A. Donenfeld
2024-08-26  9:43       ` Thomas Gleixner
2024-08-26  9:48         ` Jason A. Donenfeld
2024-08-26 10:20         ` LEROY Christophe
2024-08-22  7:13 ` [PATCH v2 07/17] mm: Define VM_DROPPABLE for powerpc/32 Christophe Leroy
2024-08-26  9:53   ` kernel test robot
2024-08-26 10:13   ` kernel test robot
2024-08-26 21:34   ` kernel test robot
2024-08-22  7:13 ` [PATCH v2 08/17] powerpc: Add little endian variants of LWZX_BE and STWX_BE Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 09/17] powerpc/vdso32: Add crtsavres Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 10/17] powerpc/vdso: Refactor CFLAGS for CVDSO build Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 11/17] powerpc/vdso: Wire up getrandom() vDSO implementation Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 12/17] selftests: vdso: Fix powerpc64 vdso_config Christophe Leroy
2024-08-22  7:13 ` [PATCH v2 13/17] selftests: vdso: Don't hard-code location of vDSO sources Christophe Leroy
2024-08-26  7:26   ` Jason A. Donenfeld
2024-08-22  7:13 ` [PATCH v2 14/17] selftests: vdso: Make test_vdso_getrandom look for the right vDSO function Christophe Leroy
2024-08-26  7:28   ` Jason A. Donenfeld
2024-08-26  7:35     ` LEROY Christophe
2024-08-22  7:13 ` [PATCH v2 15/17] selftests: vdso: Fix build of test_vdso_chacha Christophe Leroy
2024-08-26  7:33   ` Jason A. Donenfeld
2024-08-22  7:13 ` [PATCH v2 16/17] selftests: vdso: Make VDSO function call more generic Christophe Leroy
2024-08-26  7:37   ` Jason A. Donenfeld
2024-08-26  7:48     ` LEROY Christophe
2024-08-22  7:13 ` [PATCH v2 17/17] selftests: vdso: Add support for vdso_test_random for powerpc Christophe Leroy
2024-08-26  7:19 ` [PATCH v2 00/17] Wire up getrandom() vDSO implementation on powerpc Jason A. Donenfeld
2024-08-26  8:23   ` 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;
as well as URLs for NNTP newsgroup(s).