diff options
author | Don Zickus <dzickus@redhat.com> | 2010-02-22 18:09:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-25 06:40:50 -0500 |
commit | 47195d57636604ff6048b0d7aa3e4ed9643f6073 (patch) | |
tree | 32abacd2dee7af0542de211b727f9ecb4116f7fb | |
parent | 2cc4452bc31fc1cde6f0b64a4eb13269f982787d (diff) |
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.
Signed-off-by: Don Zickus <dzickus@redhat.com>
Cc: peterz@infradead.org
Cc: gorcunov@gmail.com
Cc: aris@redhat.com
LKML-Reference: <1266880143-24943-1-git-send-email-dzickus@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--
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(-)
-rw-r--r-- | arch/x86/kernel/apic/hw_nmi.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/traps.c | 6 | ||||
-rw-r--r-- | include/linux/nmi.h | 2 | ||||
-rw-r--r-- | kernel/nmi_watchdog.c | 51 |
4 files changed, 36 insertions, 37 deletions
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c index 0b4d205a6b8e..e8b78a0be5de 100644 --- a/arch/x86/kernel/apic/hw_nmi.c +++ b/arch/x86/kernel/apic/hw_nmi.c | |||
@@ -38,15 +38,15 @@ static inline unsigned int get_timer_irqs(int cpu) | |||
38 | irqs += per_cpu(irq_stat, cpu).apic_timer_irqs; | 38 | irqs += per_cpu(irq_stat, cpu).apic_timer_irqs; |
39 | #endif | 39 | #endif |
40 | 40 | ||
41 | return irqs; | 41 | return irqs; |
42 | } | 42 | } |
43 | 43 | ||
44 | static inline int mce_in_progress(void) | 44 | static inline int mce_in_progress(void) |
45 | { | 45 | { |
46 | #if defined(CONFIG_X86_MCE) | 46 | #if defined(CONFIG_X86_MCE) |
47 | return atomic_read(&mce_entry) > 0; | 47 | return atomic_read(&mce_entry) > 0; |
48 | #endif | 48 | #endif |
49 | return 0; | 49 | return 0; |
50 | } | 50 | } |
51 | 51 | ||
52 | int hw_nmi_is_cpu_stuck(struct pt_regs *regs) | 52 | int hw_nmi_is_cpu_stuck(struct pt_regs *regs) |
@@ -69,9 +69,9 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs) | |||
69 | } | 69 | } |
70 | 70 | ||
71 | /* if we are doing an mce, just assume the cpu is not stuck */ | 71 | /* if we are doing an mce, just assume the cpu is not stuck */ |
72 | /* Could check oops_in_progress here too, but it's safer not to */ | 72 | /* Could check oops_in_progress here too, but it's safer not to */ |
73 | if (mce_in_progress()) | 73 | if (mce_in_progress()) |
74 | return 0; | 74 | return 0; |
75 | 75 | ||
76 | /* We determine if the cpu is stuck by checking whether any | 76 | /* We determine if the cpu is stuck by checking whether any |
77 | * interrupts have happened since we last checked. Of course | 77 | * interrupts have happened since we last checked. Of course |
@@ -89,7 +89,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs) | |||
89 | 89 | ||
90 | u64 hw_nmi_get_sample_period(void) | 90 | u64 hw_nmi_get_sample_period(void) |
91 | { | 91 | { |
92 | return cpu_khz * 1000; | 92 | return cpu_khz * 1000; |
93 | } | 93 | } |
94 | 94 | ||
95 | #ifdef ARCH_HAS_NMI_WATCHDOG | 95 | #ifdef ARCH_HAS_NMI_WATCHDOG |
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c index 973cbc4f044f..bdc7fab3ef3e 100644 --- a/arch/x86/kernel/traps.c +++ b/arch/x86/kernel/traps.c | |||
@@ -402,9 +402,9 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs) | |||
402 | return; | 402 | return; |
403 | 403 | ||
404 | #ifdef CONFIG_X86_LOCAL_APIC | 404 | #ifdef CONFIG_X86_LOCAL_APIC |
405 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) | 405 | if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) |
406 | == NOTIFY_STOP) | 406 | == NOTIFY_STOP) |
407 | return; | 407 | return; |
408 | 408 | ||
409 | #ifndef CONFIG_NMI_WATCHDOG | 409 | #ifndef CONFIG_NMI_WATCHDOG |
410 | /* | 410 | /* |
diff --git a/include/linux/nmi.h b/include/linux/nmi.h index 794e7354c5bf..22cc7960b649 100644 --- a/include/linux/nmi.h +++ b/include/linux/nmi.h | |||
@@ -57,7 +57,7 @@ u64 hw_nmi_get_sample_period(void); | |||
57 | extern int nmi_watchdog_enabled; | 57 | extern int nmi_watchdog_enabled; |
58 | struct ctl_table; | 58 | struct ctl_table; |
59 | extern int proc_nmi_enabled(struct ctl_table *, int , | 59 | extern int proc_nmi_enabled(struct ctl_table *, int , |
60 | void __user *, size_t *, loff_t *); | 60 | void __user *, size_t *, loff_t *); |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #endif | 63 | #endif |
diff --git a/kernel/nmi_watchdog.c b/kernel/nmi_watchdog.c index 3c75cbf3acb8..0a6f57f537a7 100644 --- a/kernel/nmi_watchdog.c +++ b/kernel/nmi_watchdog.c | |||
@@ -50,31 +50,31 @@ void touch_all_nmi_watchdog(void) | |||
50 | 50 | ||
51 | static int __init setup_nmi_watchdog(char *str) | 51 | static int __init setup_nmi_watchdog(char *str) |
52 | { | 52 | { |
53 | if (!strncmp(str, "panic", 5)) { | 53 | if (!strncmp(str, "panic", 5)) { |
54 | panic_on_timeout = 1; | 54 | panic_on_timeout = 1; |
55 | str = strchr(str, ','); | 55 | str = strchr(str, ','); |
56 | if (!str) | 56 | if (!str) |
57 | return 1; | 57 | return 1; |
58 | ++str; | 58 | ++str; |
59 | } | 59 | } |
60 | return 1; | 60 | return 1; |
61 | } | 61 | } |
62 | __setup("nmi_watchdog=", setup_nmi_watchdog); | 62 | __setup("nmi_watchdog=", setup_nmi_watchdog); |
63 | 63 | ||
64 | struct perf_event_attr wd_hw_attr = { | 64 | struct perf_event_attr wd_hw_attr = { |
65 | .type = PERF_TYPE_HARDWARE, | 65 | .type = PERF_TYPE_HARDWARE, |
66 | .config = PERF_COUNT_HW_CPU_CYCLES, | 66 | .config = PERF_COUNT_HW_CPU_CYCLES, |
67 | .size = sizeof(struct perf_event_attr), | 67 | .size = sizeof(struct perf_event_attr), |
68 | .pinned = 1, | 68 | .pinned = 1, |
69 | .disabled = 1, | 69 | .disabled = 1, |
70 | }; | 70 | }; |
71 | 71 | ||
72 | struct perf_event_attr wd_sw_attr = { | 72 | struct perf_event_attr wd_sw_attr = { |
73 | .type = PERF_TYPE_SOFTWARE, | 73 | .type = PERF_TYPE_SOFTWARE, |
74 | .config = PERF_COUNT_SW_CPU_CLOCK, | 74 | .config = PERF_COUNT_SW_CPU_CLOCK, |
75 | .size = sizeof(struct perf_event_attr), | 75 | .size = sizeof(struct perf_event_attr), |
76 | .pinned = 1, | 76 | .pinned = 1, |
77 | .disabled = 1, | 77 | .disabled = 1, |
78 | }; | 78 | }; |
79 | 79 | ||
80 | void wd_overflow(struct perf_event *event, int nmi, | 80 | void wd_overflow(struct perf_event *event, int nmi, |
@@ -95,16 +95,15 @@ void wd_overflow(struct perf_event *event, int nmi, | |||
95 | * Ayiee, looks like this CPU is stuck ... | 95 | * Ayiee, looks like this CPU is stuck ... |
96 | * wait a few IRQs (5 seconds) before doing the oops ... | 96 | * wait a few IRQs (5 seconds) before doing the oops ... |
97 | */ | 97 | */ |
98 | per_cpu(alert_counter,cpu) += 1; | 98 | per_cpu(alert_counter, cpu) += 1; |
99 | if (per_cpu(alert_counter,cpu) == 5) { | 99 | if (per_cpu(alert_counter, cpu) == 5) { |
100 | if (panic_on_timeout) { | 100 | if (panic_on_timeout) |
101 | panic("NMI Watchdog detected LOCKUP on cpu %d", cpu); | 101 | panic("NMI Watchdog detected LOCKUP on cpu %d", cpu); |
102 | } else { | 102 | else |
103 | WARN(1, "NMI Watchdog detected LOCKUP on cpu %d", cpu); | 103 | WARN(1, "NMI Watchdog detected LOCKUP on cpu %d", cpu); |
104 | } | ||
105 | } | 104 | } |
106 | } else { | 105 | } else { |
107 | per_cpu(alert_counter,cpu) = 0; | 106 | per_cpu(alert_counter, cpu) = 0; |
108 | } | 107 | } |
109 | 108 | ||
110 | return; | 109 | return; |
@@ -126,7 +125,7 @@ static int enable_nmi_watchdog(int cpu) | |||
126 | event = perf_event_create_kernel_counter(wd_attr, cpu, -1, wd_overflow); | 125 | event = perf_event_create_kernel_counter(wd_attr, cpu, -1, wd_overflow); |
127 | if (IS_ERR(event)) { | 126 | if (IS_ERR(event)) { |
128 | /* hardware doesn't exist or not supported, fallback to software events */ | 127 | /* hardware doesn't exist or not supported, fallback to software events */ |
129 | printk("nmi_watchdog: hardware not available, trying software events\n"); | 128 | printk(KERN_INFO "nmi_watchdog: hardware not available, trying software events\n"); |
130 | wd_attr = &wd_sw_attr; | 129 | wd_attr = &wd_sw_attr; |
131 | wd_attr->sample_period = NSEC_PER_SEC; | 130 | wd_attr->sample_period = NSEC_PER_SEC; |
132 | event = perf_event_create_kernel_counter(wd_attr, cpu, -1, wd_overflow); | 131 | event = perf_event_create_kernel_counter(wd_attr, cpu, -1, wd_overflow); |
@@ -182,7 +181,7 @@ int proc_nmi_enabled(struct ctl_table *table, int write, | |||
182 | if (nmi_watchdog_enabled) { | 181 | if (nmi_watchdog_enabled) { |
183 | for_each_online_cpu(cpu) | 182 | for_each_online_cpu(cpu) |
184 | if (enable_nmi_watchdog(cpu)) { | 183 | if (enable_nmi_watchdog(cpu)) { |
185 | printk("NMI watchdog failed configuration, " | 184 | printk(KERN_ERR "NMI watchdog failed configuration, " |
186 | " can not be enabled\n"); | 185 | " can not be enabled\n"); |
187 | } | 186 | } |
188 | } else { | 187 | } else { |