RE: nmi_watchdog fix for x86_64 to be more like i386

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Pallipadi, Venkatesh <venkatesh.pallipadi@...>
Cc: Andi Kleen <ak@...>, Arjan van de Ven <arjan@...>, David Bahi <dbahi@...>, LKML <linux-kernel@...>, <linux-rt-users@...>, Andrew Morton <akpm@...>, Ingo Molnar <mingo@...>, Gregory Haskins <GHaskins@...>
Date: Friday, October 5, 2007 - 4:37 pm

On Thu, 4 Oct 2007, Pallipadi, Venkatesh wrote:

No, I tried that. It's ugly.

The per cpu accounting is the correct way to go if we want to take
care of those systems, which ignore the CPU0 binding of irq0.

See patch against the x86 tree below.

	tglx

-------------------->
commit 093976c7ad206a008bd5de4619f40f6bca4a79c3
Author: Thomas Gleixner <tglx@inhelltoy.tec.linutronix.de>
Date:   Fri Oct 5 22:19:18 2007 +0200

    x86: Fix irq0 / local apic timer accounting
    
    The clock events merge introduced a change to the nmi watchdog code to
    handle the not longer increasing local apic timer count in the
    broadcast mode. This is fine for UP, but on SMP it pampers over a
    stuck CPU which is not handling the broadcast interrupt due to the
    unconditional sum up of local apic timer count and irq0 count.
    
    To cover all cases we need to keep track on which CPU irq0 is
    handled. In theory this is CPU#0 due to the explicit disabling of irq
    balancing for irq0, but there are systems which ignore this on the
    hardware level. The per cpu irq0 accounting allows us to remove the
    irq0 to CPU0 binding as well.
    
    Add a per cpu counter for irq0 and evaluate this instead of the global
    irq0 count in the nmi watchdog code.
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index c7227e2..95d3fc2 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -353,7 +353,8 @@ __kprobes int nmi_watchdog_tick(struct pt_regs * regs, unsigned reason)
 	 * Take the local apic timer and PIT/HPET into account. We don't
 	 * know which one is active, when we have highres/dyntick on
 	 */
-	sum = per_cpu(irq_stat, cpu).apic_timer_irqs + kstat_cpu(cpu).irqs[0];
+	sum = per_cpu(irq_stat, cpu).apic_timer_irqs +
+		per_cpu(irq_stat, cpu).irq0_irqs;
 
 	/* if the none of the timers isn't firing, this cpu isn't doing much */
 	if (!touched && last_irq_sums[cpu] == sum) {
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 19a6c67..3571d0a 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -157,6 +157,9 @@ EXPORT_SYMBOL(profile_pc);
  */
 irqreturn_t timer_interrupt(int irq, void *dev_id)
 {
+	/* Keep nmi watchdog up to date */
+	per_cpu(irq_stat, cpu).irq0_irqs++;
+
 #ifdef CONFIG_X86_IO_APIC
 	if (timer_ack) {
 		/*
diff --git a/include/asm-x86/hardirq_32.h b/include/asm-x86/hardirq_32.h
index ed7cf97..9188635 100644
--- a/include/asm-x86/hardirq_32.h
+++ b/include/asm-x86/hardirq_32.h
@@ -9,6 +9,7 @@ typedef struct {
 	unsigned long idle_timestamp;
 	unsigned int __nmi_count;	/* arch dependent */
 	unsigned int apic_timer_irqs;	/* arch dependent */
+	unsigned int irq0_irqs;
 } ____cacheline_aligned irq_cpustat_t;
 
 DECLARE_PER_CPU(irq_cpustat_t, irq_stat);

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

Messages in current thread:
nmi_watchdog fix for x86_64 to be more like i386, David Bahi, (Wed Sep 26, 2:03 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Mon Oct 1, 2:54 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Mon Oct 1, 3:27 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Arjan van de Ven, (Mon Oct 1, 3:56 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Mon Oct 1, 5:17 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Mon Oct 1, 5:58 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Mon Oct 1, 6:47 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Tue Oct 2, 2:18 am)
RE: nmi_watchdog fix for x86_64 to be more like i386, Pallipadi, Venkatesh, (Fri Oct 5, 12:37 am)
RE: nmi_watchdog fix for x86_64 to be more like i386, Thomas Gleixner, (Fri Oct 5, 4:37 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Mika Penttilä, (Tue Oct 2, 12:56 am)
Re: nmi_watchdog fix for x86_64 to be more like i386, Arjan van de Ven, (Tue Oct 2, 1:00 am)
Re: nmi_watchdog fix for x86_64 to be more like i386, Arjan van de Ven, (Mon Oct 1, 6:52 pm)
Re: nmi_watchdog fix for x86_64 to be more like i386, Paul E. McKenney, (Mon Oct 1, 4:11 pm)