From: santosh.shilimkar@ti.com (Santosh Shilimkar) Date: Wed, 14 Oct 2009 16:47:12 +0530 Subject: [PATCH] ARM: SMP: Fix the BUG with CONFIG_PREEMPT enabled Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org This patch fixes the BUG: using smp_processor_id() in preemptible Below is the stripped backtrace. BUG: using smp_processor_id() in preemptible [00000000] code: init/1 caller is flush_tlb_mm+0x44/0x70 Backtrace: [] (dump_backtrace+0x0/0x110) from [] (dump_stack+0x18/= 0x1c) r7:00000000 r6:c00234f0 r5:00000001 r4:c7828000 [] (dump_stack+0x0/0x1c) from [] (debug_smp_processor_i= d+0xc0/0xf0) [] (debug_smp_processor_id+0x0/0xf0) from [] (flush_tlb= _mm+0x44/0x70) r7:00000000 r6:c60b41a0 r5:c60b4154 r4:00000001 [] (flush_tlb_mm+0x0/0x70) from [] (dup_mm+0x304/0x38c) r5:c1f09058 r4:00000000 [] (dup_mm+0x0/0x38c) from [] (copy_process+0x7b8/0xeb0= ) [] (copy_process+0x0/0xeb0) from [] (do_fork+0x15c/0x29= c) [] (do_fork+0x0/0x29c) from [] (sys_clone+0x34/0x3c) [] (sys_clone+0x0/0x3c) from [] (ret_fast_syscall+0x0/0= x2c) Signed-off-by: Santosh Shilimkar --- arch/arm/include/asm/tlbflush.h | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflus= h.h index c964f3f..a0abf5c 100644 --- a/arch/arm/include/asm/tlbflush.h +++ b/arch/arm/include/asm/tlbflush.h @@ -350,7 +350,7 @@ static inline void local_flush_tlb_mm(struct mm_struct = *mm) if (tlb_flag(TLB_WB)) dsb(); =20 - if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) { + if (cpu_isset(get_cpu(), mm->cpu_vm_mask)) { if (tlb_flag(TLB_V3_FULL)) asm("mcr p15, 0, %0, c6, c0, 0" : : "r" (zero) : "cc"); if (tlb_flag(TLB_V4_U_FULL)) @@ -360,6 +360,7 @@ static inline void local_flush_tlb_mm(struct mm_struct = *mm) if (tlb_flag(TLB_V4_I_FULL)) asm("mcr p15, 0, %0, c8, c5, 0" : : "r" (zero) : "cc"); } + put_cpu(); =20 if (tlb_flag(TLB_V6_U_ASID)) asm("mcr p15, 0, %0, c8, c7, 2" : : "r" (asid) : "cc"); --=20 1.5.4.7 Regards, Santosh