Skip to content

Commit 6db170f

Browse files
atishp04palmer-dabbelt
authored andcommitted
RISC-V: Disable preemption before enabling interrupts
Currently, irq is enabled before preemption disabling happens. If the scheduler fired right here and cpu is scheduled then it may blow up. Signed-off-by: Palmer Dabbelt <palmer@sifive.com> [Atish: Commit text and code comment formatting update] Signed-off-by: Atish Patra <atish.patra@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Palmer Dabbelt <palmer@sifive.com>
1 parent b18d6f0 commit 6db170f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

arch/riscv/kernel/smpboot.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ asmlinkage void __init smp_callin(void)
111111
* a local TLB flush right now just in case.
112112
*/
113113
local_flush_tlb_all();
114-
local_irq_enable();
114+
/*
115+
* Disable preemption before enabling interrupts, so we don't try to
116+
* schedule a CPU that hasn't actually started yet.
117+
*/
115118
preempt_disable();
119+
local_irq_enable();
116120
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
117121
}

0 commit comments

Comments
 (0)