diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-02-29 23:40:23 -0500 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2012-03-08 18:55:04 -0500 |
commit | 1421ae0b29e0003395613bf67610d15fb7047e09 (patch) | |
tree | 5a187df5b64d7f247e72fa26f69eb94cfbd7b8d3 | |
parent | fe1952fc0afb9a2e4c79f103c08aef5d13db1873 (diff) |
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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r-- | arch/powerpc/kernel/entry_64.S | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 0c3764ba8d49..cc030b73174b 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S | |||
@@ -115,28 +115,33 @@ BEGIN_FW_FTR_SECTION | |||
115 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) | 115 | END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR) |
116 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING && CONFIG_PPC_SPLPAR */ | 116 | #endif /* CONFIG_VIRT_CPU_ACCOUNTING && CONFIG_PPC_SPLPAR */ |
117 | 117 | ||
118 | #ifdef CONFIG_TRACE_IRQFLAGS | 118 | /* |
119 | bl .trace_hardirqs_on | 119 | * A syscall should always be called with interrupts enabled |
120 | REST_GPR(0,r1) | 120 | * so we just unconditionally hard-enable here. When some kind |
121 | REST_4GPRS(3,r1) | 121 | * of irq tracing is used, we additionally check that condition |
122 | REST_2GPRS(7,r1) | 122 | * is correct |
123 | addi r9,r1,STACK_FRAME_OVERHEAD | 123 | */ |
124 | ld r12,_MSR(r1) | 124 | #if defined(CONFIG_TRACE_IRQFLAGS) && defined(CONFIG_BUG) |
125 | #endif /* CONFIG_TRACE_IRQFLAGS */ | 125 | lbz r10,PACASOFTIRQEN(r13) |
126 | li r10,1 | 126 | xori r10,r10,1 |
127 | stb r10,PACASOFTIRQEN(r13) | 127 | 1: tdnei r10,0 |
128 | stb r10,PACAHARDIRQEN(r13) | 128 | EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING |
129 | std r10,SOFTE(r1) | 129 | #endif |
130 | 130 | ||
131 | /* Hard enable interrupts */ | ||
132 | #ifdef CONFIG_PPC_BOOK3E | 131 | #ifdef CONFIG_PPC_BOOK3E |
133 | wrteei 1 | 132 | wrteei 1 |
134 | #else | 133 | #else |
135 | mfmsr r11 | 134 | ld r11,PACAKMSR(r13) |
136 | ori r11,r11,MSR_EE | 135 | ori r11,r11,MSR_EE |
137 | mtmsrd r11,1 | 136 | mtmsrd r11,1 |
138 | #endif /* CONFIG_PPC_BOOK3E */ | 137 | #endif /* CONFIG_PPC_BOOK3E */ |
139 | 138 | ||
139 | /* We do need to set SOFTE in the stack frame or the return | ||
140 | * from interrupt will be painful | ||
141 | */ | ||
142 | li r10,1 | ||
143 | std r10,SOFTE(r1) | ||
144 | |||
140 | #ifdef SHOW_SYSCALLS | 145 | #ifdef SHOW_SYSCALLS |
141 | bl .do_show_syscall | 146 | bl .do_show_syscall |
142 | REST_GPR(0,r1) | 147 | REST_GPR(0,r1) |
@@ -187,16 +192,14 @@ syscall_exit: | |||
187 | andi. r10,r8,MSR_RI | 192 | andi. r10,r8,MSR_RI |
188 | beq- unrecov_restore | 193 | beq- unrecov_restore |
189 | #endif | 194 | #endif |
190 | 195 | /* | |
191 | /* Disable interrupts so current_thread_info()->flags can't change, | 196 | * Disable interrupts so current_thread_info()->flags can't change, |
192 | * and so that we don't get interrupted after loading SRR0/1. | 197 | * and so that we don't get interrupted after loading SRR0/1. |
193 | */ | 198 | */ |
194 | #ifdef CONFIG_PPC_BOOK3E | 199 | #ifdef CONFIG_PPC_BOOK3E |
195 | wrteei 0 | 200 | wrteei 0 |
196 | #else | 201 | #else |
197 | mfmsr r10 | 202 | ld r10,PACAKMSR(r13) |
198 | rldicl r10,r10,48,1 | ||
199 | rotldi r10,r10,16 | ||
200 | mtmsrd r10,1 | 203 | mtmsrd r10,1 |
201 | #endif /* CONFIG_PPC_BOOK3E */ | 204 | #endif /* CONFIG_PPC_BOOK3E */ |
202 | 205 | ||
@@ -308,7 +311,7 @@ syscall_exit_work: | |||
308 | #ifdef CONFIG_PPC_BOOK3E | 311 | #ifdef CONFIG_PPC_BOOK3E |
309 | wrteei 1 | 312 | wrteei 1 |
310 | #else | 313 | #else |
311 | mfmsr r10 | 314 | ld r10,PACAKMSR(r13) |
312 | ori r10,r10,MSR_EE | 315 | ori r10,r10,MSR_EE |
313 | mtmsrd r10,1 | 316 | mtmsrd r10,1 |
314 | #endif /* CONFIG_PPC_BOOK3E */ | 317 | #endif /* CONFIG_PPC_BOOK3E */ |