Thread (4 messages) 4 messages, 3 authors, 2022-08-10

Re: [PATCH v2 10/14] powerpc: Provide syscall wrapper

From: Christophe Leroy <hidden>
Date: 2022-08-08 08:40:51


Le 25/07/2022 à 08:30, Rohan McLure a écrit :
Implement syscall wrapper as per s390, x86, arm64. When enabled
cause handlers to accept parameters from a stack frame rather than
from user scratch register state. This allows for user registers to be
safely cleared in order to reduce caller influence on speculation
within syscall routine. The wrapper is a macro that emits syscall
handler symbols that call into the target handler, obtaining its
parameters from a struct pt_regs on the stack.

As registers are already saved to the stack prior to calling
system_call_exception, it appears that this function is executed more
efficiently with the new stack-pointer convention than with parameters
passed by registers, avoiding the allocation of a stack frame for this
method. On a 32-bit system, we see >20% performance increases on the
null_syscall microbenchmark, and on a Power 8 the performance gains
amortise the cost of clearing and restoring registers which is
implemented at the end of this series, seeing final result of ~5.6%
performance improvement on null_syscall.

Syscalls are wrapped in this fashion on all platforms except for the
Cell processor as this commit does not provide SPU support. This can be
quickly fixed in a successive patch, but requires spu_sys_callback to
allocate a pt_regs structure to satisfy the wrapped calling convention.

Co-developed-by: Andrew Donnellan <redacted>
Signed-off-by: Andrew Donnellan <redacted>
Signed-off-by: Rohan McLure <redacted>
---
V1 -> V2: Generate prototypes for symbols produced by the wrapper.
---
  arch/powerpc/Kconfig                       |  1 +
  arch/powerpc/include/asm/interrupt.h       |  3 +-
  arch/powerpc/include/asm/syscall.h         |  4 +
  arch/powerpc/include/asm/syscall_wrapper.h | 94 ++++++++++++++++++++
  arch/powerpc/include/asm/syscalls.h        | 25 +++++-
  arch/powerpc/kernel/entry_32.S             |  6 +-
  arch/powerpc/kernel/interrupt.c            | 31 +++----
  arch/powerpc/kernel/interrupt_64.S         | 30 +++----
  arch/powerpc/kernel/systbl.c               |  2 +
  arch/powerpc/kernel/vdso.c                 |  2 +
  10 files changed, 156 insertions(+), 42 deletions(-)
This patch doesn't apply on powerpc tree, conflicts with 1547db7d1f44 
("powerpc: Move system_call_exception() to syscall.c")

Christophe
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help