Skip to contentSkip to conversation

nmi_watchdog: checkpatch.pl cleanups from earlier patches

PATCH In review Don Zickus 3 participants 7 messages Feb 22, 2010 – Feb 28, 2010

Subsystems (2)
lore
Share & tools
lore

Don Zickus

author
#0 lore raw

PATCH 1/1 nmi_watchdog: checkpatch.pl cleanups from earlier patches

Mostly copy/paste whitespace damage with a couple of nitpicks by the script. Fix the struct definition as requested by Ingo too.

--
Ingo,

I don't know how you want this patch. Like this to put on top or do you want me to repost everything with the cleanups inside the appropriate patch?

---
 arch/x86/kernel/apic/hw_nmi.c |   14 +++++-----
 arch/x86/kernel/traps.c       |    6 ++--
 include/linux/nmi.h           |    2 +-
 kernel/nmi_watchdog.c         |   51 ++++++++++++++++++++---------------------
 4 files changed, 36 insertions(+), 37 deletions(-)
arch/x86/kernel/apic/hw_nmi.c +7 -7
index 0b4d205..e8b78a0 100644
@@ -38,15 +38,15 @@ static inline unsigned int get_timer_irqs(int cpu)
 	irqs += per_cpu(irq_stat, cpu).apic_timer_irqs;
 #endif
 
-        return irqs;
+	return irqs;
 }
 
 static inline int mce_in_progress(void)
 {
 #if defined(CONFIG_X86_MCE)
-        return atomic_read(&mce_entry) > 0;
+	return atomic_read(&mce_entry) > 0;
 #endif
-        return 0;
+	return 0;
 }
 
 int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
@@ -69,9 +69,9 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
 	}
 
 	/* if we are doing an mce, just assume the cpu is not stuck */
-        /* Could check oops_in_progress here too, but it's safer not to */
-        if (mce_in_progress())
-                return 0;
+	/* Could check oops_in_progress here too, but it's safer not to */
+	if (mce_in_progress())
+		return 0;
 
 	/* We determine if the cpu is stuck by checking whether any
 	 * interrupts have happened since we last checked.  Of course
@@ -89,7 +89,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
 
 u64 hw_nmi_get_sample_period(void)
 {
-        return cpu_khz * 1000;
+	return cpu_khz * 1000;
 }
 
 #ifdef ARCH_HAS_NMI_WATCHDOG
arch/x86/kernel/traps.c +3 -3
index 973cbc4..bdc7fab 100644
@@ -402,9 +402,9 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 			return;
 
 #ifdef CONFIG_X86_LOCAL_APIC
-	        if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
-	        			                == NOTIFY_STOP)
-	                return;
+		if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
+							== NOTIFY_STOP)
+			return;
 
 #ifndef CONFIG_NMI_WATCHDOG
 		/*
include/linux/nmi.h +1 -1
index 794e735..22cc796 100644
@@ -57,7 +57,7 @@ u64 hw_nmi_get_sample_period(void);
 extern int nmi_watchdog_enabled;
 struct ctl_table;
 extern int proc_nmi_enabled(struct ctl_table *, int ,
-                        void __user *, size_t *, loff_t *);
+			void __user *, size_t *, loff_t *);
 #endif
 
 #endif
kernel/nmi_watchdog.c +25 -26

86 lines not on this page · raw message

Signature · 1 line
1.6.6.83.gc9a2
#1 lore raw

On Mon, Feb 22, 2010 at 06:09:03PM -0500, Don Zickus wrote:
...

Hi Don!

Quoted 8 lines
kernel/nmi_watchdog.c +0 -0
index 3c75cbf..0a6f57f 100644
@@ -50,31 +50,31 @@ void touch_all_nmi_watchdog(void)
 
 static int __init setup_nmi_watchdog(char *str)
 {

kernel/nmi_watchdog.c void touch_all_nmi_watchdog(void) · line 54

Quoted 10 lines
kernel/nmi_watchdog.c +2 -8
-        if (!strncmp(str, "panic", 5)) {
-                panic_on_timeout = 1;
-                str = strchr(str, ',');
-                if (!str)
-                        return 1;
-                ++str;
-        }
-        return 1;
+	if (!strncmp(str, "panic", 5)) {
+		panic_on_timeout = 1;

If I understand all the things correct -- you don't need to check for ',' after panic. It seems so. Because we're switching to perf_events I suppose we may drop expecting "lapic,ioapic" or whatever here? Or there is an idea to parse say "panic,software" (ie to switch to software events by default)?

Though strictly speaking my question in rather unrelated to this patch agenda :)

kernel/nmi_watchdog.c void touch_all_nmi_watchdog(void) · line 62

Quoted 8 lines
kernel/nmi_watchdog.c +6 -0
+		str = strchr(str, ',');
+		if (!str)
+			return 1;
+		++str;
+	}
+	return 1;
 }
 __setup("nmi_watchdog=", setup_nmi_watchdog);

...

-- Cyrill

#2 lore raw
Quoted 42 lines · Cyrill Gorcunov

On Mon, Feb 22, 2010 at 06:09:03PM -0500, Don Zickus wrote:
...

Hi Don!

Quoted 8 lines
kernel/nmi_watchdog.c +0 -0
index 3c75cbf..0a6f57f 100644
@@ -50,31 +50,31 @@ void touch_all_nmi_watchdog(void)
 
 static int __init setup_nmi_watchdog(char *str)
 {

kernel/nmi_watchdog.c void touch_all_nmi_watchdog(void) · line 54

Quoted 10 lines
kernel/nmi_watchdog.c +2 -8
-        if (!strncmp(str, "panic", 5)) {
-                panic_on_timeout = 1;
-                str = strchr(str, ',');
-                if (!str)
-                        return 1;
-                ++str;
-        }
-        return 1;
+	if (!strncmp(str, "panic", 5)) {
+		panic_on_timeout = 1;

If I understand all the things correct -- you don't need to check for ',' after panic. It seems so. Because we're switching to perf_events I suppose we may drop expecting "lapic,ioapic" or whatever here? Or there is an idea to parse say "panic,software" (ie to switch to software events by default)?

Though strictly speaking my question in rather unrelated to this patch agenda :)

Quoted 8 lines
kernel/nmi_watchdog.c +6 -0
+		str = strchr(str, ',');
+		if (!str)
+			return 1;
+		++str;
+	}
+	return 1;
 }
 __setup("nmi_watchdog=", setup_nmi_watchdog);

...

Quoted 1 line

-- Cyrill

If I'm right -- the fix could be done later, after this patch applied.

-- Cyrill

author
#3 lore raw
In reply to Cyrill Gorcunov
Quoted 11 lines · Cyrill Gorcunov

On Mon, Feb 22, 2010 at 06:09:03PM -0500, Don Zickus wrote:
...

Hi Don!

Quoted 6 lines
kernel/nmi_watchdog.c +0 -0
index 3c75cbf..0a6f57f 100644
@@ -50,31 +50,31 @@ void touch_all_nmi_watchdog(void)
 
Quoted 16 lines

kernel/nmi_watchdog.c void touch_all_nmi_watchdog(void) · line 54

Quoted 12 lines
kernel/nmi_watchdog.c +2 -8
 static int __init setup_nmi_watchdog(char *str)
 {
-        if (!strncmp(str, "panic", 5)) {
-                panic_on_timeout = 1;
-                str = strchr(str, ',');
-                if (!str)
-                        return 1;
-                ++str;
-        }
-        return 1;
+	if (!strncmp(str, "panic", 5)) {
+		panic_on_timeout = 1;

If I understand all the things correct -- you don't need to check for ',' after panic. It seems so. Because we're switching to perf_events I suppose we may drop expecting "lapic,ioapic" or whatever here? Or there is an idea

ah good point. I was just cutting and pasting things and didn't think to much about it.

Quoted 1 line

to parse say "panic,software" (ie to switch to software events by default)?

interesting idea, could be useful.

Thanks,
Don

#4 lore raw
In reply to Don Zickus
Quoted 9 lines · Don Zickus

Mostly copy/paste whitespace damage with a couple of nitpicks by the script. Fix the struct definition as requested by Ingo too.

--
Ingo,

I don't know how you want this patch. Like this to put on top or do you want me to repost everything with the cleanups inside the appropriate patch?

It's fine this way - i've put them on top - the base patches have a reasonable amount of testing track record already, we dont want to destroy that via a rebase.

(in the future it's useful to run checkpatch as part of your patch submission checks. In my experience it finds real issues most of the time. Some of the warnings have to be ignored.)

Ingo

#5 lore raw

[tip:perf/nmi] nmi_watchdog: Clean up various small details

In reply to Don Zickus
Commit-ID:  47195d57636604ff6048b0d7aa3e4ed9643f6073
Gitweb:     http://git.kernel.org/tip/47195d57636604ff6048b0d7aa3e4ed9643f6073
Author:     Don Zickus <[email protected]>
AuthorDate: Mon, 22 Feb 2010 18:09:03 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 25 Feb 2010 12:40:50 +0100

nmi_watchdog: Clean up various small details

Mostly copy/paste whitespace damage with a couple of nitpicks by the checkpatch script. Fix the struct definition as requested by Ingo too.

LKML-Reference: <[email protected]>

--

 arch/x86/kernel/apic/hw_nmi.c |   14 +++++------
 arch/x86/kernel/traps.c       |    6 ++--
 include/linux/nmi.h           |    2 -
 kernel/nmi_watchdog.c         |   51 ++++++++++++++++++++----------------------
 4 files changed, 36 insertions(+), 37 deletions(-)
---
 arch/x86/kernel/apic/hw_nmi.c |   14 +++++-----
 arch/x86/kernel/traps.c       |    6 ++--
 include/linux/nmi.h           |    2 +-
 kernel/nmi_watchdog.c         |   51 ++++++++++++++++++++---------------------
 4 files changed, 36 insertions(+), 37 deletions(-)
arch/x86/kernel/apic/hw_nmi.c +7 -7
index 0b4d205..e8b78a0 100644
@@ -38,15 +38,15 @@ static inline unsigned int get_timer_irqs(int cpu)
 	irqs += per_cpu(irq_stat, cpu).apic_timer_irqs;
 #endif
 
-        return irqs;
+	return irqs;
 }
 
 static inline int mce_in_progress(void)
 {
 #if defined(CONFIG_X86_MCE)
-        return atomic_read(&mce_entry) > 0;
+	return atomic_read(&mce_entry) > 0;
 #endif
-        return 0;
+	return 0;
 }
 
 int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
@@ -69,9 +69,9 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
 	}
 
 	/* if we are doing an mce, just assume the cpu is not stuck */
-        /* Could check oops_in_progress here too, but it's safer not to */
-        if (mce_in_progress())
-                return 0;
+	/* Could check oops_in_progress here too, but it's safer not to */
+	if (mce_in_progress())
+		return 0;
 
 	/* We determine if the cpu is stuck by checking whether any
 	 * interrupts have happened since we last checked.  Of course
@@ -89,7 +89,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
 
 u64 hw_nmi_get_sample_period(void)
 {
-        return cpu_khz * 1000;
+	return cpu_khz * 1000;
 }
 
 #ifdef ARCH_HAS_NMI_WATCHDOG
arch/x86/kernel/traps.c +3 -3
index 973cbc4..bdc7fab 100644
@@ -402,9 +402,9 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
 			return;
 
 #ifdef CONFIG_X86_LOCAL_APIC
-	        if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
-	        			                == NOTIFY_STOP)
-	                return;
+		if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
+							== NOTIFY_STOP)
+			return;
 
 #ifndef CONFIG_NMI_WATCHDOG
 		/*
include/linux/nmi.h +1 -1
index 794e735..22cc796 100644
@@ -57,7 +57,7 @@ u64 hw_nmi_get_sample_period(void);
 extern int nmi_watchdog_enabled;
 struct ctl_table;
 extern int proc_nmi_enabled(struct ctl_table *, int ,
-                        void __user *, size_t *, loff_t *);
+			void __user *, size_t *, loff_t *);
 #endif
 
 #endif
kernel/nmi_watchdog.c +25 -26

86 lines not on this page · raw message

#6 lore raw

[tip:perf/nmi] nmi_watchdog: Turn it off by default

In reply to Don Zickus
Commit-ID:  c99c30feadf664ccd8590b96259cb9f3954bd246
Gitweb:     http://git.kernel.org/tip/c99c30feadf664ccd8590b96259cb9f3954bd246
Author:     Ingo Molnar <[email protected]>
AuthorDate: Sun, 28 Feb 2010 20:49:00 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Sun, 28 Feb 2010 20:49:00 +0100

nmi_watchdog: Turn it off by default

It was nice to enable it by default for testing - but before we push it upstream we want it to be off - so that people can opt-in gradually.

Cc: Don Zickus <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
LKML-Reference: <[email protected]>

---
 lib/Kconfig.debug |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
lib/Kconfig.debug +0 -1
index 01a4d85..e2e73cc 100644
@@ -173,7 +173,6 @@ config DETECT_SOFTLOCKUP
 config NMI_WATCHDOG
 	bool "Detect Hard Lockups with an NMI Watchdog"
 	depends on DEBUG_KERNEL && PERF_EVENTS && PERF_EVENTS_NMI
-	default y
 	help
 	  Say Y here to enable the kernel to use the NMI as a watchdog
 	  to detect hard lockups.  This is useful when a cpu hangs for no