aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/lockup-watchdogs.txt
diff options
context:
space:
mode:
authorFernando Luis Vázquez Cao <fernando@oss.ntt.co.jp>2012-02-09 17:42:20 -0500
committerIngo Molnar <mingo@elte.hu>2012-02-11 09:11:28 -0500
commit9919cba7ff71147803c988521cc1ceb80e7f0f6d (patch)
tree2e790fe9373225bb72fc74b3f14702bc04252508 /Documentation/lockup-watchdogs.txt
parentc98fdeaa92731308ed80386261fa2589addefa47 (diff)
watchdog: Update documentation
The soft and hard lockup detectors are now built on top of the hrtimer and perf subsystems. Update the documentation accordingly. Signed-off-by: Fernando Luis Vazquez Cao<fernando@oss.ntt.co.jp> Acked-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Don Zickus <dzickus@redhat.com> Link: http://lkml.kernel.org/r/1328827342-6253-1-git-send-email-dzickus@redhat.com Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/lockup-watchdogs.txt')
-rw-r--r--Documentation/lockup-watchdogs.txt63
1 files changed, 63 insertions, 0 deletions
diff --git a/Documentation/lockup-watchdogs.txt b/Documentation/lockup-watchdogs.txt
new file mode 100644
index 000000000000..d2a36602ca8d
--- /dev/null
+++ b/Documentation/lockup-watchdogs.txt
@@ -0,0 +1,63 @@
1===============================================================
2Softlockup detector and hardlockup detector (aka nmi_watchdog)
3===============================================================
4
5The Linux kernel can act as a watchdog to detect both soft and hard
6lockups.
7
8A 'softlockup' is defined as a bug that causes the kernel to loop in
9kernel mode for more than 20 seconds (see "Implementation" below for
10details), without giving other tasks a chance to run. The current
11stack trace is displayed upon detection and, by default, the system
12will stay locked up. Alternatively, the kernel can be configured to
13panic; a sysctl, "kernel.softlockup_panic", a kernel parameter,
14"softlockup_panic" (see "Documentation/kernel-parameters.txt" for
15details), and a compile option, "BOOTPARAM_HARDLOCKUP_PANIC", are
16provided for this.
17
18A 'hardlockup' is defined as a bug that causes the CPU to loop in
19kernel mode for more than 10 seconds (see "Implementation" below for
20details), without letting other interrupts have a chance to run.
21Similarly to the softlockup case, the current stack trace is displayed
22upon detection and the system will stay locked up unless the default
23behavior is changed, which can be done through a compile time knob,
24"BOOTPARAM_HARDLOCKUP_PANIC", and a kernel parameter, "nmi_watchdog"
25(see "Documentation/kernel-parameters.txt" for details).
26
27The panic option can be used in combination with panic_timeout (this
28timeout is set through the confusingly named "kernel.panic" sysctl),
29to cause the system to reboot automatically after a specified amount
30of time.
31
32=== Implementation ===
33
34The soft and hard lockup detectors are built on top of the hrtimer and
35perf subsystems, respectively. A direct consequence of this is that,
36in principle, they should work in any architecture where these
37subsystems are present.
38
39A periodic hrtimer runs to generate interrupts and kick the watchdog
40task. An NMI perf event is generated every "watchdog_thresh"
41(compile-time initialized to 10 and configurable through sysctl of the
42same name) seconds to check for hardlockups. If any CPU in the system
43does not receive any hrtimer interrupt during that time the
44'hardlockup detector' (the handler for the NMI perf event) will
45generate a kernel warning or call panic, depending on the
46configuration.
47
48The watchdog task is a high priority kernel thread that updates a
49timestamp every time it is scheduled. If that timestamp is not updated
50for 2*watchdog_thresh seconds (the softlockup threshold) the
51'softlockup detector' (coded inside the hrtimer callback function)
52will dump useful debug information to the system log, after which it
53will call panic if it was instructed to do so or resume execution of
54other kernel code.
55
56The period of the hrtimer is 2*watchdog_thresh/5, which means it has
57two or three chances to generate an interrupt before the hardlockup
58detector kicks in.
59
60As explained above, a kernel knob is provided that allows
61administrators to configure the period of the hrtimer and the perf
62event. The right value for a particular environment is a trade-off
63between fast response to lockups and detection overhead.