Skip to content

Commit 286b3ff

Browse files
chleroygregkh
authored andcommitted
powerpc/32: Statically initialise first emergency context
[ Upstream commit a4719f5 ] 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 Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent b9f9313 commit 286b3ff

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
@@ -338,11 +338,7 @@
338338
lis r1, emergency_ctx@ha
339339
#endif
340340
lwz r1, emergency_ctx@l(r1)
341-
cmpwi cr1, r1, 0
342-
bne cr1, 1f
343-
lis r1, init_thread_union@ha
344-
addi r1, r1, init_thread_union@l
345-
1: addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE
341+
addi r1, r1, THREAD_SIZE - INT_FRAME_SIZE
346342
EXCEPTION_PROLOG_2
347343
SAVE_NVGPRS(r11)
348344
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)