linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Naveen N Rao <naveen@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Jason A. Donenfeld" <Jason@zx2c4.com>,
	Andy Lutomirski <luto@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Arnd Bergmann <arnd@arndb.de>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-arch@vger.kernel.org
Subject: [PATCH 0/9] Wire up getrandom() vDSO implementation on powerpc
Date: Fri, 16 Aug 2024 16:36:47 +0200	[thread overview]
Message-ID: <cover.1723817900.git.christophe.leroy@csgroup.eu> (raw)

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



             reply	other threads:[~2024-08-16 14:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-16 14:36 Christophe Leroy [this message]
2024-08-16 14:36 ` [PATCH 1/9] powerpc/vdso: Don't discard rela sections Christophe Leroy
2024-08-16 14:36 ` [PATCH 2/9] powerpc/vdso32: Add crtsavres Christophe Leroy
2024-08-16 14:36 ` [PATCH 3/9] vdso: Add __arch_get_k_vdso_rng_data() Christophe Leroy
2024-08-17 12:48   ` kernel test robot
2024-08-17 13:19   ` kernel test robot
2024-08-16 14:36 ` [PATCH 4/9] vdso: Add missing c-getrandom-y in Makefile Christophe Leroy
2024-08-16 14:36 ` [PATCH 5/9] vdso: Avoid call to memset() by getrandom Christophe Leroy
2024-08-16 14:36 ` [PATCH 6/9] vdso: Only use MAP_DROPPABLE when VM_DROPPABLE exists Christophe Leroy
2024-08-16 14:36 ` [PATCH 7/9] powerpc: Add little endian variants of LHZX_BE and friends Christophe Leroy
2024-08-16 14:36 ` [PATCH 8/9] powerpc/vdso: Wire up getrandom() vDSO implementation Christophe Leroy
2024-08-16 14:36 ` [PATCH 9/9] selftests: [NOT TO BE MERGED] Modifications for testing VDSO getrandom implementation on PPC32 Christophe Leroy
2024-08-17 18:07   ` kernel test robot
2024-08-16 21:57 ` [PATCH 0/9] Wire up getrandom() vDSO implementation on powerpc Jason A. Donenfeld
2024-08-16 22:10   ` Jason A. Donenfeld

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1723817900.git.christophe.leroy@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=Jason@zx2c4.com \
    --cc=arnd@arndb.de \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen@kernel.org \
    --cc=npiggin@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tytso@mit.edu \
    --cc=vincenzo.frascino@arm.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).