[PATCH 2/3] [RFC] Print a watchdog message at KERN_WARNING level

Don Zickus dzickus at redhat.com
Tue Feb 8 21:46:27 UTC 2011


On Fri, Feb 04, 2011 at 11:32:18PM +0100, Paul Bolle wrote:
> On Fri, 2011-02-04 at 17:16 -0500, Don Zickus wrote:
> 
> > Thanks for finding this and providing the info!
> 
> You're welcome. Feel free to ask me to test the rearranged code and/or
> to a add Reported-by tag to your patch.

Hi Paul,

Here is a patch I was looking to post upstream.  This should address your
concerns.  Let me know how it works out for you.

Cheers,
Don

diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index d7ebdf4..bb7887b 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -366,8 +366,17 @@ static int watchdog_nmi_enable(int cpu)
 		goto out_save;
 	}
 
-	printk(KERN_ERR "NMI watchdog disabled for cpu%i: unable to create perf event: %ld\n",
-	       cpu, PTR_ERR(event));
+
+	/* vary the KERN level based on the returned errno */
+	if (PTR_ERR(event) == -EOPNOTSUPP)
+		printk(KERN_INFO "NMI watchdog disabled (cpu%i): not supported"
+				 " (no LAPIC?)\n", cpu);
+	else if (PTR_ERR(event) == -ENOENT)
+		printk(KERN_WARNING "NMI watchdog disabled (cpu%i): hardware"
+				    " events not enabled\n", cpu);
+	else
+		printk(KERN_ERR "NMI watchdog disabled (cpu%i): unable to create"
+				" perf event: %ld\n", cpu, PTR_ERR(event));
 	return PTR_ERR(event);
 
 	/* success path */


More information about the kernel mailing list