[PATCH -rt 4/4] wait for finish show_regs() before panic

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Ingo Molnar <mingo@...>, Steven Rostedt <rostedt@...>, Thomas Gleixner <tglx@...>
Cc: <linux-kernel@...>, <linux-rt-users@...>
Date: Monday, April 28, 2008 - 2:19 pm

From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

It might cause kdump failure that the kernel doesn't wait for finish
show_regs(). The nmi_show_regs variable for show_regs() flag is cleared
before show_regs() is really called. This flag should be cleared after
show_regs().
kdump stops all CPUs other than crashing CPU by NMI handler, but if
show_regs() takes a bit time, kdump cannot wait and will continue process.
It means that the 2nd kernel and the old kernel run simultaneously and it
might cause unexpected behavior, such as randomly reboot.

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Signed-off-by: Maxim Uvarov <muvarov@ru.mvista.com>
---
 arch/x86/kernel/nmi_32.c |    2 +-
 arch/x86/kernel/nmi_64.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index d1f92ca..f46bb6e 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -355,13 +355,13 @@ notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
 	if (!nmi_show_regs[cpu])
 		return 0;
 
-	nmi_show_regs[cpu] = 0;
 	spin_lock(&nmi_print_lock);
 	printk(KERN_WARNING "NMI show regs on CPU#%d:\n", cpu);
 	printk(KERN_WARNING "apic_timer_irqs: %d\n",
 		per_cpu(irq_stat, cpu).apic_timer_irqs);
 	show_regs(regs);
 	spin_unlock(&nmi_print_lock);
+	nmi_show_regs[cpu] = 0;
 	return 1;
 }
 
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index afc0317..8bc2328 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -345,12 +345,12 @@ notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
 	if (!nmi_show_regs[cpu])
 		return 0;
 
-	nmi_show_regs[cpu] = 0;
 	spin_lock(&nmi_print_lock);
 	printk(KERN_WARNING "NMI show regs on CPU#%d:\n", cpu);
 	printk(KERN_WARNING "apic_timer_irqs: %d\n", read_pda(apic_timer_irqs));
 	show_regs(regs);
 	spin_unlock(&nmi_print_lock);
+	nmi_show_regs[cpu] = 0;
 	return 1;
 }
 
-- 
1.5.4.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH -rt 0/4] nmi_watchdog fixes for -rt, Hiroshi Shimamoto, (Mon Apr 28, 2:10 pm)
Re: [PATCH -rt 0/4] nmi_watchdog fixes for -rt, Steven Rostedt, (Mon Apr 28, 3:03 pm)
[PATCH -rt 4/4] wait for finish show_regs() before panic, Hiroshi Shimamoto, (Mon Apr 28, 2:19 pm)
[PATCH -rt 3/4] x86: nmi_watchdog NMI needed for irq_show_re..., Hiroshi Shimamoto, (Mon Apr 28, 2:17 pm)
[PATCH -rt 2/4] x86: return true for NMI handled, Hiroshi Shimamoto, (Mon Apr 28, 2:16 pm)
[PATCH -rt 1/4] x86_64: send NMI after nmi_show_regs on, Hiroshi Shimamoto, (Mon Apr 28, 2:14 pm)
Re: [PATCH -rt 1/4] x86_64: send NMI after nmi_show_regs on, Hiroshi Shimamoto, (Mon Apr 28, 5:34 pm)