From: Hiroshi Shimamoto

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
Signed-off-by: Maxim Uvarov
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/