History log of /linux-master/drivers/watchdog/softdog.c
Revision Date Author Comments
# 36a8947c 08-Jul-2020 Woody Lin <woodylin@google.com>

watchdog: softdog: Add options 'soft_reboot_cmd' and 'soft_active_on_boot'

Add module parameters 'soft_reboot_cmd' and 'soft_active_on_boot' for
customizing softdog configuration; config reboot command by assigning
soft_reboot_cmd, and set soft_active_on_boot to start up softdog
timer at module initialization stage.

Signed-off-by: Woody Lin <woodylin@google.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/20200708083218.3157213-1-woodylin@google.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# d0173278 20-Jun-2019 Guenter Roeck <linux@roeck-us.net>

watchdog: convert remaining drivers to use SPDX license identifier

This gets rid of the unnecessary license boilerplate, and avoids
having to deal with individual patches one by one.

No functional changes.

Reviewed-by: Jerry Hoemann <jerry.hoemann@hpe.com>
Acked-by: Sylvain Lemieux <slemieux.tyco@gmail.com>
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>


# 8d5755b3 27-Feb-2017 Niklas Cassel <niklas.cassel@axis.com>

watchdog: softdog: fire watchdog even if softirqs do not get to run

Checking for timer expiration is done from the softirq TIMER_SOFTIRQ.

Since commit 4cd13c21b207 ("softirq: Let ksoftirqd do its job"),
pending softirqs are no longer always handled immediately, instead,
if there are pending softirqs, and ksoftirqd is in state TASK_RUNNING,
the handling of the softirqs are deferred, and are instead supposed
to be handled by ksoftirqd, when ksoftirqd gets scheduled.

If a user space process with a real-time policy starts to misbehave
by never relinquishing the CPU while ksoftirqd is in state TASK_RUNNING,
what will happen is that all softirqs will get deferred, while ksoftirqd,
which is supposed to handle the deferred softirqs, will never get to run.

To make sure that the watchdog is able to fire even when we do not get
to run softirqs, replace the timers with hrtimers.

Signed-off-by: Niklas Cassel <niklas.cassel@axis.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 4cbc6902 07-Feb-2017 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: make pretimeout support a compile option

It occurred to me that the panic pretimeout governor will stall the
softdog, because it is purely software which simply breaks when the
kernel panics. Testing governors with the softdog on the other hand is
really useful, so make this feature a compile time option which nees to
be enabled explicitly. This also removes the overhead if pretimeout
support is not used because it will now be compiled away (saving ~10% on
ARM32).

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>


# 2accf320 07-Oct-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: implement pretimeout support

Give devices which do not have hardware support for pretimeout at least a
software version of it.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 85f15cfc 01-Sep-2016 Julia Lawall <Julia.Lawall@lip6.fr>

watchdog: constify watchdog_ops structures

Check for watchdog_ops structures that are only stored in the ops field of
a watchdog_device structure. This field is declared const, so watchdog_ops
structures that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct watchdog_ops i@p = { ... };

@ok@
identifier r.i;
struct watchdog_device e;
position p;
@@
e.ops = &i@p;

@bad@
position p != {r.p,ok.p};
identifier r.i;
struct watchdog_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct watchdog_ops i = { ... };
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 4a23e2bf 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: improve coding style

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 61a21274 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: drop superfluous set_timeout callback

If we leave set_timeout empty, the core will do exactly what is
implemented here anyway.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# e65c5825 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: sort includes to avoid duplicates

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 44ba0f04 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: remove forward declaration

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 0efc70b8 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: consistently use softdog_ prefix

And move module_init/exit to the proper place while here.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# e8cf96ab 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: use watchdog core to init timeout value

Error string and comment say we fall back to a default, but in reality
we bailed out. Refactor the code to use the core helper which then
matches the described behaviour. While updating the init message anyhow,
shorten it while we are here; no need for versioning there as well and
the name is already given via pr_fmt.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 9c963ba0 25-May-2016 Wolfram Sang <wsa+renesas@sang-engineering.com>

watchdog: softdog: remove obsolete comments

The history is obsolete, especially since we switched to watchdog
framework. The section markers also don't make sense anymore given
the small size of the driver.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 5889f06b 17-Dec-2015 Li RongQing <roy.qing.li@gmail.com>

watchdog: refuse to unload softdog module when its timer is running

the softdog has static variables which are accessed if its timer is
still running after the driver is unloaded. and lead to crash:

$modprobe softdog
$echo 1 >/dev/watchdog
$modprobe -r softdog

CPU 20 Unable to handle kernel paging request at virtual address
Oops[#1]:
CPU: 20 PID: 0 Comm: swapper/20 Not tainted 4.1.13-WR8.0.0.0_standard
...
Modules linked in: [last unloaded: softdog]
....
Call Trace:
[<ffffffff801e142c>] cascade+0x34/0xb0
[<ffffffff801e1964>] run_timer_softirq+0x30c/0x368
[<ffffffff80181044>] __do_softirq+0x1ec/0x418
[<ffffffff801815d0>] irq_exit+0x90/0x98
[<ffffffff8010749c>] plat_irq_dispatch+0xa4/0x140
[<ffffffff80152740>] ret_from_irq+0x0/0x4
[<ffffffff801529e0>] __r4k_wait+0x20/0x40
[<ffffffff801c2278>] cpu_startup_entry+0x2a0/0x368
[<ffffffff8015fa64>] start_secondary+0x444/0x4d8

add the module ref when timer is running to avoid to unload the softdog
module

Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 84ebcc17 20-Nov-2015 Damien Riegel <damien.riegel@savoirfairelinux.com>

watchdog: softdog: use core reboot notifier

Get rid of the custom reboot notifier block registration and use the one
provided by the watchdog core.

Signed-off-by: Damien Riegel <damien.riegel@savoirfairelinux.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Vivien Didelot <vivien.didelot@savoirlinux.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 5f5e1909 26-Feb-2014 Jingoo Han <jg1.han@samsung.com>

watchdog: fix checkpatch warnings and error

Fix the following checkpatch warnings and error:
WARNING: quoted string split across lines
WARNING: braces {} are not necessary for single statement blocks
WARNING: __initdata should be placed after ibmasr_id_table[]
WARNING: please, no space before tabs
ERROR: do not initialise statics to 0 or NULL

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 9539210e 19-Nov-2013 Guenter Roeck <linux@roeck-us.net>

watchdog: Drop unnecessary include of miscdevice.h

After commit 487722cf2 (watchdog: Get rid of MODULE_ALIAS_MISCDEV
statements) the affected drivers no longer need to include miscdevice.h.
Only exception is rt2880_wdt.c which never needed it.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 487722cf 21-Oct-2013 Jean Delvare <jdelvare@suse.de>

watchdog: Get rid of MODULE_ALIAS_MISCDEV statements

I just can't find any value in MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR)
and MODULE_ALIAS_MISCDEV(TEMP_MINOR) statements.

Either the device is enumerated and the driver already has a module
alias (e.g. PCI, USB etc.) that will get the right driver loaded
automatically.

Or the device is not enumerated and loading its driver will lead to
more or less intrusive hardware poking. Such hardware poking should be
limited to a bare minimum, so the user should really decide which
drivers should be tried and in what order. Trying them all in
arbitrary order can't do any good.

On top of that, loading that many drivers at once bloats the kernel
log. Also many drivers will stay loaded afterward, bloating the output
of "lsmod" and wasting memory. Some modules (cs5535_mfgpt which gets
loaded as a dependency) can't even be unloaded!

If defining char-major-10-130 is needed then it should happen in
user-space.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Mike Frysinger <vapier.adi@gmail.com>
Cc: Wan ZongShun <mcuos.com@gmail.com>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Cc: Zwane Mwaikambo <zwane@arm.linux.org.uk>
Cc: Jim Cromie <jim.cromie@gmail.com>


# 086f3ec1 26-Mar-2013 Kim, Milo <Milo.Kim@ti.com>

watchdog: softdog: remove replaceable ping operation

In watchdog_ping(), 'start' is called automatically when 'ping' function call
is not configured.
Softdog driver has same handling in both cases - start and ping, so 'ping' OPS
can be removed.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# a5132caf 28-Feb-2012 Alan Cox <alan@linux.intel.com>

watchdog: softdog: convert to watchdog core

Convert softdog.c to the new watchdog API.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 86a1e189 05-Mar-2012 Wim Van Sebroeck <wim@iguana.be>

watchdog: nowayout is bool

nowayout is actually a boolean value.
So make it bool for all watchdog device drivers.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 27c766aa 15-Feb-2012 Joe Perches <joe@perches.com>

watchdog: Use pr_<fmt> and pr_<level>

Use the current logging styles.

Make sure all output has a prefix.
Add missing newlines.
Remove now unnecessary PFX, NAME, and miscellaneous other #defines.
Coalesce formats.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 7fff4beb 28-Mar-2011 Anithra P Janakiraman <anithra@linux.vnet.ibm.com>

watchdog: softdog.c: enhancement to optionally invoke panic instead of reboot on timer expiry

This is needed for determining the reason for failure when a softdog
timeout occurs.

We use softdog to watch for critical application failures and at the
minimum a snapshot of the system would help to determine the cause. In
such a scenario the application could fail but there isn't a softlockup as
such, hence the detect softlockup feature does not help.

The patch adds a module parameter soft_panic which when set to 1 causes
softdog to invoke panic instead of reboot when the softdog timer expires.
By invoking panic we execute kdump if it is configured and the vmcore
generated by kdump should provide atleast a minimal idea of the reason for
failure.

Based on an original patch by Ken Sugawara <sugaken.r3@gmail.com>
Signed-off-by: Anithra P J <anithra@linux.vnet.ibm.com>
Reviewed-by: WANG Cong <xiyou.wangcong@gmail.com>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# 5f3b2756 23-Feb-2011 Wim Van Sebroeck <wim@iguana.be>

watchdog: cleanup spaces before tabs

cleanup spaces before tabs in drivers/watchdog/

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# a77dba7e 14-Apr-2009 Wim Van Sebroeck <wim@iguana.be>

[WATCHDOG] Some more general cleanup

Clean-up the watchdog drivers so that checkpatch.pl get's happy...

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 143a2e54 18-Mar-2009 Wim Van Sebroeck <wim@iguana.be>

[WATCHDOG] More coding-style and trivial clean-up

Some more cleaning-up of the watchdog drivers.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 29fa0586 27-Oct-2008 Alan Cox <alan@lxorguk.ukuu.org.uk>

[PATCH] Switch all my contributions stuff to a single common address

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# 0c06090c 18-Jul-2008 Wim Van Sebroeck <wim@iguana.be>

[WATCHDOG] Coding style - Indentation - part 2

This brings the watchdog drivers into line with coding style.
This patch takes cares of the indentation as described in chapter 1.
Main changes:
* Re-structure the ioctl switch call for all drivers as follows:
switch (cmd) {
case WDIOC_GETSUPPORT:
case WDIOC_GETSTATUS:
case WDIOC_GETBOOTSTATUS:
case WDIOC_GETTEMP:
case WDIOC_SETOPTIONS:
case WDIOC_KEEPALIVE:
case WDIOC_SETTIMEOUT:
case WDIOC_GETTIMEOUT:
case WDIOC_GETTIMELEFT:
default:
}

This to make the migration from the drivers to the uniform watchdog
device driver easier in the future.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# f92d3749 19-May-2008 Alan Cox <alan@redhat.com>

[WATCHDOG 47/57] softdog: clean up, coding style and switch to unlocked_ioctl

Review and switch to unlocked_ioctl

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>


# b7e04f8c 17-Aug-2007 Wim Van Sebroeck <wim@iguana.be>

mv watchdog tree under drivers

move watchdog tree from drivers/char/watchdog to drivers/watchdog.

Signed-off-by: Wim Van Sebroeck <wim@iguana.be>