[PATCH] watchdog: reduce "NMI watchdog enabled, takes one hw-pmucounter." messages

From: Nathan Zimmer
Date: Wed Jun 06 2012 - 14:09:43 EST


watchdog: reduces some noise on a large system
The printk buffer can be flooded with with redundant
"NMI watchdog enabled, takes one hw-pmu counter." messages.
It doesn't add any value beyond the first.

Note the message needs logged a second time if the watchdog was disabled then
reenabled.

Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Don Zickus <dzickus@xxxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Nathan Zimmer <nzimmer@xxxxxxx>
---
kernel/watchdog.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index e5e1d85..404b141 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -372,6 +372,8 @@ static int watchdog(void *unused)


#ifdef CONFIG_HARDLOCKUP_DETECTOR
+static bool already_notified;
+
static int watchdog_nmi_enable(int cpu)
{
struct perf_event_attr *wd_attr;
@@ -391,7 +393,10 @@ static int watchdog_nmi_enable(int cpu)
/* Try to register using hardware perf events */
event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL);
if (!IS_ERR(event)) {
- pr_info("enabled, takes one hw-pmu counter.\n");
+ if (!already_notified) {
+ pr_info("enabled, takes one hw-pmu counter.\n");
+ already_notified = true;
+ }
goto out_save;
}

@@ -426,6 +431,7 @@ static void watchdog_nmi_disable(int cpu)

/* should be in cleanup, but blocks oprofile */
perf_event_release_kernel(event);
+ already_notified = false;
}
return;
}
--
1.6.0.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/