Skip to content

Commit 47195d5

Browse files
dzickusrhIngo Molnar
authored andcommitted
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(-)
1 parent 2cc4452 commit 47195d5

File tree

4 files changed

+36
-37
lines changed

4 files changed

+36
-37
lines changed

arch/x86/kernel/apic/hw_nmi.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ static inline unsigned int get_timer_irqs(int cpu)
3838
irqs += per_cpu(irq_stat, cpu).apic_timer_irqs;
3939
#endif
4040

41-
return irqs;
41+
return irqs;
4242
}
4343

4444
static inline int mce_in_progress(void)
4545
{
4646
#if defined(CONFIG_X86_MCE)
47-
return atomic_read(&mce_entry) > 0;
47+
return atomic_read(&mce_entry) > 0;
4848
#endif
49-
return 0;
49+
return 0;
5050
}
5151

5252
int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
@@ -69,9 +69,9 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
6969
}
7070

7171
/* 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 */
73-
if (mce_in_progress())
74-
return 0;
72+
/* Could check oops_in_progress here too, but it's safer not to */
73+
if (mce_in_progress())
74+
return 0;
7575

7676
/* We determine if the cpu is stuck by checking whether any
7777
* interrupts have happened since we last checked. Of course
@@ -89,7 +89,7 @@ int hw_nmi_is_cpu_stuck(struct pt_regs *regs)
8989

9090
u64 hw_nmi_get_sample_period(void)
9191
{
92-
return cpu_khz * 1000;
92+
return cpu_khz * 1000;
9393
}
9494

9595
#ifdef ARCH_HAS_NMI_WATCHDOG

arch/x86/kernel/traps.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -402,9 +402,9 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
402402
return;
403403

404404
#ifdef CONFIG_X86_LOCAL_APIC
405-
if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
406-
== NOTIFY_STOP)
407-
return;
405+
if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
406+
== NOTIFY_STOP)
407+
return;
408408

409409
#ifndef CONFIG_NMI_WATCHDOG
410410
/*

include/linux/nmi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ u64 hw_nmi_get_sample_period(void);
5757
extern int nmi_watchdog_enabled;
5858
struct ctl_table;
5959
extern int proc_nmi_enabled(struct ctl_table *, int ,
60-
void __user *, size_t *, loff_t *);
60+
void __user *, size_t *, loff_t *);
6161
#endif
6262

6363
#endif

kernel/nmi_watchdog.c

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,31 @@ void touch_all_nmi_watchdog(void)
5050

5151
static int __init setup_nmi_watchdog(char *str)
5252
{
53-
if (!strncmp(str, "panic", 5)) {
54-
panic_on_timeout = 1;
55-
str = strchr(str, ',');
56-
if (!str)
57-
return 1;
58-
++str;
59-
}
60-
return 1;
53+
if (!strncmp(str, "panic", 5)) {
54+
panic_on_timeout = 1;
55+
str = strchr(str, ',');
56+
if (!str)
57+
return 1;
58+
++str;
59+
}
60+
return 1;
6161
}
6262
__setup("nmi_watchdog=", setup_nmi_watchdog);
6363

6464
struct perf_event_attr wd_hw_attr = {
65-
.type = PERF_TYPE_HARDWARE,
66-
.config = PERF_COUNT_HW_CPU_CYCLES,
67-
.size = sizeof(struct perf_event_attr),
68-
.pinned = 1,
69-
.disabled = 1,
65+
.type = PERF_TYPE_HARDWARE,
66+
.config = PERF_COUNT_HW_CPU_CYCLES,
67+
.size = sizeof(struct perf_event_attr),
68+
.pinned = 1,
69+
.disabled = 1,
7070
};
7171

7272
struct perf_event_attr wd_sw_attr = {
73-
.type = PERF_TYPE_SOFTWARE,
74-
.config = PERF_COUNT_SW_CPU_CLOCK,
75-
.size = sizeof(struct perf_event_attr),
76-
.pinned = 1,
77-
.disabled = 1,
73+
.type = PERF_TYPE_SOFTWARE,
74+
.config = PERF_COUNT_SW_CPU_CLOCK,
75+
.size = sizeof(struct perf_event_attr),
76+
.pinned = 1,
77+
.disabled = 1,
7878
};
7979

8080
void wd_overflow(struct perf_event *event, int nmi,
@@ -95,16 +95,15 @@ void wd_overflow(struct perf_event *event, int nmi,
9595
* Ayiee, looks like this CPU is stuck ...
9696
* wait a few IRQs (5 seconds) before doing the oops ...
9797
*/
98-
per_cpu(alert_counter,cpu) += 1;
99-
if (per_cpu(alert_counter,cpu) == 5) {
100-
if (panic_on_timeout) {
98+
per_cpu(alert_counter, cpu) += 1;
99+
if (per_cpu(alert_counter, cpu) == 5) {
100+
if (panic_on_timeout)
101101
panic("NMI Watchdog detected LOCKUP on cpu %d", cpu);
102-
} else {
102+
else
103103
WARN(1, "NMI Watchdog detected LOCKUP on cpu %d", cpu);
104-
}
105104
}
106105
} else {
107-
per_cpu(alert_counter,cpu) = 0;
106+
per_cpu(alert_counter, cpu) = 0;
108107
}
109108

110109
return;
@@ -126,7 +125,7 @@ static int enable_nmi_watchdog(int cpu)
126125
event = perf_event_create_kernel_counter(wd_attr, cpu, -1, wd_overflow);
127126
if (IS_ERR(event)) {
128127
/* 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");
130129
wd_attr = &wd_sw_attr;
131130
wd_attr->sample_period = NSEC_PER_SEC;
132131
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,
182181
if (nmi_watchdog_enabled) {
183182
for_each_online_cpu(cpu)
184183
if (enable_nmi_watchdog(cpu)) {
185-
printk("NMI watchdog failed configuration, "
184+
printk(KERN_ERR "NMI watchdog failed configuration, "
186185
" can not be enabled\n");
187186
}
188187
} else {

0 commit comments

Comments
 (0)