powerpc/64s: avoid reloading (H)SRR registers if they are still valid
authorNicholas Piggin <npiggin@gmail.com>
Thu, 17 Jun 2021 15:51:03 +0000 (01:51 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 Jun 2021 14:06:55 +0000 (00:06 +1000)
commit59dc5bfca0cb6a29db1a50847684eb5c19f8f400
treee59ddd65cf780da3df22074afee961dc8503cdc2
parent1df7d5e4baeac74d14c1bee18b2dff9302b3efbc
powerpc/64s: avoid reloading (H)SRR registers if they are still valid

When an interrupt is taken, the SRR registers are set to return to where
it left off. Unless they are modified in the meantime, or the return
address or MSR are modified, there is no need to reload these registers
when returning from interrupt.

Introduce per-CPU flags that track the validity of SRR and HSRR
registers. These are cleared when returning from interrupt, when
using the registers for something else (e.g., OPAL calls), when
adjusting the return address or MSR of a context, and when context
switching (which changes the return address and MSR).

This improves the performance of interrupt returns.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
[mpe: Fold in fixup patch from Nick]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210617155116.2167984-5-npiggin@gmail.com
47 files changed:
arch/powerpc/Kconfig.debug
arch/powerpc/include/asm/hw_irq.h
arch/powerpc/include/asm/interrupt.h
arch/powerpc/include/asm/livepatch.h
arch/powerpc/include/asm/paca.h
arch/powerpc/include/asm/probes.h
arch/powerpc/include/asm/ptrace.h
arch/powerpc/kernel/asm-offsets.c
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/exceptions-64s.S
arch/powerpc/kernel/fpu.S
arch/powerpc/kernel/hw_breakpoint.c
arch/powerpc/kernel/kgdb.c
arch/powerpc/kernel/kprobes-ftrace.c
arch/powerpc/kernel/kprobes.c
arch/powerpc/kernel/mce.c
arch/powerpc/kernel/optprobes.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/prom_init.c
arch/powerpc/kernel/ptrace/ptrace-adv.c
arch/powerpc/kernel/ptrace/ptrace-noadv.c
arch/powerpc/kernel/ptrace/ptrace-view.c
arch/powerpc/kernel/rtas.c
arch/powerpc/kernel/signal.c
arch/powerpc/kernel/signal_32.c
arch/powerpc/kernel/signal_64.c
arch/powerpc/kernel/syscalls.c
arch/powerpc/kernel/traps.c
arch/powerpc/kernel/uprobes.c
arch/powerpc/kernel/vector.S
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_pr.c
arch/powerpc/lib/error-inject.c
arch/powerpc/lib/sstep.c
arch/powerpc/lib/test_emulate_step.c
arch/powerpc/math-emu/math.c
arch/powerpc/math-emu/math_efp.c
arch/powerpc/platforms/embedded6xx/holly.c
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
arch/powerpc/platforms/pasemi/idle.c
arch/powerpc/platforms/powernv/opal-call.c
arch/powerpc/platforms/powernv/opal.c
arch/powerpc/platforms/pseries/hvCall.S
arch/powerpc/platforms/pseries/ras.c
arch/powerpc/sysdev/fsl_pci.c
arch/powerpc/sysdev/fsl_rio.c
arch/powerpc/xmon/xmon.c