All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Keir Fraser <keir.xen@gmail.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Jan Beulich <JBeulich@suse.com>
Subject: NMI: watchdog timeout command line parameter
Date: Wed, 7 Mar 2012 18:14:30 +0000	[thread overview]
Message-ID: <4F57A586.2000701@citrix.com> (raw)
In-Reply-To: <CB7D4E63.2DDF9%keir.xen@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 190 bytes --]

Here is a patch which allows a command line parameter to set the
watchdog timeout.

-- 
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com


[-- Attachment #2: nmi-watchdog-timeout.patch --]
[-- Type: text/x-patch, Size: 3650 bytes --]

# HG changeset patch
# Parent e193375fb82af819eb55a1189308fcd4c1e8b40f
NMI: Command line parameter for watchdog timeout

Introduce a command parameter to set the watchtog timeout.  Manually specifying
"watchdog_timeout=<seconds>" on the command line will also turn the watchdog
on.  For consistency, move opt_watchdog into nmi.c along with
opt_watchdog_timeout.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

diff -r e193375fb82a docs/misc/xen-command-line.markdown
--- a/docs/misc/xen-command-line.markdown
+++ b/docs/misc/xen-command-line.markdown
@@ -391,7 +391,17 @@ The optional `keep` parameter causes Xen
 ### watchdog
 > `= <boolean>`
 
-Run an NMI watchdog on each processor.  Defaults to disabled.
+> Default: `false`
+
+Run an NMI watchdog on each processor.  If a processor is stuck for longer than the watchdog\_timeout, a panic occurs.
+
+### watchdog\_timeout
+> `= <integer>`
+
+> Default: `5`
+
+Set the NMI watchdog timeout in seconds.  Specifying `0` will turn off the watchdog.
+
 ### x2apic
 ### x2apic\_phys
 ### xencons
diff -r e193375fb82a xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -40,6 +40,19 @@ static unsigned int nmi_p4_cccr_val;
 static DEFINE_PER_CPU(struct timer, nmi_timer);
 static DEFINE_PER_CPU(unsigned int, nmi_timer_ticks);
 
+/* opt_watchdog: If true, run a watchdog NMI on each processor. */
+bool_t __initdata opt_watchdog = 0;
+boolean_param("watchdog", opt_watchdog);
+
+/* opt_watchdog_timeout: Number of seconds to wait before panic. */
+static unsigned int opt_watchdog_timeout = 5;
+static void parse_watchdog_timeout(char * s)
+{
+    opt_watchdog_timeout = simple_strtoull(s, NULL, 0);
+    opt_watchdog = !!opt_watchdog_timeout;
+}
+custom_param("watchdog_timeout", parse_watchdog_timeout);
+
 /*
  * lapic_nmi_owner tracks the ownership of the lapic NMI hardware:
  * - it may be reserved by some other driver, or not
@@ -425,11 +438,11 @@ void nmi_watchdog_tick(struct cpu_user_r
          !atomic_read(&watchdog_disable_count) )
     {
         /*
-         * Ayiee, looks like this CPU is stuck ... wait a few IRQs (5 seconds) 
+         * Ayiee, looks like this CPU is stuck ... wait for the timeout
          * before doing the oops ...
          */
         this_cpu(alert_counter)++;
-        if ( this_cpu(alert_counter) == 5*nmi_hz )
+        if ( this_cpu(alert_counter) == opt_watchdog_timeout*nmi_hz )
         {
             console_force_unlock();
             printk("Watchdog timer detects that CPU%d is stuck!\n",
diff -r e193375fb82a xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -45,6 +45,7 @@
 #include <asm/mach-generic/mach_apic.h> /* for generic_apic_probe */
 #include <asm/setup.h>
 #include <xen/cpu.h>
+#include <asm/nmi.h>
 
 /* opt_nosmp: If true, secondary processors are ignored. */
 static bool_t __initdata opt_nosmp;
@@ -54,10 +55,6 @@ boolean_param("nosmp", opt_nosmp);
 static unsigned int __initdata max_cpus;
 integer_param("maxcpus", max_cpus);
 
-/* opt_watchdog: If true, run a watchdog NMI on each processor. */
-static bool_t __initdata opt_watchdog;
-boolean_param("watchdog", opt_watchdog);
-
 /* smep: Enable/disable Supervisor Mode Execution Protection (default on). */
 static bool_t __initdata disable_smep;
 invbool_param("smep", disable_smep);
diff -r e193375fb82a xen/include/asm-x86/nmi.h
--- a/xen/include/asm-x86/nmi.h
+++ b/xen/include/asm-x86/nmi.h
@@ -5,6 +5,9 @@
 #include <public/nmi.h>
 
 struct cpu_user_regs;
+
+/* Watchdog boolean from the command line */
+extern bool_t opt_watchdog;
  
 typedef int (*nmi_callback_t)(struct cpu_user_regs *regs, int cpu);
  

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2012-03-07 18:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-07 16:55 NMI: Enable watchdog by default Andrew Cooper
2012-03-07 17:08 ` Jan Beulich
2012-03-07 17:11 ` Keir Fraser
2012-03-07 17:35   ` George Dunlap
2012-03-07 17:41     ` Keir Fraser
2012-03-07 18:14       ` Andrew Cooper [this message]
2012-03-08 10:06         ` NMI: watchdog timeout command line parameter Jan Beulich
2012-03-08 10:22           ` George Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F57A586.2000701@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=keir.xen@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.