From: Zhen Lei Date: Thu, 25 Aug 2022 06:31:54 +0000 (+0100) Subject: ARM: 9232/1: Replace this_cpu_* with raw_cpu_* in handle_bad_stack() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=370d51c84216d1a41f125f0b04614e677ffe54e3;p=linux.git ARM: 9232/1: Replace this_cpu_* with raw_cpu_* in handle_bad_stack() The hardware automatically disable the IRQ interrupt before jumping to the interrupt or exception vector. Therefore, the preempt_disable() operation in this_cpu_read() after macro expansion is unnecessary. In fact, function this_cpu_read() may trigger scheduling, see pseudocode below. Pseudocode of this_cpu_read(xx): preempt_disable_notrace(); raw_cpu_read(xx); if (unlikely(__preempt_count_dec_and_test())) __preempt_schedule_notrace(); Therefore, use raw_cpu_* instead of this_cpu_* to eliminate potential hazards. At the very least, it reduces a few lines of assembly code. Signed-off-by: Zhen Lei Signed-off-by: Russell King (Oracle) --- diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 82fde11d6b8df..a24d26eaa2cb3 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -920,9 +920,9 @@ asmlinkage void handle_bad_stack(struct pt_regs *regs) { unsigned long tsk_stk = (unsigned long)current->stack; #ifdef CONFIG_IRQSTACKS - unsigned long irq_stk = (unsigned long)this_cpu_read(irq_stack_ptr); + unsigned long irq_stk = (unsigned long)raw_cpu_read(irq_stack_ptr); #endif - unsigned long ovf_stk = (unsigned long)this_cpu_read(overflow_stack_ptr); + unsigned long ovf_stk = (unsigned long)raw_cpu_read(overflow_stack_ptr); console_verbose(); pr_emerg("Insufficient stack space to handle exception!");