// SPDX-License-Identifier: GPL-2.0+ /* * SoftDog: A Software Watchdog Device * * (c) Copyright 1996 Alan Cox <alan@lxorguk.ukuu.org.uk>, * All Rights Reserved. * * Neither Alan Cox nor CymruNet Ltd. admit liability nor provide * warranty for any of this software. This material is provided * "AS-IS" and at no charge. * * (c) Copyright 1995 Alan Cox <alan@lxorguk.ukuu.org.uk> * * Software only watchdog driver. Unlike its big brother the WDT501P * driver this won't always recover a failed machine.
*/
staticbool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
staticint soft_noboot;
module_param(soft_noboot, int, 0);
MODULE_PARM_DESC(soft_noboot, "Softdog action, set to 1 to ignore reboots, 0 to reboot (default=0)");
staticint soft_panic;
module_param(soft_panic, int, 0);
MODULE_PARM_DESC(soft_panic, "Softdog action, set to 1 to panic, 0 to reboot (default=0)");
staticchar *soft_reboot_cmd;
module_param(soft_reboot_cmd, charp, 0000);
MODULE_PARM_DESC(soft_reboot_cmd, "Set reboot command. Emergency reboot takes place if unset");
staticbool soft_active_on_boot;
module_param(soft_active_on_boot, bool, 0000);
MODULE_PARM_DESC(soft_active_on_boot, "Set to true to active Softdog on boot (default=false)");
module_put(THIS_MODULE); if (soft_noboot) {
pr_crit("Triggered - Reboot ignored\n");
} elseif (soft_panic) {
pr_crit("Initiating panic\n");
panic("Software Watchdog Timer expired");
} else {
pr_crit("Initiating system reboot\n"); if (!soft_reboot_fired && soft_reboot_cmd != NULL) { static DECLARE_WORK(reboot_work, reboot_work_fn); /* * The 'kernel_restart' is a 'might-sleep' operation. * Also, executing it in system-wide workqueues blocks * any driver from using the same workqueue in its * shutdown callback function. Thus, we should execute * the 'kernel_restart' in a standalone kernel thread. * But since starting a kernel thread is also a * 'might-sleep' operation, so the 'reboot_work' is * required as a launcher of the kernel thread. * * After request the reboot, restart the timer to * schedule an 'emergency_restart' reboot after * 'TIMER_MARGIN' seconds. It's because if the softdog * hangs, it might be because of scheduling issues. And * if that is the case, both 'schedule_work' and * 'kernel_restart' may possibly be malfunctional at the * same time.
*/
soft_reboot_fired = true;
schedule_work(&reboot_work);
hrtimer_add_expires_ns(timer,
(u64)TIMER_MARGIN * NSEC_PER_SEC);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.