From b39b70366c5be68affe9777de72846540d840464 Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Fri, 8 Jun 2007 13:47:01 -0700 Subject: [PATCH] x86_64: oops_begin() fix We don't want to see this: > BUG: using smp_processor_id() in preemptible [00000001] code: bash/3857 > caller is oops_begin+0xb/0x6f > > Call Trace: > [] show_trace+0x34/0x4f > [] dump_stack+0x12/0x17 > [] debug_smp_processor_id+0xad/0xbc > [] oops_begin+0xb/0x6f > [] do_page_fault+0x66a/0x7c0 > [] error_exit+0x0/0x84 > coming out when the kernel is trying to oops. Cc: Andi Kleen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/x86_64/kernel/traps.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c index cb29fb96948d..aac1c0be54c6 100644 --- a/arch/x86_64/kernel/traps.c +++ b/arch/x86_64/kernel/traps.c @@ -465,13 +465,14 @@ static unsigned int die_nest_count; unsigned __kprobes long oops_begin(void) { - int cpu = smp_processor_id(); + int cpu; unsigned long flags; oops_enter(); /* racy, but better than risking deadlock. */ local_irq_save(flags); + cpu = smp_processor_id(); if (!spin_trylock(&die_lock)) { if (cpu == die_owner) /* nested oops. should stop eventually */; -- 2.20.1