Skip to content

Commit a4719f5

Browse files
chleroympe
authored andcommitted
powerpc/32: Statically initialise first emergency context
The check of the emergency context initialisation in vmap_stack_overflow is buggy for the SMP case, as it compares r1 with 0 while in the SMP case r1 is offseted by the CPU id. Instead of fixing it, just perform static initialisation of the first emergency context. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/4a67ba422be75713286dca0c86ee0d3df2eb6dfa.1615552867.git.christophe.leroy@csgroup.eu
1 parent 9b6150f commit a4719f5

2 files changed

Lines changed: 2 additions & 6 deletions

File tree

‎arch/powerpc/kernel/head_32.h‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,11 +205,7 @@
205205
lis r1, emergency_ctx@ha
206206
#endif
207207
lwz r1, emergency_ctx@l(r1)
208-
cmpwi cr1, r1, 0
209-
bne cr1, 1f
210-
lis r1, init_thread_union@ha
211-
addi r1, r1, init_thread_union@l
212-
1: addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE
208+
addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE
213209
EXCEPTION_PROLOG_2
214210
SAVE_NVGPRS(r11)
215211
addi r3, r1, STACK_FRAME_OVERHEAD

‎arch/powerpc/kernel/setup_32.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void __init irqstack_early_init(void)
164164
}
165165

166166
#ifdef CONFIG_VMAP_STACK
167-
void *emergency_ctx[NR_CPUS] __ro_after_init;
167+
void *emergency_ctx[NR_CPUS] __ro_after_init = {[0] = &init_stack};
168168

169169
void __init emergency_stack_init(void)
170170
{

0 commit comments

Comments
 (0)