]> git.baikalelectronics.ru Git - kernel.git/commitdiff
powerpc/32: Always save non volatile GPRs at syscall entry
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 8 Feb 2021 15:10:32 +0000 (15:10 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 11 Feb 2021 12:35:11 +0000 (23:35 +1100)
In preparation for porting syscall entry/exit to C, inconditionally
save non volatile general purpose registers.

Commit 965dd3ad3076 ("powerpc/64/syscall: Remove non-volatile GPR save
optimisation") provides detailed explanation.

This increases the number of cycles by 24 cycles on 8xx with
null_syscall benchmark (280 => 304 cycles)

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/21c08162b83655195fe9ead78ff2cfd28508d023.1612796617.git.christophe.leroy@csgroup.eu
arch/powerpc/kernel/entry_32.S
arch/powerpc/kernel/head_32.h
arch/powerpc/kernel/head_booke.h
arch/powerpc/kernel/syscalls/syscall.tbl

index b1e36602c013d01b5335e2c21fc3d37c3de7cdbe..97dc28a684655b49f81011f386d71a4da8356b8f 100644 (file)
@@ -351,6 +351,7 @@ trace_syscall_entry_irq_off:
 
        .globl  transfer_to_syscall
 transfer_to_syscall:
+       SAVE_NVGPRS(r1)
 #ifdef CONFIG_PPC_BOOK3S_32
        kuep_lock r11, r12
 #endif
@@ -614,51 +615,6 @@ ret_from_kernel_syscall:
 #endif
 _ASM_NOKPROBE_SYMBOL(ret_from_kernel_syscall)
 
-/*
- * The fork/clone functions need to copy the full register set into
- * the child process. Therefore we need to save all the nonvolatile
- * registers (r13 - r31) before calling the C code.
- */
-       .globl  ppc_fork
-ppc_fork:
-       SAVE_NVGPRS(r1)
-       lwz     r0,_TRAP(r1)
-       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
-       stw     r0,_TRAP(r1)            /* register set saved */
-       b       sys_fork
-
-       .globl  ppc_vfork
-ppc_vfork:
-       SAVE_NVGPRS(r1)
-       lwz     r0,_TRAP(r1)
-       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
-       stw     r0,_TRAP(r1)            /* register set saved */
-       b       sys_vfork
-
-       .globl  ppc_clone
-ppc_clone:
-       SAVE_NVGPRS(r1)
-       lwz     r0,_TRAP(r1)
-       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
-       stw     r0,_TRAP(r1)            /* register set saved */
-       b       sys_clone
-
-       .globl  ppc_clone3
-ppc_clone3:
-       SAVE_NVGPRS(r1)
-       lwz     r0,_TRAP(r1)
-       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
-       stw     r0,_TRAP(r1)            /* register set saved */
-       b       sys_clone3
-
-       .globl  ppc_swapcontext
-ppc_swapcontext:
-       SAVE_NVGPRS(r1)
-       lwz     r0,_TRAP(r1)
-       rlwinm  r0,r0,0,0,30            /* clear LSB to indicate full */
-       stw     r0,_TRAP(r1)            /* register set saved */
-       b       sys_swapcontext
-
 /*
  * Top-level page fault handling.
  * This is in assembler because if do_page_fault tells us that
index 930377375dc0d76630f36ec5f13f626874798e02..573c1d570a6afa3ba280c73c49de7822f5f60665 100644 (file)
        stw     r2,GPR2(r11)
        addi    r10,r10,STACK_FRAME_REGS_MARKER@l
        stw     r9,_MSR(r11)
-       li      r2, \trapno + 1
+       li      r2, \trapno
        stw     r10,8(r11)
        stw     r2,_TRAP(r11)
        SAVE_GPR(0, r11)
index b3c502c503a0a9ecafbbeafadfb146f437167279..626e716576ce00e6a734f0229de647a2c3096802 100644 (file)
@@ -124,7 +124,7 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV)
        stw     r2,GPR2(r11)
        addi    r12, r12, STACK_FRAME_REGS_MARKER@l
        stw     r9,_MSR(r11)
-       li      r2, \trapno + 1
+       li      r2, \trapno
        stw     r12, 8(r11)
        stw     r2,_TRAP(r11)
        SAVE_GPR(0, r11)
index f744eb5cba887d398e150e9ef9fbb1293d5fe08f..96b2157f03719b5975ac176e74b2727661312343 100644 (file)
@@ -9,9 +9,7 @@
 #
 0      nospu   restart_syscall                 sys_restart_syscall
 1      nospu   exit                            sys_exit
-2      32      fork                            ppc_fork                        sys_fork
-2      64      fork                            sys_fork
-2      spu     fork                            sys_ni_syscall
+2      nospu   fork                            sys_fork
 3      common  read                            sys_read
 4      common  write                           sys_write
 5      common  open                            sys_open                        compat_sys_open
 119    32      sigreturn                       sys_sigreturn                   compat_sys_sigreturn
 119    64      sigreturn                       sys_ni_syscall
 119    spu     sigreturn                       sys_ni_syscall
-120    32      clone                           ppc_clone                       sys_clone
-120    64      clone                           sys_clone
-120    spu     clone                           sys_ni_syscall
+120    nospu   clone                           sys_clone
 121    common  setdomainname                   sys_setdomainname
 122    common  uname                           sys_newuname
 123    common  modify_ldt                      sys_ni_syscall
 186    spu     sendfile                        sys_sendfile64
 187    common  getpmsg                         sys_ni_syscall
 188    common  putpmsg                         sys_ni_syscall
-189    32      vfork                           ppc_vfork                       sys_vfork
-189    64      vfork                           sys_vfork
-189    spu     vfork                           sys_ni_syscall
+189    nospu   vfork                           sys_vfork
 190    common  ugetrlimit                      sys_getrlimit                   compat_sys_getrlimit
 191    common  readahead                       sys_readahead                   compat_sys_readahead
 192    32      mmap2                           sys_mmap2                       compat_sys_mmap2
 248    32      clock_nanosleep                 sys_clock_nanosleep_time32
 248    64      clock_nanosleep                 sys_clock_nanosleep
 248    spu     clock_nanosleep                 sys_clock_nanosleep
-249    32      swapcontext                     ppc_swapcontext                 compat_sys_swapcontext
-249    64      swapcontext                     sys_swapcontext
-249    spu     swapcontext                     sys_ni_syscall
+249    nospu   swapcontext                     sys_swapcontext                 compat_sys_swapcontext
 250    common  tgkill                          sys_tgkill
 251    32      utimes                          sys_utimes_time32
 251    64      utimes                          sys_utimes
 432    common  fsmount                         sys_fsmount
 433    common  fspick                          sys_fspick
 434    common  pidfd_open                      sys_pidfd_open
-435    32      clone3                          ppc_clone3                      sys_clone3
-435    64      clone3                          sys_clone3
-435    spu     clone3                          sys_ni_syscall
+435    nospu   clone3                          sys_clone3
 436    common  close_range                     sys_close_range
 437    common  openat2                         sys_openat2
 438    common  pidfd_getfd                     sys_pidfd_getfd