Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[WATCHDOG] Pre-Timeout flags

Some watchdog timers support the concept of a "pretimeout" which
occurs some time before the real timeout. The pretimeout can
be delivered via an interrupt or NMI and can be used to panic
the system when it occurs (so you get useful information instead
of a blind reboot).

Signed-off-by: Corey Minyard <minyard@acm.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@osdl.org>

authored by

Corey Minyard and committed by
Wim Van Sebroeck
e05b59fe 427abfa2

+32 -1
+29 -1
Documentation/watchdog/watchdog-api.txt
··· 110 110 ioctl(fd, WDIOC_GETTIMEOUT, &timeout); 111 111 printf("The timeout was is %d seconds\n", timeout); 112 112 113 - Envinronmental monitoring: 113 + Pretimeouts: 114 + 115 + Some watchdog timers can be set to have a trigger go off before the 116 + actual time they will reset the system. This can be done with an NMI, 117 + interrupt, or other mechanism. This allows Linux to record useful 118 + information (like panic information and kernel coredumps) before it 119 + resets. 120 + 121 + pretimeout = 10; 122 + ioctl(fd, WDIOC_SETPRETIMEOUT, &pretimeout); 123 + 124 + Note that the pretimeout is the number of seconds before the time 125 + when the timeout will go off. It is not the number of seconds until 126 + the pretimeout. So, for instance, if you set the timeout to 60 seconds 127 + and the pretimeout to 10 seconds, the pretimout will go of in 50 128 + seconds. Setting a pretimeout to zero disables it. 129 + 130 + There is also a get function for getting the pretimeout: 131 + 132 + ioctl(fd, WDIOC_GETPRETIMEOUT, &timeout); 133 + printf("The pretimeout was is %d seconds\n", timeout); 134 + 135 + Not all watchdog drivers will support a pretimeout. 136 + 137 + Environmental monitoring: 114 138 115 139 All watchdog drivers are required return more information about the system, 116 140 some do temperature, fan and power level monitoring, some can tell you ··· 192 168 The watchdog saw a keepalive ping since it was last queried. 193 169 194 170 WDIOF_SETTIMEOUT Can set/get the timeout 171 + 172 + The watchdog can do pretimeouts. 173 + 174 + WDIOF_PRETIMEOUT Pretimeout (in seconds), get/set 195 175 196 176 197 177 For those drivers that return any bits set in the option field, the
+3
include/linux/watchdog.h
··· 28 28 #define WDIOC_KEEPALIVE _IOR(WATCHDOG_IOCTL_BASE, 5, int) 29 29 #define WDIOC_SETTIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 6, int) 30 30 #define WDIOC_GETTIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 7, int) 31 + #define WDIOC_SETPRETIMEOUT _IOWR(WATCHDOG_IOCTL_BASE, 8, int) 32 + #define WDIOC_GETPRETIMEOUT _IOR(WATCHDOG_IOCTL_BASE, 9, int) 31 33 32 34 #define WDIOF_UNKNOWN -1 /* Unknown flag error */ 33 35 #define WDIOS_UNKNOWN -1 /* Unknown status error */ ··· 43 41 #define WDIOF_POWEROVER 0x0040 /* Power over voltage */ 44 42 #define WDIOF_SETTIMEOUT 0x0080 /* Set timeout (in seconds) */ 45 43 #define WDIOF_MAGICCLOSE 0x0100 /* Supports magic close char */ 44 + #define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ 46 45 #define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ 47 46 48 47 #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */