public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86: cleanups to nmi_watchdog variable
@ 2008-06-07 15:45 Németh Márton
  2008-06-07 16:32 ` Cyrill Gorcunov
  2008-06-08 15:56 ` Cyrill Gorcunov
  0 siblings, 2 replies; 6+ messages in thread
From: Németh Márton @ 2008-06-07 15:45 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar; +Cc: LKML

From: Márton Németh <nm127@freemail.hu>

Use NMI_NONE instead of 0. As the symbol NMI_DISABLED equals to -1,
the nmi_watchdog variable should also be signed.

Signed-off-by: Márton Németh <nm127@freemail.hu>
---
diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c
--- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c	2008-06-07 12:35:24.000000000 +0200
+++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c	2008-06-07 12:40:20.000000000 +0200
@@ -2217,7 +2217,7 @@ static inline void __init check_timer(vo

 	if (nmi_watchdog == NMI_IO_APIC) {
 		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
-		nmi_watchdog = 0;
+		nmi_watchdog = NMI_NONE;
 	}

 	printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c
--- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c	2008-06-05 18:39:49.000000000 +0200
+++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c	2008-06-07 12:37:01.000000000 +0200
@@ -1735,7 +1735,7 @@ static inline void __init check_timer(vo

 	if (nmi_watchdog == NMI_IO_APIC) {
 		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
-		nmi_watchdog = 0;
+		nmi_watchdog = NMI_NONE;
 	}

 	apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c
--- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c	2008-06-05 18:39:49.000000000 +0200
+++ linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c	2008-06-07 11:19:55.000000000 +0200
@@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
  */
 atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */

-unsigned int nmi_watchdog = NMI_DEFAULT;
+int nmi_watchdog = NMI_DEFAULT;
 static unsigned int nmi_hz = HZ;

 static DEFINE_PER_CPU(short, wd_enabled);
diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c
--- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c	2008-06-05 18:39:49.000000000 +0200
+++ linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c	2008-06-07 11:20:00.000000000 +0200
@@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
 atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
 static int panic_on_timeout;

-unsigned int nmi_watchdog = NMI_DEFAULT;
+int nmi_watchdog = NMI_DEFAULT;
 static unsigned int nmi_hz = HZ;

 static DEFINE_PER_CPU(short, wd_enabled);
diff -upr linux-2.6.26-rc5.orig/include/asm-x86/nmi.h linux-2.6.26-rc5/include/asm-x86/nmi.h
--- linux-2.6.26-rc5.orig/include/asm-x86/nmi.h	2008-06-05 18:40:12.000000000 +0200
+++ linux-2.6.26-rc5/include/asm-x86/nmi.h	2008-06-07 11:21:20.000000000 +0200
@@ -61,7 +61,7 @@ extern void enable_timer_nmi_watchdog(vo
 extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);

 extern atomic_t nmi_active;
-extern unsigned int nmi_watchdog;
+extern int nmi_watchdog;
 #define NMI_DISABLED    -1
 #define NMI_NONE	0
 #define NMI_IO_APIC	1

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

* Re: [PATCH] x86: cleanups to nmi_watchdog variable
  2008-06-07 15:45 [PATCH] x86: cleanups to nmi_watchdog variable Németh Márton
@ 2008-06-07 16:32 ` Cyrill Gorcunov
  2008-06-08 15:56 ` Cyrill Gorcunov
  1 sibling, 0 replies; 6+ messages in thread
From: Cyrill Gorcunov @ 2008-06-07 16:32 UTC (permalink / raw)
  To: =?ISO-8859-2?Q?N=E9meth_M=E1rton_, ?=; +Cc: Thomas Gleixner, Ingo Molnar, LKML

[=?ISO-8859-2?Q?N=E9meth_M=E1rton_ - Sat, Jun 07, 2008 at 05:45:15PM +0200]
| From: Márton Németh <nm127@freemail.hu>
| 
| Use NMI_NONE instead of 0. As the symbol NMI_DISABLED equals to -1,
| the nmi_watchdog variable should also be signed.
| 
| Signed-off-by: Márton Németh <nm127@freemail.hu>
| ---
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c	2008-06-07 12:35:24.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c	2008-06-07 12:40:20.000000000 +0200
| @@ -2217,7 +2217,7 @@ static inline void __init check_timer(vo
| 
|  	if (nmi_watchdog == NMI_IO_APIC) {
|  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
| -		nmi_watchdog = 0;
| +		nmi_watchdog = NMI_NONE;
|  	}
| 
|  	printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c	2008-06-05 18:39:49.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c	2008-06-07 12:37:01.000000000 +0200
| @@ -1735,7 +1735,7 @@ static inline void __init check_timer(vo
| 
|  	if (nmi_watchdog == NMI_IO_APIC) {
|  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
| -		nmi_watchdog = 0;
| +		nmi_watchdog = NMI_NONE;
|  	}
| 
|  	apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c	2008-06-05 18:39:49.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c	2008-06-07 11:19:55.000000000 +0200
| @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
|   */
|  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
| 
| -unsigned int nmi_watchdog = NMI_DEFAULT;
| +int nmi_watchdog = NMI_DEFAULT;
|  static unsigned int nmi_hz = HZ;
| 
|  static DEFINE_PER_CPU(short, wd_enabled);
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c	2008-06-05 18:39:49.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c	2008-06-07 11:20:00.000000000 +0200
| @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
|  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
|  static int panic_on_timeout;
| 
| -unsigned int nmi_watchdog = NMI_DEFAULT;
| +int nmi_watchdog = NMI_DEFAULT;
|  static unsigned int nmi_hz = HZ;
| 
|  static DEFINE_PER_CPU(short, wd_enabled);
| diff -upr linux-2.6.26-rc5.orig/include/asm-x86/nmi.h linux-2.6.26-rc5/include/asm-x86/nmi.h
| --- linux-2.6.26-rc5.orig/include/asm-x86/nmi.h	2008-06-05 18:40:12.000000000 +0200
| +++ linux-2.6.26-rc5/include/asm-x86/nmi.h	2008-06-07 11:21:20.000000000 +0200
| @@ -61,7 +61,7 @@ extern void enable_timer_nmi_watchdog(vo
|  extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
| 
|  extern atomic_t nmi_active;
| -extern unsigned int nmi_watchdog;
| +extern int nmi_watchdog;
|  #define NMI_DISABLED    -1
|  #define NMI_NONE	0
|  #define NMI_IO_APIC	1
| 

Good catch! Actually 0 -> NMI_NONE change already in -tip tree.
Sign/signess mark - is good to be investigated. Thanks!

		- Cyrill -

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

* Re: [PATCH] x86: cleanups to nmi_watchdog variable
  2008-06-07 15:45 [PATCH] x86: cleanups to nmi_watchdog variable Németh Márton
  2008-06-07 16:32 ` Cyrill Gorcunov
@ 2008-06-08 15:56 ` Cyrill Gorcunov
  2008-06-08 16:23   ` Németh Márton
  1 sibling, 1 reply; 6+ messages in thread
From: Cyrill Gorcunov @ 2008-06-08 15:56 UTC (permalink / raw)
  To: nm127; +Cc: Thomas Gleixner, Ingo Molnar, LKML


| From: Márton Németh <nm127@freemail.hu>
| 
| Use NMI_NONE instead of 0. As the symbol NMI_DISABLED equals to -1,
| the nmi_watchdog variable should also be signed.
| 
| Signed-off-by: Márton Németh <nm127@freemail.hu>
| ---
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c	2008-06-07 12:35:24.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c	2008-06-07 12:40:20.000000000 +0200
| @@ -2217,7 +2217,7 @@ static inline void __init check_timer(vo
| 
|  	if (nmi_watchdog == NMI_IO_APIC) {
|  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
| -		nmi_watchdog = 0;
| +		nmi_watchdog = NMI_NONE;
|  	}
| 
|  	printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c	2008-06-05 18:39:49.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c	2008-06-07 12:37:01.000000000 +0200
| @@ -1735,7 +1735,7 @@ static inline void __init check_timer(vo
| 
|  	if (nmi_watchdog == NMI_IO_APIC) {
|  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
| -		nmi_watchdog = 0;
| +		nmi_watchdog = NMI_NONE;
|  	}
| 
|  	apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c	2008-06-05 18:39:49.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c	2008-06-07 11:19:55.000000000 +0200
| @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
|   */
|  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
| 
| -unsigned int nmi_watchdog = NMI_DEFAULT;
| +int nmi_watchdog = NMI_DEFAULT;
|  static unsigned int nmi_hz = HZ;
| 
|  static DEFINE_PER_CPU(short, wd_enabled);
| diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c
| --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c	2008-06-05 18:39:49.000000000 +0200
| +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c	2008-06-07 11:20:00.000000000 +0200
| @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
|  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
|  static int panic_on_timeout;
| 
| -unsigned int nmi_watchdog = NMI_DEFAULT;
| +int nmi_watchdog = NMI_DEFAULT;
|  static unsigned int nmi_hz = HZ;
| 
|  static DEFINE_PER_CPU(short, wd_enabled);
| diff -upr linux-2.6.26-rc5.orig/include/asm-x86/nmi.h linux-2.6.26-rc5/include/asm-x86/nmi.h
| --- linux-2.6.26-rc5.orig/include/asm-x86/nmi.h	2008-06-05 18:40:12.000000000 +0200
| +++ linux-2.6.26-rc5/include/asm-x86/nmi.h	2008-06-07 11:21:20.000000000 +0200
| @@ -61,7 +61,7 @@ extern void enable_timer_nmi_watchdog(vo
|  extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
| 
|  extern atomic_t nmi_active;
| -extern unsigned int nmi_watchdog;
| +extern int nmi_watchdog;
|  #define NMI_DISABLED    -1
|  #define NMI_NONE	0
|  #define NMI_IO_APIC	1
| 

We should leave nmi_watchdog as unsigned. The only snippet which
could be reviewed as controversy point  - is touch_nmi_watchdog()
where we just test nmi_watchdog for being greater than 0. Actually
there NMI_NONE should be used instead. But frankly some additional
simplification is needed.

		- Cyrill -

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

* Re: [PATCH] x86: cleanups to nmi_watchdog variable
  2008-06-08 15:56 ` Cyrill Gorcunov
@ 2008-06-08 16:23   ` Németh Márton
  2008-06-08 16:31     ` Cyrill Gorcunov
  2008-06-08 20:28     ` Cyrill Gorcunov
  0 siblings, 2 replies; 6+ messages in thread
From: Németh Márton @ 2008-06-08 16:23 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: Thomas Gleixner, Ingo Molnar, LKML

Cyrill Gorcunov wrote:
> | From: Márton Németh <nm127@freemail.hu>
> | 
> | Use NMI_NONE instead of 0. As the symbol NMI_DISABLED equals to -1,
> | the nmi_watchdog variable should also be signed.
> | 
> | Signed-off-by: Márton Németh <nm127@freemail.hu>
> | ---
> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c
> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c	2008-06-07 12:35:24.000000000 +0200
> | +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c	2008-06-07 12:40:20.000000000 +0200
> | @@ -2217,7 +2217,7 @@ static inline void __init check_timer(vo
> | 
> |  	if (nmi_watchdog == NMI_IO_APIC) {
> |  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
> | -		nmi_watchdog = 0;
> | +		nmi_watchdog = NMI_NONE;
> |  	}
> | 
> |  	printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c
> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c	2008-06-05 18:39:49.000000000 +0200
> | +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c	2008-06-07 12:37:01.000000000 +0200
> | @@ -1735,7 +1735,7 @@ static inline void __init check_timer(vo
> | 
> |  	if (nmi_watchdog == NMI_IO_APIC) {
> |  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
> | -		nmi_watchdog = 0;
> | +		nmi_watchdog = NMI_NONE;
> |  	}
> | 
> |  	apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c
> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c	2008-06-05 18:39:49.000000000 +0200
> | +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c	2008-06-07 11:19:55.000000000 +0200
> | @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
> |   */
> |  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
> | 
> | -unsigned int nmi_watchdog = NMI_DEFAULT;
> | +int nmi_watchdog = NMI_DEFAULT;
> |  static unsigned int nmi_hz = HZ;
> | 
> |  static DEFINE_PER_CPU(short, wd_enabled);
> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c
> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c	2008-06-05 18:39:49.000000000 +0200
> | +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c	2008-06-07 11:20:00.000000000 +0200
> | @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
> |  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
> |  static int panic_on_timeout;
> | 
> | -unsigned int nmi_watchdog = NMI_DEFAULT;
> | +int nmi_watchdog = NMI_DEFAULT;
> |  static unsigned int nmi_hz = HZ;
> | 
> |  static DEFINE_PER_CPU(short, wd_enabled);
> | diff -upr linux-2.6.26-rc5.orig/include/asm-x86/nmi.h linux-2.6.26-rc5/include/asm-x86/nmi.h
> | --- linux-2.6.26-rc5.orig/include/asm-x86/nmi.h	2008-06-05 18:40:12.000000000 +0200
> | +++ linux-2.6.26-rc5/include/asm-x86/nmi.h	2008-06-07 11:21:20.000000000 +0200
> | @@ -61,7 +61,7 @@ extern void enable_timer_nmi_watchdog(vo
> |  extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
> | 
> |  extern atomic_t nmi_active;
> | -extern unsigned int nmi_watchdog;
> | +extern int nmi_watchdog;
> |  #define NMI_DISABLED    -1
> |  #define NMI_NONE	0
> |  #define NMI_IO_APIC	1
> | 
> 
> We should leave nmi_watchdog as unsigned. The only snippet which
> could be reviewed as controversy point  - is touch_nmi_watchdog()
> where we just test nmi_watchdog for being greater than 0. Actually
> there NMI_NONE should be used instead. But frankly some additional
> simplification is needed.

Don't forget that the NMI_DEFAULT symbol in include/asm-x86/nmi.h also equals to
NMI_DISABLED, which is -1.

	Márton Németh


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

* Re: [PATCH] x86: cleanups to nmi_watchdog variable
  2008-06-08 16:23   ` Németh Márton
@ 2008-06-08 16:31     ` Cyrill Gorcunov
  2008-06-08 20:28     ` Cyrill Gorcunov
  1 sibling, 0 replies; 6+ messages in thread
From: Cyrill Gorcunov @ 2008-06-08 16:31 UTC (permalink / raw)
  To: nm127; +Cc: Thomas Gleixner, Ingo Molnar, LKML

[=?ISO-8859-1?Q?N=E9meth_M=E1rton_ - Sun, Jun 08, 2008 at 06:23:38PM +0200]
| Cyrill Gorcunov wrote:
| > | From: Márton Németh <nm127@freemail.hu>
| > | 
| > | Use NMI_NONE instead of 0. As the symbol NMI_DISABLED equals to -1,
| > | the nmi_watchdog variable should also be signed.
| > | 
| > | Signed-off-by: Márton Németh <nm127@freemail.hu>
| > | ---
| > | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c
| > | --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c	2008-06-07 12:35:24.000000000 +0200
| > | +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c	2008-06-07 12:40:20.000000000 +0200
| > | @@ -2217,7 +2217,7 @@ static inline void __init check_timer(vo
| > | 
| > |  	if (nmi_watchdog == NMI_IO_APIC) {
| > |  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
| > | -		nmi_watchdog = 0;
| > | +		nmi_watchdog = NMI_NONE;
| > |  	}
| > | 
| > |  	printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
| > | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c
| > | --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c	2008-06-05 18:39:49.000000000 +0200
| > | +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c	2008-06-07 12:37:01.000000000 +0200
| > | @@ -1735,7 +1735,7 @@ static inline void __init check_timer(vo
| > | 
| > |  	if (nmi_watchdog == NMI_IO_APIC) {
| > |  		printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n");
| > | -		nmi_watchdog = 0;
| > | +		nmi_watchdog = NMI_NONE;
| > |  	}
| > | 
| > |  	apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
| > | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c
| > | --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c	2008-06-05 18:39:49.000000000 +0200
| > | +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c	2008-06-07 11:19:55.000000000 +0200
| > | @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
| > |   */
| > |  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
| > | 
| > | -unsigned int nmi_watchdog = NMI_DEFAULT;
| > | +int nmi_watchdog = NMI_DEFAULT;
| > |  static unsigned int nmi_hz = HZ;
| > | 
| > |  static DEFINE_PER_CPU(short, wd_enabled);
| > | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c
| > | --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c	2008-06-05 18:39:49.000000000 +0200
| > | +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c	2008-06-07 11:20:00.000000000 +0200
| > | @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
| > |  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
| > |  static int panic_on_timeout;
| > | 
| > | -unsigned int nmi_watchdog = NMI_DEFAULT;
| > | +int nmi_watchdog = NMI_DEFAULT;
| > |  static unsigned int nmi_hz = HZ;
| > | 
| > |  static DEFINE_PER_CPU(short, wd_enabled);
| > | diff -upr linux-2.6.26-rc5.orig/include/asm-x86/nmi.h linux-2.6.26-rc5/include/asm-x86/nmi.h
| > | --- linux-2.6.26-rc5.orig/include/asm-x86/nmi.h	2008-06-05 18:40:12.000000000 +0200
| > | +++ linux-2.6.26-rc5/include/asm-x86/nmi.h	2008-06-07 11:21:20.000000000 +0200
| > | @@ -61,7 +61,7 @@ extern void enable_timer_nmi_watchdog(vo
| > |  extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
| > | 
| > |  extern atomic_t nmi_active;
| > | -extern unsigned int nmi_watchdog;
| > | +extern int nmi_watchdog;
| > |  #define NMI_DISABLED    -1
| > |  #define NMI_NONE	0
| > |  #define NMI_IO_APIC	1
| > | 
| > 
| > We should leave nmi_watchdog as unsigned. The only snippet which
| > could be reviewed as controversy point  - is touch_nmi_watchdog()
| > where we just test nmi_watchdog for being greater than 0. Actually
| > there NMI_NONE should be used instead. But frankly some additional
| > simplification is needed.
| 
| Don't forget that the NMI_DEFAULT symbol in include/asm-x86/nmi.h also equals to
| NMI_DISABLED, which is -1.
| 
| 	Márton Németh
| 

yes, i know

		- Cyrill -

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

* Re: [PATCH] x86: cleanups to nmi_watchdog variable
  2008-06-08 16:23   ` Németh Márton
  2008-06-08 16:31     ` Cyrill Gorcunov
@ 2008-06-08 20:28     ` Cyrill Gorcunov
  1 sibling, 0 replies; 6+ messages in thread
From: Cyrill Gorcunov @ 2008-06-08 20:28 UTC (permalink / raw)
  To: Németh Márton, Thomas Gleixner, Ingo Molnar, LKML

Btw, if you interested to clean it up (which means not cleanup in real
:) i suggest to analize _if_ there is benefit from sign changing. Mark
that -1 is the 0xff... form of presentation for unsigned type. And
thanks for catching this. It defenitely should be simplified once.

On 6/8/08, Németh Márton <nm127@freemail.hu> wrote:
> Cyrill Gorcunov wrote:
>> | From: Márton Németh <nm127@freemail.hu>
>> |
>> | Use NMI_NONE instead of 0. As the symbol NMI_DISABLED equals to -1,
>> | the nmi_watchdog variable should also be signed.
>> |
>> | Signed-off-by: Márton Németh <nm127@freemail.hu>
>> | ---
>> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c
>> linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c
>> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_32.c	2008-06-07
>> 12:35:24.000000000 +0200
>> | +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_32.c	2008-06-07
>> 12:40:20.000000000 +0200
>> | @@ -2217,7 +2217,7 @@ static inline void __init check_timer(vo
>> |
>> |  	if (nmi_watchdog == NMI_IO_APIC) {
>> |  		printk(KERN_WARNING "timer doesn't work through the IO-APIC -
>> disabling NMI Watchdog!\n");
>> | -		nmi_watchdog = 0;
>> | +		nmi_watchdog = NMI_NONE;
>> |  	}
>> |
>> |  	printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
>> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c
>> linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c
>> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/io_apic_64.c	2008-06-05
>> 18:39:49.000000000 +0200
>> | +++ linux-2.6.26-rc5/arch/x86/kernel/io_apic_64.c	2008-06-07
>> 12:37:01.000000000 +0200
>> | @@ -1735,7 +1735,7 @@ static inline void __init check_timer(vo
>> |
>> |  	if (nmi_watchdog == NMI_IO_APIC) {
>> |  		printk(KERN_WARNING "timer doesn't work through the IO-APIC -
>> disabling NMI Watchdog!\n");
>> | -		nmi_watchdog = 0;
>> | +		nmi_watchdog = NMI_NONE;
>> |  	}
>> |
>> |  	apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as
>> Virtual Wire IRQ...");
>> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c
>> linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c
>> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_32.c	2008-06-05
>> 18:39:49.000000000 +0200
>> | +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_32.c	2008-06-07
>> 11:19:55.000000000 +0200
>> | @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
>> |   */
>> |  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
>> |
>> | -unsigned int nmi_watchdog = NMI_DEFAULT;
>> | +int nmi_watchdog = NMI_DEFAULT;
>> |  static unsigned int nmi_hz = HZ;
>> |
>> |  static DEFINE_PER_CPU(short, wd_enabled);
>> | diff -upr linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c
>> linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c
>> | --- linux-2.6.26-rc5.orig/arch/x86/kernel/nmi_64.c	2008-06-05
>> 18:39:49.000000000 +0200
>> | +++ linux-2.6.26-rc5/arch/x86/kernel/nmi_64.c	2008-06-07
>> 11:20:00.000000000 +0200
>> | @@ -43,7 +43,7 @@ static cpumask_t backtrace_mask = CPU_MA
>> |  atomic_t nmi_active = ATOMIC_INIT(0);		/* oprofile uses this */
>> |  static int panic_on_timeout;
>> |
>> | -unsigned int nmi_watchdog = NMI_DEFAULT;
>> | +int nmi_watchdog = NMI_DEFAULT;
>> |  static unsigned int nmi_hz = HZ;
>> |
>> |  static DEFINE_PER_CPU(short, wd_enabled);
>> | diff -upr linux-2.6.26-rc5.orig/include/asm-x86/nmi.h
>> linux-2.6.26-rc5/include/asm-x86/nmi.h
>> | --- linux-2.6.26-rc5.orig/include/asm-x86/nmi.h	2008-06-05
>> 18:40:12.000000000 +0200
>> | +++ linux-2.6.26-rc5/include/asm-x86/nmi.h	2008-06-07 11:21:20.000000000
>> +0200
>> | @@ -61,7 +61,7 @@ extern void enable_timer_nmi_watchdog(vo
>> |  extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
>> |
>> |  extern atomic_t nmi_active;
>> | -extern unsigned int nmi_watchdog;
>> | +extern int nmi_watchdog;
>> |  #define NMI_DISABLED    -1
>> |  #define NMI_NONE	0
>> |  #define NMI_IO_APIC	1
>> |
>>
>> We should leave nmi_watchdog as unsigned. The only snippet which
>> could be reviewed as controversy point  - is touch_nmi_watchdog()
>> where we just test nmi_watchdog for being greater than 0. Actually
>> there NMI_NONE should be used instead. But frankly some additional
>> simplification is needed.
>
> Don't forget that the NMI_DEFAULT symbol in include/asm-x86/nmi.h also
> equals to
> NMI_DISABLED, which is -1.
>
> 	Márton Németh
>
>

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

end of thread, other threads:[~2008-06-08 20:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-07 15:45 [PATCH] x86: cleanups to nmi_watchdog variable Németh Márton
2008-06-07 16:32 ` Cyrill Gorcunov
2008-06-08 15:56 ` Cyrill Gorcunov
2008-06-08 16:23   ` Németh Márton
2008-06-08 16:31     ` Cyrill Gorcunov
2008-06-08 20:28     ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox