powerpc: Improve 64-bit syscall entry/exit

We unconditionally hard enable interrupts. This is unnecessary as
syscalls are expected to always be called with interrupts enabled.

While at it, we add a WARN_ON if that is not the case and
CONFIG_TRACE_IRQFLAGS is enabled (we don't want to add overhead
to the fast path when this is not set though).

Thus let's remove the enabling (and associated irq tracing) from
the syscall entry path. Also on Book3S, replace a few mfmsr
instructions with loads of PACAMSR from the PACA, which should be
faster & schedule better.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent fe1952fc
...@@ -115,28 +115,33 @@ BEGIN_FW_FTR_SECTION ...@@ -115,28 +115,33 @@ BEGIN_FW_FTR_SECTION
END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
#endif /* CONFIG_VIRT_CPU_ACCOUNTING && CONFIG_PPC_SPLPAR */ #endif /* CONFIG_VIRT_CPU_ACCOUNTING && CONFIG_PPC_SPLPAR */
#ifdef CONFIG_TRACE_IRQFLAGS /*
bl .trace_hardirqs_on * A syscall should always be called with interrupts enabled
REST_GPR(0,r1) * so we just unconditionally hard-enable here. When some kind
REST_4GPRS(3,r1) * of irq tracing is used, we additionally check that condition
REST_2GPRS(7,r1) * is correct
addi r9,r1,STACK_FRAME_OVERHEAD */
ld r12,_MSR(r1) #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG)
#endif /* CONFIG_TRACE_IRQFLAGS */ lbz r10,PACASOFTIRQEN(r13)
li r10,1 xori r10,r10,1
stb r10,PACASOFTIRQEN(r13) 1: tdnei r10,0
stb r10,PACAHARDIRQEN(r13) EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
std r10,SOFTE(r1) #endif
/* Hard enable interrupts */
#ifdef CONFIG_PPC_BOOK3E #ifdef CONFIG_PPC_BOOK3E
wrteei 1 wrteei 1
#else #else
mfmsr r11 ld r11,PACAKMSR(r13)
ori r11,r11,MSR_EE ori r11,r11,MSR_EE
mtmsrd r11,1 mtmsrd r11,1
#endif /* CONFIG_PPC_BOOK3E */ #endif /* CONFIG_PPC_BOOK3E */
/* We do need to set SOFTE in the stack frame or the return
* from interrupt will be painful
*/
li r10,1
std r10,SOFTE(r1)
#ifdef SHOW_SYSCALLS #ifdef SHOW_SYSCALLS
bl .do_show_syscall bl .do_show_syscall
REST_GPR(0,r1) REST_GPR(0,r1)
...@@ -187,16 +192,14 @@ syscall_exit: ...@@ -187,16 +192,14 @@ syscall_exit:
andi. r10,r8,MSR_RI andi. r10,r8,MSR_RI
beq- unrecov_restore beq- unrecov_restore
#endif #endif
/*
/* Disable interrupts so current_thread_info()->flags can't change, * Disable interrupts so current_thread_info()->flags can't change,
* and so that we don't get interrupted after loading SRR0/1. * and so that we don't get interrupted after loading SRR0/1.
*/ */
#ifdef CONFIG_PPC_BOOK3E #ifdef CONFIG_PPC_BOOK3E
wrteei 0 wrteei 0
#else #else
mfmsr r10 ld r10,PACAKMSR(r13)
rldicl r10,r10,48,1
rotldi r10,r10,16
mtmsrd r10,1 mtmsrd r10,1
#endif /* CONFIG_PPC_BOOK3E */ #endif /* CONFIG_PPC_BOOK3E */
...@@ -308,7 +311,7 @@ syscall_exit_work: ...@@ -308,7 +311,7 @@ syscall_exit_work:
#ifdef CONFIG_PPC_BOOK3E #ifdef CONFIG_PPC_BOOK3E
wrteei 1 wrteei 1
#else #else
mfmsr r10 ld r10,PACAKMSR(r13)
ori r10,r10,MSR_EE ori r10,r10,MSR_EE
mtmsrd r10,1 mtmsrd r10,1
#endif /* CONFIG_PPC_BOOK3E */ #endif /* CONFIG_PPC_BOOK3E */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment