* [PATCH -rt] fix sysrq+l when nmi_watchdog disabled
@ 2008-05-27 22:45 ` Hiroshi Shimamoto
0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi Shimamoto @ 2008-05-27 22:45 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel, linux-rt-users
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
In nmi_show_all_regs(), set nmi_show_regs for all cpus but NMI never come
to itself when nmi_watchdog is disabled. It means the kernel hangs up when
sysrq+l is issued.
Call irq_show_regs_callback() itself before calling smp_send_nmi_allbutself().
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
Steven, this is a fix for what you pointed.
http://lkml.org/lkml/2008/4/28/455
arch/x86/kernel/nmi_32.c | 51 ++++++++++++++++++++++++++++------------------
arch/x86/kernel/nmi_64.c | 49 ++++++++++++++++++++++++++++---------------
2 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index d9266ea..82abc2a 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -325,21 +325,49 @@ extern void die_nmi(struct pt_regs *, const char *msg);
int nmi_show_regs[NR_CPUS];
+static DEFINE_RAW_SPINLOCK(nmi_print_lock);
+
+notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
+{
+ if (!nmi_show_regs[cpu])
+ return 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;
+}
+
void nmi_show_all_regs(void)
{
- int i;
+ struct pt_regs *regs;
+ int i, cpu;
if (system_state == SYSTEM_BOOTING)
return;
- printk(KERN_WARNING "nmi_show_all_regs(): start on CPU#%d.\n",
- raw_smp_processor_id());
+ preempt_disable();
+
+ regs = get_irq_regs();
+ cpu = smp_processor_id();
+
+ printk(KERN_WARNING "nmi_show_all_regs(): start on CPU#%d.\n", cpu);
dump_stack();
for_each_online_cpu(i)
nmi_show_regs[i] = 1;
+ if (regs)
+ irq_show_regs_callback(cpu, regs);
+ else
+ nmi_show_regs[cpu] = 0;
+
smp_send_nmi_allbutself();
+ preempt_enable();
for_each_online_cpu(i) {
while (nmi_show_regs[i] == 1)
@@ -347,23 +375,6 @@ void nmi_show_all_regs(void)
}
}
-static DEFINE_RAW_SPINLOCK(nmi_print_lock);
-
-notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
-{
- if (!nmi_show_regs[cpu])
- return 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;
-}
-
__kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
{
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index c802380..5e7e2b0 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -317,17 +317,48 @@ EXPORT_SYMBOL(touch_nmi_watchdog);
int nmi_show_regs[NR_CPUS];
+static DEFINE_RAW_SPINLOCK(nmi_print_lock);
+
+notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
+{
+ if (!nmi_show_regs[cpu])
+ return 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;
+}
+
void nmi_show_all_regs(void)
{
- int i;
+ struct pt_regs *regs;
+ int i, cpu;
if (system_state == SYSTEM_BOOTING)
return;
+ preempt_disable();
+
+ regs = get_irq_regs();
+ cpu = smp_processor_id();
+
+ printk(KERN_WARNING "nmi_show_all_regs(): start on CPU#%d.\n", cpu);
+ dump_stack();
+
for_each_online_cpu(i)
nmi_show_regs[i] = 1;
+ if (regs)
+ irq_show_regs_callback(cpu, regs);
+ else
+ nmi_show_regs[cpu] = 0;
+
smp_send_nmi_allbutself();
+ preempt_enable();
for_each_online_cpu(i) {
while (nmi_show_regs[i] == 1)
@@ -335,22 +366,6 @@ void nmi_show_all_regs(void)
}
}
-static DEFINE_RAW_SPINLOCK(nmi_print_lock);
-
-notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
-{
- if (!nmi_show_regs[cpu])
- return 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;
-}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH -rt] fix sysrq+l when nmi_watchdog disabled
@ 2008-05-27 22:45 ` Hiroshi Shimamoto
0 siblings, 0 replies; 3+ messages in thread
From: Hiroshi Shimamoto @ 2008-05-27 22:45 UTC (permalink / raw)
To: Steven Rostedt, Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel, linux-rt-users
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
In nmi_show_all_regs(), set nmi_show_regs for all cpus but NMI never come
to itself when nmi_watchdog is disabled. It means the kernel hangs up when
sysrq+l is issued.
Call irq_show_regs_callback() itself before calling smp_send_nmi_allbutself().
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---
Steven, this is a fix for what you pointed.
http://lkml.org/lkml/2008/4/28/455
arch/x86/kernel/nmi_32.c | 51 ++++++++++++++++++++++++++++------------------
arch/x86/kernel/nmi_64.c | 49 ++++++++++++++++++++++++++++---------------
2 files changed, 63 insertions(+), 37 deletions(-)
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index d9266ea..82abc2a 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -325,21 +325,49 @@ extern void die_nmi(struct pt_regs *, const char *msg);
int nmi_show_regs[NR_CPUS];
+static DEFINE_RAW_SPINLOCK(nmi_print_lock);
+
+notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
+{
+ if (!nmi_show_regs[cpu])
+ return 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;
+}
+
void nmi_show_all_regs(void)
{
- int i;
+ struct pt_regs *regs;
+ int i, cpu;
if (system_state == SYSTEM_BOOTING)
return;
- printk(KERN_WARNING "nmi_show_all_regs(): start on CPU#%d.\n",
- raw_smp_processor_id());
+ preempt_disable();
+
+ regs = get_irq_regs();
+ cpu = smp_processor_id();
+
+ printk(KERN_WARNING "nmi_show_all_regs(): start on CPU#%d.\n", cpu);
dump_stack();
for_each_online_cpu(i)
nmi_show_regs[i] = 1;
+ if (regs)
+ irq_show_regs_callback(cpu, regs);
+ else
+ nmi_show_regs[cpu] = 0;
+
smp_send_nmi_allbutself();
+ preempt_enable();
for_each_online_cpu(i) {
while (nmi_show_regs[i] == 1)
@@ -347,23 +375,6 @@ void nmi_show_all_regs(void)
}
}
-static DEFINE_RAW_SPINLOCK(nmi_print_lock);
-
-notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
-{
- if (!nmi_show_regs[cpu])
- return 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;
-}
-
__kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
{
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index c802380..5e7e2b0 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -317,17 +317,48 @@ EXPORT_SYMBOL(touch_nmi_watchdog);
int nmi_show_regs[NR_CPUS];
+static DEFINE_RAW_SPINLOCK(nmi_print_lock);
+
+notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
+{
+ if (!nmi_show_regs[cpu])
+ return 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;
+}
+
void nmi_show_all_regs(void)
{
- int i;
+ struct pt_regs *regs;
+ int i, cpu;
if (system_state == SYSTEM_BOOTING)
return;
+ preempt_disable();
+
+ regs = get_irq_regs();
+ cpu = smp_processor_id();
+
+ printk(KERN_WARNING "nmi_show_all_regs(): start on CPU#%d.\n", cpu);
+ dump_stack();
+
for_each_online_cpu(i)
nmi_show_regs[i] = 1;
+ if (regs)
+ irq_show_regs_callback(cpu, regs);
+ else
+ nmi_show_regs[cpu] = 0;
+
smp_send_nmi_allbutself();
+ preempt_enable();
for_each_online_cpu(i) {
while (nmi_show_regs[i] == 1)
@@ -335,22 +366,6 @@ void nmi_show_all_regs(void)
}
}
-static DEFINE_RAW_SPINLOCK(nmi_print_lock);
-
-notrace int irq_show_regs_callback(int cpu, struct pt_regs *regs)
-{
- if (!nmi_show_regs[cpu])
- return 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;
-}
-
int __kprobes nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
{
int sum;
--
1.5.4.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -rt] fix sysrq+l when nmi_watchdog disabled
2008-05-27 22:45 ` Hiroshi Shimamoto
(?)
@ 2008-05-27 23:36 ` Steven Rostedt
-1 siblings, 0 replies; 3+ messages in thread
From: Steven Rostedt @ 2008-05-27 23:36 UTC (permalink / raw)
To: Hiroshi Shimamoto
Cc: Ingo Molnar, Thomas Gleixner, linux-kernel, linux-rt-users
On Tue, 27 May 2008, Hiroshi Shimamoto wrote:
> From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
>
> In nmi_show_all_regs(), set nmi_show_regs for all cpus but NMI never come
> to itself when nmi_watchdog is disabled. It means the kernel hangs up when
> sysrq+l is issued.
>
> Call irq_show_regs_callback() itself before calling smp_send_nmi_allbutself().
Thanks,
I had a patch to do this fix but it got lost. I'll add yours.
-- Steve
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> ---
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-05-27 23:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-27 22:45 [PATCH -rt] fix sysrq+l when nmi_watchdog disabled Hiroshi Shimamoto
2008-05-27 22:45 ` Hiroshi Shimamoto
2008-05-27 23:36 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.