All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: hpet: Fix HPET timer + NMI watchdog panic
@ 2010-12-29  1:57 Yan, Zheng
  2010-12-29  2:43 ` Yan, Zheng
  0 siblings, 1 reply; 4+ messages in thread
From: Yan, Zheng @ 2010-12-29  1:57 UTC (permalink / raw)
  To: linux-btrfs; +Cc: mingo, tglx

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.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>

---
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 55e4de6..cca94f2 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -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;
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index c90041c..cdb38d9 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -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
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 4ff5968..b536474c 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -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);
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index fb5cc5e1..2098c56 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -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)
 {


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: hpet: Fix HPET timer + NMI watchdog panic
  2010-12-29  1:57 Yan, Zheng
@ 2010-12-29  2:43 ` Yan, Zheng
  0 siblings, 0 replies; 4+ messages in thread
From: Yan, Zheng @ 2010-12-29  2:43 UTC (permalink / raw)
  To: linux-btrfs; +Cc: mingo, tglx

Sent this mail to wrong list, sorry for interrupting.

Yan, Zheng

On Wed, Dec 29, 2010 at 9:57 AM, Yan, Zheng <zheng.z.yan@linux.intel.co=
m> wrote:
> 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. Th=
is
> confuses NMI watchdog when using HPET as tick device.
>
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
>
> ---
> diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/ha=
rdirq.h
> index 55e4de6..cca94f2 100644
> --- a/arch/x86/include/asm/hardirq.h
> +++ b/arch/x86/include/asm/hardirq.h
> @@ -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
> +#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;
> diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
> index c90041c..cdb38d9 100644
> --- a/arch/x86/kernel/apic/nmi.c
> +++ b/arch/x86/kernel/apic/nmi.c
> @@ -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;
> +#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
> diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
> index 4ff5968..b536474c 100644
> --- a/arch/x86/kernel/hpet.c
> +++ b/arch/x86/kernel/hpet.c
> @@ -517,6 +517,7 @@ static irqreturn_t hpet_interrupt_handler(int irq=
, void *data)
> =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",
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dev->n=
um);
> diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
> index fb5cc5e1..2098c56 100644
> --- a/arch/x86/kernel/time.c
> +++ b/arch/x86/kernel/time.c
> @@ -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{
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs=
" in
> the body of a message to majordomo@vger.kernel.org
> 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 majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] x86: hpet: Fix HPET timer + NMI watchdog panic
@ 2010-12-29  2:44 Yan, Zheng
  2011-01-03 16:59 ` Don Zickus
  0 siblings, 1 reply; 4+ messages in thread
From: Yan, Zheng @ 2010-12-29  2:44 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, tglx, yanzheng

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.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>

---
diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
index 55e4de6..cca94f2 100644
--- a/arch/x86/include/asm/hardirq.h
+++ b/arch/x86/include/asm/hardirq.h
@@ -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;
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index c90041c..cdb38d9 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -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
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 4ff5968..b536474c 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -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);
diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
index fb5cc5e1..2098c56 100644
--- a/arch/x86/kernel/time.c
+++ b/arch/x86/kernel/time.c
@@ -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)
 {


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] x86: hpet: Fix HPET timer + NMI watchdog panic
  2010-12-29  2:44 [PATCH] x86: hpet: Fix HPET timer + NMI watchdog panic Yan, Zheng
@ 2011-01-03 16:59 ` Don Zickus
  0 siblings, 0 replies; 4+ messages in thread
From: Don Zickus @ 2011-01-03 16:59 UTC (permalink / raw)
  To: Yan, Zheng; +Cc: linux-kernel, mingo, tglx, yanzheng

On Wed, Dec 29, 2010 at 10:44:09AM +0800, Yan, Zheng wrote:
> 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.
> 
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>

Not sure if this patch is needed because x86/kerne/apic/nmi.c will most
likely disappear in 2.6.38 (it is already in gone in linux-next).  The new
nmi watchdog doesn't rely on HPET stats but instead uses a more generic
approach of a HRES timer.

Cheers,
Don

> 
> ---
> diff --git a/arch/x86/include/asm/hardirq.h b/arch/x86/include/asm/hardirq.h
> index 55e4de6..cca94f2 100644
> --- a/arch/x86/include/asm/hardirq.h
> +++ b/arch/x86/include/asm/hardirq.h
> @@ -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;
> diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
> index c90041c..cdb38d9 100644
> --- a/arch/x86/kernel/apic/nmi.c
> +++ b/arch/x86/kernel/apic/nmi.c
> @@ -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
> diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
> index 4ff5968..b536474c 100644
> --- a/arch/x86/kernel/hpet.c
> +++ b/arch/x86/kernel/hpet.c
> @@ -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);
> diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c
> index fb5cc5e1..2098c56 100644
> --- a/arch/x86/kernel/time.c
> +++ b/arch/x86/kernel/time.c
> @@ -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)
>  {
> 
> --
> 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-03 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-29  2:44 [PATCH] x86: hpet: Fix HPET timer + NMI watchdog panic Yan, Zheng
2011-01-03 16:59 ` Don Zickus
  -- strict thread matches above, loose matches on Subject: below --
2010-12-29  1:57 Yan, Zheng
2010-12-29  2:43 ` Yan, Zheng

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.