linux-stable/arch/powerpc
Christophe Leroy 526d4a4c77 powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly
When interrupt and syscall entries where converted to C, KUEP locking
and unlocking was also converted. It improved performance by unrolling
the loop, and allowed easily implementing boot time deactivation of
KUEP.

However, null_syscall selftest shows that KUEP is still heavy
(361 cycles with KUEP, 212 cycles without).

A way to improve more is to group 'mtsr's together, instead of
repeating 'addi' + 'mtsr' several times.

In order to do that, more registers need to be available. In C, GCC
will always be able to provide the requested number of registers, but
at the cost of saving some data on the stack, which is counter
performant here.

So let's do it in assembly, when we have full control of which
register can be used. It also has the advantage of locking earlier
and unlocking later and it helps GCC generating less tricky code.
The only drawback is to make boot time deactivation less straight
forward and require 'hand' instruction patching.

Group 'mtsr's by 4.

With this change, null_syscall selftest reports 336 cycles. Without
the change it was 361 cycles, that's a 7% reduction.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/115cb279e9b9948dfd93a065e047081c59e3a2a6.1634627931.git.christophe.leroy@csgroup.eu
2021-12-09 22:41:17 +11:00
..
boot powerpc: flexible GPR range save/restore macros 2021-11-29 23:15:20 +11:00
configs powerpc/microwatt: add POWER9_CPU, clear PPC_64S_HASH_MMU 2021-12-09 22:41:16 +11:00
crypto powerpc: flexible GPR range save/restore macros 2021-11-29 23:15:20 +11:00
include powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly 2021-12-09 22:41:17 +11:00
kernel powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly 2021-12-09 22:41:17 +11:00
kexec powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU 2021-12-09 22:41:13 +11:00
kvm powerpc/64s: Make hash MMU support configurable 2021-12-09 22:40:24 +11:00
lib powerpc: flexible GPR range save/restore macros 2021-11-29 23:15:20 +11:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm powerpc/32s: Do kuep_lock() and kuep_unlock() in assembly 2021-12-09 22:41:17 +11:00
net bpf ppc32: Access only if addr is kernel address 2021-11-25 11:25:32 +11:00
perf powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC 2021-11-30 17:15:49 +11:00
platforms powerpc/book3e: Activate KUEP at all time 2021-12-09 22:41:17 +11:00
purgatory
sysdev powerpc/xive: Fix compile when !CONFIG_PPC_POWERNV. 2021-12-02 10:40:38 +11:00
tools powerpc/head_check: Fix shellcheck errors 2021-08-17 22:52:02 +10:00
xmon powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU 2021-12-09 22:41:13 +11:00
Kbuild kbuild: use more subdir- for visiting subdirectories while cleaning 2021-10-24 13:49:46 +09:00
Kconfig powerpc/64s: Move hash MMU support code under CONFIG_PPC_64S_HASH_MMU 2021-12-09 22:41:13 +11:00
Kconfig.debug powerpc/ptdump: Convert powerpc to GENERIC_PTDUMP 2021-08-25 13:35:48 +10:00
Makefile Kbuild updates for v5.16 2021-11-08 09:15:45 -08:00
Makefile.postlink