Skip to contentSkip to conversation

x86: hpet: Fix HPET timer + NMI watchdog panic

PATCH In review Yan, Zheng 1 participant 2 messages Dec 29, 2010

Subsystems (3)
lore
Share & tools
lore

Yan, Zheng

author
#0 lore raw

PATCH 1/1 x86: hpet: Fix HPET timer + NMI watchdog panic

HPET doesn't use timer_interrupt() as interrupt handler now. So count of HPET interrupt isn't recorded in per_cpu(irq_stat, cpu).irq0_irqs. This confuses NMI watchdog when using HPET as tick device.

---

arch/x86/include/asm/hardirq.h +3 -0
index 55e4de6..cca94f2 100644
@@ -12,6 +12,9 @@ typedef struct {
 	unsigned int apic_timer_irqs;	/* arch dependent */
 	unsigned int irq_spurious_count;
 #endif
+#ifdef CONFIG_HPET_TIMER
+	unsigned int hpet_timer_irqs;
+#endif
 	unsigned int x86_platform_ipis;	/* arch dependent */
 	unsigned int apic_perf_irqs;
 	unsigned int apic_irq_work_irqs;
arch/x86/kernel/apic/nmi.c +8 -1
index c90041c..cdb38d9 100644
@@ -80,8 +80,15 @@ static inline int mce_in_progress(void)
  */
 static inline unsigned int get_timer_irqs(int cpu)
 {
-	return per_cpu(irq_stat, cpu).apic_timer_irqs +
+	unsigned int irqs; 
+#ifdef CONFIG_HPET_TIMER
+	irqs = per_cpu(irq_stat, cpu).hpet_timer_irqs;
+#else
+	irqs = 0;
+#endif
+	irqs += per_cpu(irq_stat, cpu).apic_timer_irqs +
 		per_cpu(irq_stat, cpu).irq0_irqs;
+	return irqs;
 }
 
 #ifdef CONFIG_SMP
arch/x86/kernel/hpet.c +1 -0
index 4ff5968..b536474c 100644
@@ -517,6 +517,7 @@ static irqreturn_t hpet_interrupt_handler(int irq, void *data)
 	struct hpet_dev *dev = (struct hpet_dev *)data;
 	struct clock_event_device *hevt = &dev->evt;
 
+	inc_irq_stat(hpet_timer_irqs);
 	if (!hevt->event_handler) {
 		printk(KERN_INFO "Spurious HPET timer interrupt on HPET timer %d\n",
 				dev->num);
arch/x86/kernel/time.c +1 -1
index fb5cc5e1..2098c56 100644
@@ -56,7 +56,7 @@ unsigned long profile_pc(struct pt_regs *regs)
 EXPORT_SYMBOL(profile_pc);
 
 /*
- * Default timer interrupt handler for PIT/HPET
+ * Default timer interrupt handler for PIT
  */
 static irqreturn_t timer_interrupt(int irq, void *dev_id)
 {
author
#1 lore raw

Sent this mail to wrong list, sorry for interrupting.

Yan, Zheng

Quoted 1 line · Zheng

HPET doesn't use timer_interrupt() as interrupt handler now. So count=

of

Quoted 1 line

HPET interrupt isn't recorded in per_cpu(irq_stat, cpu).irq0_irqs. Th=

is

arch/x86/include/asm/ha=

Quoted 6 lines

confuses NMI watchdog when using HPET as tick device.

---

arch/x86/include/asm/ha= renamed from arch/x86/include/asm/hardirq.h +0 -0

rdirq.h

arch/x86/kernel/hpet.c static irqreturn_t hpet_interrupt_handler(int irq=

Quoted 39 lines

index 55e4de6..cca94f2 100644

arch/x86/include/asm/hardirq.h +0 -0
@@ -12,6 +12,9 @@ typedef struct {

=A0 =A0 =A0 =A0unsigned int apic_timer_irqs; =A0 /* arch dependent */ =A0 =A0 =A0 =A0unsigned int irq_spurious_count;
=A0#endif

arch/x86/include/asm/hardirq.h +3 -0
+#ifdef CONFIG_HPET_TIMER
+ =A0 =A0 =A0 unsigned int hpet_timer_irqs;
+#endif

=A0 =A0 =A0 =A0unsigned int x86_platform_ipis; /* arch dependent */ =A0 =A0 =A0 =A0unsigned int apic_perf_irqs;
=A0 =A0 =A0 =A0unsigned int apic_irq_work_irqs;

arch/x86/kernel/apic/nmi.c +0 -0
index c90041c..cdb38d9 100644
@@ -80,8 +80,15 @@ static inline int mce_in_progress(void)

=A0*/
=A0static inline unsigned int get_timer_irqs(int cpu) =A0{
- =A0 =A0 =A0 return per_cpu(irq_stat, cpu).apic_timer_irqs +
+ =A0 =A0 =A0 unsigned int irqs;

arch/x86/kernel/apic/nmi.c +6 -0
+#ifdef CONFIG_HPET_TIMER
+ =A0 =A0 =A0 irqs =3D per_cpu(irq_stat, cpu).hpet_timer_irqs;
+#else
+ =A0 =A0 =A0 irqs =3D 0;
+#endif
+ =A0 =A0 =A0 irqs +=3D per_cpu(irq_stat, cpu).apic_timer_irqs +

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0per_cpu(irq_stat, cpu).irq0_irqs;
+ =A0 =A0 =A0 return irqs;
=A0}

=A0#ifdef CONFIG_SMP

arch/x86/kernel/hpet.c +0 -0
index 4ff5968..b536474c 100644
@@ -517,6 +517,7 @@ static irqreturn_t hpet_interrupt_handler(int irq=

, void *data)

Quoted 6 lines
arch/x86/kernel/hpet.c +1 -0
 =A0 =A0 =A0 =A0struct hpet_dev *dev =3D (struct hpet_dev *)data;
 =A0 =A0 =A0 =A0struct clock_event_device *hevt =3D &dev->evt;
 
+ =A0 =A0 =A0 inc_irq_stat(hpet_timer_irqs);
 =A0 =A0 =A0 =A0if (!hevt->event_handler) {

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printk(KERN_INFO "Spurious HPET timer =

interrupt on HPET timer %d\n",

Quoted 1 line

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dev->n=

um);

Quoted 14 lines
arch/x86/kernel/time.c +0 -0
index fb5cc5e1..2098c56 100644
@@ -56,7 +56,7 @@ unsigned long profile_pc(struct pt_regs *regs)
 =A0EXPORT_SYMBOL(profile_pc);
 

=A0/*
- * Default timer interrupt handler for PIT/HPET
+ * Default timer interrupt handler for PIT
=A0*/
=A0static irqreturn_t timer_interrupt(int irq, void *dev_id) =A0{

Quoted 2 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs=

" in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at =A0http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" = in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html