* [PATCH v4 0/2] Add stop_on_panic support for watchdog @ 2025-03-05 10:10 George Cherian 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian ` (3 more replies) 0 siblings, 4 replies; 21+ messages in thread From: George Cherian @ 2025-03-05 10:10 UTC (permalink / raw) To: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat Cc: linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches, George Cherian This series adds a new kernel command line option to watchdog core to stop the watchdog on panic. This is useul in certain systems which prevents successful loading of kdump kernel due to watchdog reset. Some of the watchdog drivers stop function could sleep. For such drivers the stop_on_panic is not valid as the notifier callback happens in atomic context. Introduce WDIOF_STOP_MAYSLEEP flag to watchdog_info options to indicate whether the stop function would sleep. Changelog: v1 -> v2 - Remove the per driver flag setting option - Take the parameter via kernel command-line parameter to watchdog_core. v2 -> v3 - Remove the helper function watchdog_stop_on_panic() from watchdog.h. - There are no users for this. v3 -> v4 - Since the panic notifier is in atomic context, watchdog functions which sleep can't be called. - Add an options flag WDIOF_STOP_MAYSLEEP to indicate whether stop function sleeps. - Simplify the stop_on_panic kernel command line parsing. - Enable the panic notiffier only if the watchdog stop function doesn't sleep George Cherian (2): watchdog: Add a new flag WDIOF_STOP_MAYSLEEP drivers: watchdog: Add support for panic notifier callback drivers/watchdog/advantech_ec_wdt.c | 3 ++- drivers/watchdog/arm_smc_wdt.c | 3 ++- drivers/watchdog/armada_37xx_wdt.c | 2 +- drivers/watchdog/asm9260_wdt.c | 2 +- drivers/watchdog/bcm47xx_wdt.c | 3 ++- drivers/watchdog/bd9576_wdt.c | 2 +- drivers/watchdog/bd96801_wdt.c | 2 +- drivers/watchdog/cgbc_wdt.c | 2 +- drivers/watchdog/cros_ec_wdt.c | 5 ++++- drivers/watchdog/da9052_wdt.c | 3 ++- drivers/watchdog/da9055_wdt.c | 4 +++- drivers/watchdog/da9062_wdt.c | 4 +++- drivers/watchdog/da9063_wdt.c | 4 +++- drivers/watchdog/db8500_wdt.c | 5 ++++- drivers/watchdog/dw_wdt.c | 5 +++-- drivers/watchdog/f71808e_wdt.c | 3 ++- drivers/watchdog/gpio_wdt.c | 2 +- drivers/watchdog/i6300esb.c | 5 ++++- drivers/watchdog/imx_sc_wdt.c | 2 +- drivers/watchdog/intel-mid_wdt.c | 5 ++++- drivers/watchdog/it87_wdt.c | 5 ++++- drivers/watchdog/jz4740_wdt.c | 5 ++++- drivers/watchdog/kempld_wdt.c | 3 ++- drivers/watchdog/lenovo_se10_wdt.c | 5 ++++- drivers/watchdog/max77620_wdt.c | 5 ++++- drivers/watchdog/mei_wdt.c | 3 ++- drivers/watchdog/menf21bmc_wdt.c | 4 +++- drivers/watchdog/mlx_wdt.c | 2 +- drivers/watchdog/msc313e_wdt.c | 5 ++++- drivers/watchdog/npcm_wdt.c | 3 ++- drivers/watchdog/omap_wdt.c | 5 ++++- drivers/watchdog/pm8916_wdt.c | 5 +++-- drivers/watchdog/pseries-wdt.c | 2 +- drivers/watchdog/rave-sp-wdt.c | 5 ++++- drivers/watchdog/renesas_wdt.c | 7 ++++-- drivers/watchdog/retu_wdt.c | 5 ++++- drivers/watchdog/rn5t618_wdt.c | 6 +++-- drivers/watchdog/rzg2l_wdt.c | 5 ++++- drivers/watchdog/rzv2h_wdt.c | 5 ++++- drivers/watchdog/shwdt.c | 6 +++-- drivers/watchdog/sl28cpld_wdt.c | 5 ++++- drivers/watchdog/softdog.c | 5 ++++- drivers/watchdog/sp805_wdt.c | 5 ++++- drivers/watchdog/starfive-wdt.c | 3 ++- drivers/watchdog/stpmic1_wdt.c | 5 ++++- drivers/watchdog/ts4800_wdt.c | 5 ++++- drivers/watchdog/twl4030_wdt.c | 5 ++++- drivers/watchdog/uniphier_wdt.c | 3 ++- drivers/watchdog/w83627hf_wdt.c | 5 ++++- drivers/watchdog/watchdog_core.c | 35 +++++++++++++++++++++++++++++ drivers/watchdog/wm831x_wdt.c | 5 ++++- drivers/watchdog/wm8350_wdt.c | 5 ++++- drivers/watchdog/xen_wdt.c | 5 ++++- drivers/watchdog/ziirave_wdt.c | 5 ++++- include/linux/watchdog.h | 2 ++ include/uapi/linux/watchdog.h | 1 + 56 files changed, 198 insertions(+), 58 deletions(-) -- 2.34.1 ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:10 [PATCH v4 0/2] Add stop_on_panic support for watchdog George Cherian @ 2025-03-05 10:10 ` George Cherian 2025-03-05 10:18 ` Marek Behún ` (3 more replies) 2025-03-05 10:10 ` [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback George Cherian ` (2 subsequent siblings) 3 siblings, 4 replies; 21+ messages in thread From: George Cherian @ 2025-03-05 10:10 UTC (permalink / raw) To: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat Cc: linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches, George Cherian A new option flag is added to watchdog_info. This helps the watchdog core to check whether stop functions would sleep or not. The option flags of individual drivers are also updated accordingly. Signed-off-by: George Cherian <george.cherian@marvell.com> --- drivers/watchdog/advantech_ec_wdt.c | 3 ++- drivers/watchdog/arm_smc_wdt.c | 3 ++- drivers/watchdog/armada_37xx_wdt.c | 2 +- drivers/watchdog/asm9260_wdt.c | 2 +- drivers/watchdog/bcm47xx_wdt.c | 3 ++- drivers/watchdog/bd9576_wdt.c | 2 +- drivers/watchdog/bd96801_wdt.c | 2 +- drivers/watchdog/cgbc_wdt.c | 2 +- drivers/watchdog/cros_ec_wdt.c | 5 ++++- drivers/watchdog/da9052_wdt.c | 3 ++- drivers/watchdog/da9055_wdt.c | 4 +++- drivers/watchdog/da9062_wdt.c | 4 +++- drivers/watchdog/da9063_wdt.c | 4 +++- drivers/watchdog/db8500_wdt.c | 5 ++++- drivers/watchdog/dw_wdt.c | 5 +++-- drivers/watchdog/f71808e_wdt.c | 3 ++- drivers/watchdog/gpio_wdt.c | 2 +- drivers/watchdog/i6300esb.c | 5 ++++- drivers/watchdog/imx_sc_wdt.c | 2 +- drivers/watchdog/intel-mid_wdt.c | 5 ++++- drivers/watchdog/it87_wdt.c | 5 ++++- drivers/watchdog/jz4740_wdt.c | 5 ++++- drivers/watchdog/kempld_wdt.c | 3 ++- drivers/watchdog/lenovo_se10_wdt.c | 5 ++++- drivers/watchdog/max77620_wdt.c | 5 ++++- drivers/watchdog/mei_wdt.c | 3 ++- drivers/watchdog/menf21bmc_wdt.c | 4 +++- drivers/watchdog/mlx_wdt.c | 2 +- drivers/watchdog/msc313e_wdt.c | 5 ++++- drivers/watchdog/npcm_wdt.c | 3 ++- drivers/watchdog/omap_wdt.c | 5 ++++- drivers/watchdog/pm8916_wdt.c | 5 +++-- drivers/watchdog/pseries-wdt.c | 2 +- drivers/watchdog/rave-sp-wdt.c | 5 ++++- drivers/watchdog/renesas_wdt.c | 7 +++++-- drivers/watchdog/retu_wdt.c | 5 ++++- drivers/watchdog/rn5t618_wdt.c | 6 ++++-- drivers/watchdog/rzg2l_wdt.c | 5 ++++- drivers/watchdog/rzv2h_wdt.c | 5 ++++- drivers/watchdog/shwdt.c | 6 ++++-- drivers/watchdog/sl28cpld_wdt.c | 5 ++++- drivers/watchdog/softdog.c | 5 ++++- drivers/watchdog/sp805_wdt.c | 5 ++++- drivers/watchdog/starfive-wdt.c | 3 ++- drivers/watchdog/stpmic1_wdt.c | 5 ++++- drivers/watchdog/ts4800_wdt.c | 5 ++++- drivers/watchdog/twl4030_wdt.c | 5 ++++- drivers/watchdog/uniphier_wdt.c | 3 ++- drivers/watchdog/w83627hf_wdt.c | 5 ++++- drivers/watchdog/wm831x_wdt.c | 5 ++++- drivers/watchdog/wm8350_wdt.c | 5 ++++- drivers/watchdog/xen_wdt.c | 5 ++++- drivers/watchdog/ziirave_wdt.c | 5 ++++- include/uapi/linux/watchdog.h | 1 + 54 files changed, 161 insertions(+), 58 deletions(-) diff --git a/drivers/watchdog/advantech_ec_wdt.c b/drivers/watchdog/advantech_ec_wdt.c index 7c380f90ca58..5b62c675c2cb 100644 --- a/drivers/watchdog/advantech_ec_wdt.c +++ b/drivers/watchdog/advantech_ec_wdt.c @@ -131,7 +131,8 @@ static const struct watchdog_info adv_ec_wdt_info = { .identity = DRIVER_NAME, .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | - WDIOF_KEEPALIVEPING, + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops adv_ec_wdt_ops = { diff --git a/drivers/watchdog/arm_smc_wdt.c b/drivers/watchdog/arm_smc_wdt.c index 8f3d0c3a005f..794cf0086912 100644 --- a/drivers/watchdog/arm_smc_wdt.c +++ b/drivers/watchdog/arm_smc_wdt.c @@ -90,7 +90,8 @@ static const struct watchdog_info smcwd_info = { .identity = DRV_NAME, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | - WDIOF_MAGICCLOSE, + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops smcwd_ops = { diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_37xx_wdt.c index a17a7911771a..4e5ed9e1ed90 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -232,7 +232,7 @@ static int armada_37xx_wdt_stop(struct watchdog_device *wdt) } static const struct watchdog_info armada_37xx_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | WDIOF_STOP_MAYSLEEP, .identity = "Armada 37xx Watchdog", }; diff --git a/drivers/watchdog/asm9260_wdt.c b/drivers/watchdog/asm9260_wdt.c index 45047e514b8e..24402206659b 100644 --- a/drivers/watchdog/asm9260_wdt.c +++ b/drivers/watchdog/asm9260_wdt.c @@ -181,7 +181,7 @@ static int asm9260_restart(struct watchdog_device *wdd, unsigned long action, static const struct watchdog_info asm9260_wdt_ident = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING - | WDIOF_MAGICCLOSE, + | WDIOF_MAGICCLOSE | WDIOF_STOP_MAYSLEEP, .identity = "Alphascale asm9260 Watchdog", }; diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 06a54c7de40b..93771f12895e 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c @@ -162,7 +162,8 @@ static const struct watchdog_info bcm47xx_wdt_info = { .identity = DRV_NAME, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | - WDIOF_MAGICCLOSE, + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops bcm47xx_wdt_soft_ops = { diff --git a/drivers/watchdog/bd9576_wdt.c b/drivers/watchdog/bd9576_wdt.c index f00ea1b4e40b..876ac9636f32 100644 --- a/drivers/watchdog/bd9576_wdt.c +++ b/drivers/watchdog/bd9576_wdt.c @@ -68,7 +68,7 @@ static int bd9576_wdt_stop(struct watchdog_device *wdd) static const struct watchdog_info bd957x_wdt_ident = { .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | - WDIOF_SETTIMEOUT, + WDIOF_SETTIMEOUT | WDIOF_STOP_MAYSLEEP, .identity = "BD957x Watchdog", }; diff --git a/drivers/watchdog/bd96801_wdt.c b/drivers/watchdog/bd96801_wdt.c index 12b74fd2bc05..4985a4724a6b 100644 --- a/drivers/watchdog/bd96801_wdt.c +++ b/drivers/watchdog/bd96801_wdt.c @@ -89,7 +89,7 @@ static int bd96801_wdt_stop(struct watchdog_device *wdt) static const struct watchdog_info bd96801_wdt_info = { .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | - WDIOF_SETTIMEOUT, + WDIOF_SETTIMEOUT | WDIOF_STOP_MAYSLEEP, .identity = "BD96801 Watchdog", }; diff --git a/drivers/watchdog/cgbc_wdt.c b/drivers/watchdog/cgbc_wdt.c index 702b055ba6f4..3ec2d53bb8e0 100644 --- a/drivers/watchdog/cgbc_wdt.c +++ b/drivers/watchdog/cgbc_wdt.c @@ -151,7 +151,7 @@ static int cgbc_wdt_set_timeout(struct watchdog_device *wdd, static const struct watchdog_info cgbc_wdt_info = { .identity = "CGBC Watchdog", .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | - WDIOF_MAGICCLOSE | WDIOF_PRETIMEOUT + WDIOF_MAGICCLOSE | WDIOF_PRETIMEOUT | WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops cgbc_wdt_ops = { diff --git a/drivers/watchdog/cros_ec_wdt.c b/drivers/watchdog/cros_ec_wdt.c index ba045e29f9a5..5cefeb388ef5 100644 --- a/drivers/watchdog/cros_ec_wdt.c +++ b/drivers/watchdog/cros_ec_wdt.c @@ -107,7 +107,10 @@ static int cros_ec_wdt_set_timeout(struct watchdog_device *wdd, unsigned int t) } static const struct watchdog_info cros_ec_wdt_ident = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .firmware_version = 0, .identity = DRV_NAME, }; diff --git a/drivers/watchdog/da9052_wdt.c b/drivers/watchdog/da9052_wdt.c index 77039f2f0be5..ac6980342fcd 100644 --- a/drivers/watchdog/da9052_wdt.c +++ b/drivers/watchdog/da9052_wdt.c @@ -139,7 +139,8 @@ static const struct watchdog_info da9052_wdt_info = { WDIOF_KEEPALIVEPING | WDIOF_CARDRESET | WDIOF_OVERHEAT | - WDIOF_POWERUNDER, + WDIOF_POWERUNDER | + WDIOF_STOP_MAYSLEEP, .identity = "DA9052 Watchdog", }; diff --git a/drivers/watchdog/da9055_wdt.c b/drivers/watchdog/da9055_wdt.c index 9d5a2009466f..dbfe02647a62 100644 --- a/drivers/watchdog/da9055_wdt.c +++ b/drivers/watchdog/da9055_wdt.c @@ -105,7 +105,9 @@ static int da9055_wdt_stop(struct watchdog_device *wdt_dev) } static const struct watchdog_info da9055_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "DA9055 Watchdog", }; diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c index 426962547df1..06507af68f79 100644 --- a/drivers/watchdog/da9062_wdt.c +++ b/drivers/watchdog/da9062_wdt.c @@ -180,7 +180,9 @@ static int da9062_wdt_restart(struct watchdog_device *wdd, unsigned long action, } static const struct watchdog_info da9062_watchdog_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "DA9062 WDT", }; diff --git a/drivers/watchdog/da9063_wdt.c b/drivers/watchdog/da9063_wdt.c index 92e1b78ff481..ac7f5f14a21d 100644 --- a/drivers/watchdog/da9063_wdt.c +++ b/drivers/watchdog/da9063_wdt.c @@ -198,7 +198,9 @@ static int da9063_wdt_restart(struct watchdog_device *wdd, unsigned long action, } static const struct watchdog_info da9063_watchdog_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "DA9063 Watchdog", }; diff --git a/drivers/watchdog/db8500_wdt.c b/drivers/watchdog/db8500_wdt.c index 97148ac0aa54..dfcb671f1a3e 100644 --- a/drivers/watchdog/db8500_wdt.c +++ b/drivers/watchdog/db8500_wdt.c @@ -61,7 +61,10 @@ static int db8500_wdt_set_timeout(struct watchdog_device *wdd, } static const struct watchdog_info db8500_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "DB8500 WDT", .firmware_version = 1, }; diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c index 26efca9ae0e7..74cd691cf900 100644 --- a/drivers/watchdog/dw_wdt.c +++ b/drivers/watchdog/dw_wdt.c @@ -336,13 +336,14 @@ static unsigned int dw_wdt_get_timeleft(struct watchdog_device *wdd) static const struct watchdog_info dw_wdt_ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | - WDIOF_MAGICCLOSE, + WDIOF_MAGICCLOSE | WDIOF_STOP_MAYSLEEP, .identity = "Synopsys DesignWare Watchdog", }; static const struct watchdog_info dw_wdt_pt_ident = { .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | - WDIOF_PRETIMEOUT | WDIOF_MAGICCLOSE, + WDIOF_PRETIMEOUT | WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "Synopsys DesignWare Watchdog", }; diff --git a/drivers/watchdog/f71808e_wdt.c b/drivers/watchdog/f71808e_wdt.c index 6a16d3d0bb1e..4f47023d1992 100644 --- a/drivers/watchdog/f71808e_wdt.c +++ b/drivers/watchdog/f71808e_wdt.c @@ -469,7 +469,8 @@ static int fintek_wdt_probe(struct platform_device *pdev) wd->ident.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING - | WDIOF_CARDRESET; + | WDIOF_CARDRESET + | WDIOF_STOP_MAYSLEEP; snprintf(wd->ident.identity, sizeof(wd->ident.identity), "%s watchdog", diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c index a7b814ea740b..fc5143b14553 100644 --- a/drivers/watchdog/gpio_wdt.c +++ b/drivers/watchdog/gpio_wdt.c @@ -93,7 +93,7 @@ static int gpio_wdt_stop(struct watchdog_device *wdd) static const struct watchdog_info gpio_wdt_ident = { .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | - WDIOF_SETTIMEOUT, + WDIOF_SETTIMEOUT | WDIOF_STOP_MAYSLEEP, .identity = "GPIO Watchdog", }; diff --git a/drivers/watchdog/i6300esb.c b/drivers/watchdog/i6300esb.c index a30835f547b3..ccbfd610a1a8 100644 --- a/drivers/watchdog/i6300esb.c +++ b/drivers/watchdog/i6300esb.c @@ -190,7 +190,10 @@ static int esb_timer_set_heartbeat(struct watchdog_device *wdd, static struct watchdog_info esb_info = { .identity = ESB_MODULE_NAME, - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops esb_ops = { diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c index 1280b9b1ec2a..2b5e9db39528 100644 --- a/drivers/watchdog/imx_sc_wdt.c +++ b/drivers/watchdog/imx_sc_wdt.c @@ -172,7 +172,7 @@ static const struct watchdog_ops imx_sc_wdt_ops = { static struct watchdog_info imx_sc_wdt_info = { .identity = "i.MX SC watchdog timer", .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | - WDIOF_MAGICCLOSE, + WDIOF_MAGICCLOSE | WDIOF_STOP_MAYSLEEP, }; static int imx_sc_wdt_probe(struct platform_device *pdev) diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c index 756d262dc580..2f8446c8643a 100644 --- a/drivers/watchdog/intel-mid_wdt.c +++ b/drivers/watchdog/intel-mid_wdt.c @@ -112,7 +112,10 @@ static irqreturn_t mid_wdt_irq(int irq, void *dev_id) static const struct watchdog_info mid_wdt_info = { .identity = "Intel MID SCU watchdog", - .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE, + .options = WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops mid_wdt_ops = { diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c index a1e23dce8810..e4ce51978a8b 100644 --- a/drivers/watchdog/it87_wdt.c +++ b/drivers/watchdog/it87_wdt.c @@ -265,7 +265,10 @@ static const struct dmi_system_id it87_quirks[] = { }; static const struct watchdog_info ident = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .firmware_version = 1, .identity = WATCHDOG_NAME, }; diff --git a/drivers/watchdog/jz4740_wdt.c b/drivers/watchdog/jz4740_wdt.c index 395bde79e292..4cfdc367b7c2 100644 --- a/drivers/watchdog/jz4740_wdt.c +++ b/drivers/watchdog/jz4740_wdt.c @@ -112,7 +112,10 @@ static int jz4740_wdt_restart(struct watchdog_device *wdt_dev, } static const struct watchdog_info jz4740_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "jz4740 Watchdog", }; diff --git a/drivers/watchdog/kempld_wdt.c b/drivers/watchdog/kempld_wdt.c index e6c7a2906680..b1b8cc588d49 100644 --- a/drivers/watchdog/kempld_wdt.c +++ b/drivers/watchdog/kempld_wdt.c @@ -419,7 +419,8 @@ static const struct watchdog_info kempld_wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | - WDIOF_PRETIMEOUT + WDIOF_PRETIMEOUT | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops kempld_wdt_ops = { diff --git a/drivers/watchdog/lenovo_se10_wdt.c b/drivers/watchdog/lenovo_se10_wdt.c index cd0500e5080b..be5e27d4aa28 100644 --- a/drivers/watchdog/lenovo_se10_wdt.c +++ b/drivers/watchdog/lenovo_se10_wdt.c @@ -140,7 +140,10 @@ static int wdt_ping(struct watchdog_device *wdog) } static const struct watchdog_info wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "Lenovo SE10 Watchdog", }; diff --git a/drivers/watchdog/max77620_wdt.c b/drivers/watchdog/max77620_wdt.c index d3ced783a5f4..b6ed7f52c1c3 100644 --- a/drivers/watchdog/max77620_wdt.c +++ b/drivers/watchdog/max77620_wdt.c @@ -144,7 +144,10 @@ static int max77620_wdt_set_timeout(struct watchdog_device *wdt_dev, static const struct watchdog_info max77620_wdt_info = { .identity = "max77620-watchdog", - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops max77620_wdt_ops = { diff --git a/drivers/watchdog/mei_wdt.c b/drivers/watchdog/mei_wdt.c index c7a7235e6224..691df89d90b1 100644 --- a/drivers/watchdog/mei_wdt.c +++ b/drivers/watchdog/mei_wdt.c @@ -315,7 +315,8 @@ static struct watchdog_info wd_info = { .identity = INTEL_AMT_WATCHDOG_ID, .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | - WDIOF_ALARMONLY, + WDIOF_ALARMONLY | + WDIOF_STOP_MAYSLEEP, }; /** diff --git a/drivers/watchdog/menf21bmc_wdt.c b/drivers/watchdog/menf21bmc_wdt.c index 81ebdfc371f4..589313d82a16 100644 --- a/drivers/watchdog/menf21bmc_wdt.c +++ b/drivers/watchdog/menf21bmc_wdt.c @@ -99,7 +99,9 @@ static int menf21bmc_wdt_ping(struct watchdog_device *wdt) } static const struct watchdog_info menf21bmc_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = DEVNAME, }; diff --git a/drivers/watchdog/mlx_wdt.c b/drivers/watchdog/mlx_wdt.c index 5dc69363f06a..38452f97b79f 100644 --- a/drivers/watchdog/mlx_wdt.c +++ b/drivers/watchdog/mlx_wdt.c @@ -24,7 +24,7 @@ #define MLXREG_WDT_MAX_TIMEOUT_TYPE3 65535 #define MLXREG_WDT_MIN_TIMEOUT 1 #define MLXREG_WDT_OPTIONS_BASE (WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | \ - WDIOF_SETTIMEOUT) + WDIOF_SETTIMEOUT | WDIOF_STOP_MAYSLEEP) /** * struct mlxreg_wdt - wd private data: diff --git a/drivers/watchdog/msc313e_wdt.c b/drivers/watchdog/msc313e_wdt.c index 90171431fc59..532f575f48bd 100644 --- a/drivers/watchdog/msc313e_wdt.c +++ b/drivers/watchdog/msc313e_wdt.c @@ -77,7 +77,10 @@ static int msc313e_wdt_settimeout(struct watchdog_device *wdev, unsigned int new static const struct watchdog_info msc313e_wdt_ident = { .identity = "MSC313e watchdog", - .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, + .options = WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops msc313e_wdt_ops = { diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c index a5dd1c230137..4988be7db94c 100644 --- a/drivers/watchdog/npcm_wdt.c +++ b/drivers/watchdog/npcm_wdt.c @@ -176,7 +176,8 @@ static const struct watchdog_info npcm_wdt_info = { .identity = KBUILD_MODNAME, .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING - | WDIOF_MAGICCLOSE, + | WDIOF_MAGICCLOSE + | WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops npcm_wdt_ops = { diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index d523428a8d22..7b0a2b7c3694 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -213,7 +213,10 @@ static unsigned int omap_wdt_get_timeleft(struct watchdog_device *wdog) } static const struct watchdog_info omap_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "OMAP Watchdog", }; diff --git a/drivers/watchdog/pm8916_wdt.c b/drivers/watchdog/pm8916_wdt.c index 007ed139ab96..d384803f0fab 100644 --- a/drivers/watchdog/pm8916_wdt.c +++ b/drivers/watchdog/pm8916_wdt.c @@ -117,14 +117,15 @@ static irqreturn_t pm8916_wdt_isr(int irq, void *arg) static const struct watchdog_info pm8916_wdt_ident = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | - WDIOF_OVERHEAT | WDIOF_CARDRESET | WDIOF_POWERUNDER, + WDIOF_OVERHEAT | WDIOF_CARDRESET | WDIOF_POWERUNDER | + WDIOF_STOP_MAYSLEEP, .identity = "QCOM PM8916 PON WDT", }; static const struct watchdog_info pm8916_wdt_pt_ident = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | WDIOF_OVERHEAT | WDIOF_CARDRESET | WDIOF_POWERUNDER | - WDIOF_PRETIMEOUT, + WDIOF_PRETIMEOUT | WDIOF_STOP_MAYSLEEP, .identity = "QCOM PM8916 PON WDT", }; diff --git a/drivers/watchdog/pseries-wdt.c b/drivers/watchdog/pseries-wdt.c index 7f53b5293409..7f0b7a111e38 100644 --- a/drivers/watchdog/pseries-wdt.c +++ b/drivers/watchdog/pseries-wdt.c @@ -133,7 +133,7 @@ static int pseries_wdt_stop(struct watchdog_device *wdd) static struct watchdog_info pseries_wdt_info = { .identity = DRV_NAME, .options = WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT - | WDIOF_PRETIMEOUT, + | WDIOF_PRETIMEOUT | WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops pseries_wdt_ops = { diff --git a/drivers/watchdog/rave-sp-wdt.c b/drivers/watchdog/rave-sp-wdt.c index 5d1c2176d445..3b366196a1ca 100644 --- a/drivers/watchdog/rave-sp-wdt.c +++ b/drivers/watchdog/rave-sp-wdt.c @@ -211,7 +211,10 @@ static int rave_sp_wdt_ping(struct watchdog_device *wdd) } static const struct watchdog_info rave_sp_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "RAVE SP Watchdog", }; diff --git a/drivers/watchdog/renesas_wdt.c b/drivers/watchdog/renesas_wdt.c index c0b2a9c5250d..e328f0b6915e 100644 --- a/drivers/watchdog/renesas_wdt.c +++ b/drivers/watchdog/renesas_wdt.c @@ -158,8 +158,11 @@ static int rwdt_restart(struct watchdog_device *wdev, unsigned long action, } static const struct watchdog_info rwdt_ident = { - .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | - WDIOF_CARDRESET, + .options = WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT | + WDIOF_CARDRESET | + WDIOF_STOP_MAYSLEEP, .identity = "Renesas WDT Watchdog", }; diff --git a/drivers/watchdog/retu_wdt.c b/drivers/watchdog/retu_wdt.c index 2b9017e1cd91..1ff740a97d96 100644 --- a/drivers/watchdog/retu_wdt.c +++ b/drivers/watchdog/retu_wdt.c @@ -87,7 +87,10 @@ static int retu_wdt_set_timeout(struct watchdog_device *wdog, } static const struct watchdog_info retu_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "Retu watchdog", }; diff --git a/drivers/watchdog/rn5t618_wdt.c b/drivers/watchdog/rn5t618_wdt.c index 87d06d210ac9..db56540e5d94 100644 --- a/drivers/watchdog/rn5t618_wdt.c +++ b/drivers/watchdog/rn5t618_wdt.c @@ -125,8 +125,10 @@ static int rn5t618_wdt_ping(struct watchdog_device *wdt_dev) } static const struct watchdog_info rn5t618_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | - WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = DRIVER_NAME, }; diff --git a/drivers/watchdog/rzg2l_wdt.c b/drivers/watchdog/rzg2l_wdt.c index 11bbe48160ec..b3569c881abe 100644 --- a/drivers/watchdog/rzg2l_wdt.c +++ b/drivers/watchdog/rzg2l_wdt.c @@ -219,7 +219,10 @@ static int rzg2l_wdt_restart(struct watchdog_device *wdev, } static const struct watchdog_info rzg2l_wdt_ident = { - .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, + .options = WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT | + WDIOF_STOP_MAYSLEEP, .identity = "Renesas RZ/G2L WDT Watchdog", }; diff --git a/drivers/watchdog/rzv2h_wdt.c b/drivers/watchdog/rzv2h_wdt.c index 8defd0241213..8c96e872e2a2 100644 --- a/drivers/watchdog/rzv2h_wdt.c +++ b/drivers/watchdog/rzv2h_wdt.c @@ -135,7 +135,10 @@ static int rzv2h_wdt_stop(struct watchdog_device *wdev) } static const struct watchdog_info rzv2h_wdt_ident = { - .options = WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT, + .options = WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT | + WDIOF_STOP_MAYSLEEP, .identity = "Renesas RZ/V2H WDT Watchdog", }; diff --git a/drivers/watchdog/shwdt.c b/drivers/watchdog/shwdt.c index 7f0150c39421..246ff99af3be 100644 --- a/drivers/watchdog/shwdt.c +++ b/drivers/watchdog/shwdt.c @@ -194,8 +194,10 @@ static void sh_wdt_ping(struct timer_list *t) } static const struct watchdog_info sh_wdt_info = { - .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT | - WDIOF_MAGICCLOSE, + .options = WDIOF_KEEPALIVEPING | + WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .firmware_version = 1, .identity = "SH WDT", }; diff --git a/drivers/watchdog/sl28cpld_wdt.c b/drivers/watchdog/sl28cpld_wdt.c index 8630c29818f2..bee1f597615c 100644 --- a/drivers/watchdog/sl28cpld_wdt.c +++ b/drivers/watchdog/sl28cpld_wdt.c @@ -104,7 +104,10 @@ static int sl28cpld_wdt_set_timeout(struct watchdog_device *wdd, } static const struct watchdog_info sl28cpld_wdt_info = { - .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .options = WDIOF_MAGICCLOSE | + WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "sl28cpld watchdog", }; diff --git a/drivers/watchdog/softdog.c b/drivers/watchdog/softdog.c index 7a1096265f18..4cc481157a5d 100644 --- a/drivers/watchdog/softdog.c +++ b/drivers/watchdog/softdog.c @@ -162,7 +162,10 @@ static int softdog_stop(struct watchdog_device *w) static struct watchdog_info softdog_info = { .identity = "Software Watchdog", - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops softdog_ops = { diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index c2125f204a13..fed64b4ba991 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -214,7 +214,10 @@ static int wdt_disable(struct watchdog_device *wdd) } static const struct watchdog_info wdt_info = { - .options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, + .options = WDIOF_MAGICCLOSE | + WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = MODULE_NAME, }; diff --git a/drivers/watchdog/starfive-wdt.c b/drivers/watchdog/starfive-wdt.c index 355918d62f63..46aebeeca2ee 100644 --- a/drivers/watchdog/starfive-wdt.c +++ b/drivers/watchdog/starfive-wdt.c @@ -409,7 +409,8 @@ static int starfive_wdt_set_timeout(struct watchdog_device *wdd, return 0; } -#define STARFIVE_WDT_OPTIONS (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE) +#define STARFIVE_WDT_OPTIONS (WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | \ + WDIOF_MAGICCLOSE | WDIOF_STOP_MAYSLEEP) static const struct watchdog_info starfive_wdt_info = { .options = STARFIVE_WDT_OPTIONS, diff --git a/drivers/watchdog/stpmic1_wdt.c b/drivers/watchdog/stpmic1_wdt.c index 45d0c543466f..2783ebd74a54 100644 --- a/drivers/watchdog/stpmic1_wdt.c +++ b/drivers/watchdog/stpmic1_wdt.c @@ -67,7 +67,10 @@ static int pmic_wdt_set_timeout(struct watchdog_device *wdd, } static const struct watchdog_info pmic_watchdog_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "STPMIC1 PMIC Watchdog", }; diff --git a/drivers/watchdog/ts4800_wdt.c b/drivers/watchdog/ts4800_wdt.c index 24b1ad52102e..2a3b917be46a 100644 --- a/drivers/watchdog/ts4800_wdt.c +++ b/drivers/watchdog/ts4800_wdt.c @@ -100,7 +100,10 @@ static const struct watchdog_ops ts4800_wdt_ops = { }; static const struct watchdog_info ts4800_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "TS-4800 Watchdog", }; diff --git a/drivers/watchdog/twl4030_wdt.c b/drivers/watchdog/twl4030_wdt.c index 8c80d04811e4..b80098bf23f7 100644 --- a/drivers/watchdog/twl4030_wdt.c +++ b/drivers/watchdog/twl4030_wdt.c @@ -45,7 +45,10 @@ static int twl4030_wdt_set_timeout(struct watchdog_device *wdt, } static const struct watchdog_info twl4030_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "TWL4030 Watchdog", }; diff --git a/drivers/watchdog/uniphier_wdt.c b/drivers/watchdog/uniphier_wdt.c index 8e9242c23022..b2e7840c0f61 100644 --- a/drivers/watchdog/uniphier_wdt.c +++ b/drivers/watchdog/uniphier_wdt.c @@ -168,7 +168,8 @@ static const struct watchdog_info uniphier_wdt_info = { .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE | - WDIOF_OVERHEAT, + WDIOF_OVERHEAT | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops uniphier_wdt_ops = { diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index bc33b63c5a5d..139adb8eee7a 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c @@ -314,7 +314,10 @@ static unsigned int wdt_get_time(struct watchdog_device *wdog) */ static const struct watchdog_info wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "W83627HF Watchdog", }; diff --git a/drivers/watchdog/wm831x_wdt.c b/drivers/watchdog/wm831x_wdt.c index d96ad8f38bd2..a7ce9c797725 100644 --- a/drivers/watchdog/wm831x_wdt.c +++ b/drivers/watchdog/wm831x_wdt.c @@ -156,7 +156,10 @@ static int wm831x_wdt_set_timeout(struct watchdog_device *wdt_dev, } static const struct watchdog_info wm831x_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "WM831x Watchdog", }; diff --git a/drivers/watchdog/wm8350_wdt.c b/drivers/watchdog/wm8350_wdt.c index c82c1b77d91b..476a6e8dcf7d 100644 --- a/drivers/watchdog/wm8350_wdt.c +++ b/drivers/watchdog/wm8350_wdt.c @@ -117,7 +117,10 @@ static int wm8350_wdt_ping(struct watchdog_device *wdt_dev) } static const struct watchdog_info wm8350_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, .identity = "WM8350 Watchdog", }; diff --git a/drivers/watchdog/xen_wdt.c b/drivers/watchdog/xen_wdt.c index b343f421dc72..0248d9c8c451 100644 --- a/drivers/watchdog/xen_wdt.c +++ b/drivers/watchdog/xen_wdt.c @@ -99,7 +99,10 @@ static unsigned int xen_wdt_get_timeleft(struct watchdog_device *wdd) static struct watchdog_info xen_wdt_info = { .identity = DRV_NAME, - .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, + .options = WDIOF_SETTIMEOUT | + WDIOF_KEEPALIVEPING | + WDIOF_MAGICCLOSE | + WDIOF_STOP_MAYSLEEP, }; static const struct watchdog_ops xen_wdt_ops = { diff --git a/drivers/watchdog/ziirave_wdt.c b/drivers/watchdog/ziirave_wdt.c index fcc1ba02e75b..ee42099c8b46 100644 --- a/drivers/watchdog/ziirave_wdt.c +++ b/drivers/watchdog/ziirave_wdt.c @@ -417,7 +417,10 @@ static int ziirave_firm_upload(struct watchdog_device *wdd, } static const struct watchdog_info ziirave_wdt_info = { - .options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING, + .options = WDIOF_SETTIMEOUT | + WDIOF_MAGICCLOSE | + WDIOF_KEEPALIVEPING | + WDIOF_STOP_MAYSLEEP, .identity = "RAVE Switch Watchdog", }; diff --git a/include/uapi/linux/watchdog.h b/include/uapi/linux/watchdog.h index b15cde5c9054..83b6407c712f 100644 --- a/include/uapi/linux/watchdog.h +++ b/include/uapi/linux/watchdog.h @@ -48,6 +48,7 @@ struct watchdog_info { #define WDIOF_PRETIMEOUT 0x0200 /* Pretimeout (in seconds), get/set */ #define WDIOF_ALARMONLY 0x0400 /* Watchdog triggers a management or other external alarm not a reboot */ +#define WDIOF_STOP_MAYSLEEP 0x0800 /* Watchdog Stop may sleep */ #define WDIOF_KEEPALIVEPING 0x8000 /* Keep alive ping reply */ #define WDIOS_DISABLECARD 0x0001 /* Turn off the watchdog timer */ -- 2.34.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian @ 2025-03-05 10:18 ` Marek Behún 2025-03-05 10:34 ` George Cherian 2025-03-05 10:30 ` Andy Shevchenko ` (2 subsequent siblings) 3 siblings, 1 reply; 21+ messages in thread From: Marek Behún @ 2025-03-05 10:18 UTC (permalink / raw) To: George Cherian Cc: linux, wim, jwerner, evanbenn, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat, linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches Hi George, why is armada_37xx_wdt also here? The stop function in that driver may not sleep. Marek ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:18 ` Marek Behún @ 2025-03-05 10:34 ` George Cherian 2025-03-05 11:01 ` Ahmad Fatoum 0 siblings, 1 reply; 21+ messages in thread From: George Cherian @ 2025-03-05 10:34 UTC (permalink / raw) To: Marek Behún Cc: linux@roeck-us.net, wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, imx@lists.linux.dev, linux-mips@vger.kernel.org, openbmc@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org, patches@opensource.cirrus.com From: Marek Behún <kabel@kernel.org> Sent: Wednesday, March 5, 2025 3:48 PM To: George Cherian <gcherian@marvell.com> Cc: linux@roeck-us.net; wim@linux-watchdog.org; jwerner@chromium.org; evanbenn@chromium.org; krzk@kernel.org; mazziesaccount@gmail.com; thomas.richard@bootlin.com; lma@chromium.org; bleung@chromium.org; support.opensource@diasemi.com; shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com; andy@kernel.org; paul@crapouillou.net; alexander.usyskin@intel.com; andreas.werner@men.de; daniel@thingy.jp; romain.perier@gmail.com; avifishman70@gmail.com; tmaimon77@gmail.com; tali.perry1@gmail.com; venture@google.com; yuenn@google.com; benjaminfair@google.com; maddy@linux.ibm.com; mpe@ellerman.id.au; npiggin@gmail.com; christophe.leroy@csgroup.eu; naveen@kernel.org; mwalle@kernel.org; xingyu.wu@starfivetech.com; ziv.xu@starfivetech.com; hayashi.kunihiko@socionext.com; mhiramat@kernel.org; linux-watchdog@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; chrome-platform@lists.linux.dev; imx@lists.linux.dev; linux-mips@vger.kernel.org; openbmc@lists.ozlabs.org; linuxppc-dev@lists.ozlabs.org; patches@opensource.cirrus.com Subject: Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP > Hi George, > > why is armada_37xx_wdt also here? > The stop function in that driver may not sleep. Marek, Thanks for reviewing. Since the stop function has a regmap_write(), I thought it might sleep. Now that you pointed it out, I assume that it is an MMIO based regmap being used for armada. I will update the same in the next version > > Marek -George ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:34 ` George Cherian @ 2025-03-05 11:01 ` Ahmad Fatoum 2025-03-05 23:58 ` Guenter Roeck 0 siblings, 1 reply; 21+ messages in thread From: Ahmad Fatoum @ 2025-03-05 11:01 UTC (permalink / raw) To: George Cherian, linux@roeck-us.net Cc: wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, imx@lists.linux.dev, linux-mips@vger.kernel.org, openbmc@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org, patches@opensource.cirrus.com, Marek Behún, Pengutronix Kernel Team Hi George, Hi Guenter, On 05.03.25 11:34, George Cherian wrote: >> why is armada_37xx_wdt also here? >> The stop function in that driver may not sleep. > Marek, > > Thanks for reviewing. > Since the stop function has a regmap_write(), I thought it might sleep. > Now that you pointed it out, I assume that it is an MMIO based regmap being used for armada. > I will update the same in the next version Failure to add WDIOF_STOP_MAYSLEEP when it's needed can lead to kernel hanging. Failure to add an alternative WDIOF_STOP_ATOMIC would lead to the kernel option being a no-op. I think a no-op stop_on_panic (or reset_on_panic) is a saner default. Cheers, Ahmad > >> >> Marek > > -George -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 11:01 ` Ahmad Fatoum @ 2025-03-05 23:58 ` Guenter Roeck 2025-03-06 12:18 ` [EXTERNAL] " George Cherian 0 siblings, 1 reply; 21+ messages in thread From: Guenter Roeck @ 2025-03-05 23:58 UTC (permalink / raw) To: Ahmad Fatoum, George Cherian Cc: wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, imx@lists.linux.dev, linux-mips@vger.kernel.org, openbmc@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org, patches@opensource.cirrus.com, Marek Behún On 3/5/25 03:01, Ahmad Fatoum wrote: > Hi George, > Hi Guenter, > > On 05.03.25 11:34, George Cherian wrote: >>> why is armada_37xx_wdt also here? >>> The stop function in that driver may not sleep. >> Marek, >> >> Thanks for reviewing. >> Since the stop function has a regmap_write(), I thought it might sleep. >> Now that you pointed it out, I assume that it is an MMIO based regmap being used for armada. >> I will update the same in the next version > > Failure to add WDIOF_STOP_MAYSLEEP when it's needed can lead to > kernel hanging. Failure to add an alternative WDIOF_STOP_ATOMIC > would lead to the kernel option being a no-op. > > I think a no-op stop_on_panic (or reset_on_panic) is a saner default. > Agreed. Also, I like WDIOF_STOP_ATOMIC more than the WDIOF_STOP_NOSLEEP I had suggested in my other response. Thanks, Guenter ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [EXTERNAL] Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 23:58 ` Guenter Roeck @ 2025-03-06 12:18 ` George Cherian 2025-03-06 17:22 ` Guenter Roeck 0 siblings, 1 reply; 21+ messages in thread From: George Cherian @ 2025-03-06 12:18 UTC (permalink / raw) To: Guenter Roeck, Ahmad Fatoum Cc: wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, imx@lists.linux.dev, linux-mips@vger.kernel.org, openbmc@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org, patches@opensource.cirrus.com, Marek Behún Hi Guenter, I am summarizing the topics we discussed in multiple threads here. >>On 3/5/25 03:01, Ahmad Fatoum wrote: >> Hi George, >> Hi Guenter, >> >> On 05.03.25 11:34, George Cherian wrote: >>>> why is armada_37xx_wdt also here? >>>> The stop function in that driver may not sleep. >>> Marek, >>> >>> Thanks for reviewing. >>> Since the stop function has a regmap_write(), I thought it might sleep. >>> Now that you pointed it out, I assume that it is an MMIO based regmap being used for armada. >>> I will update the same in the next version >> >> Failure to add WDIOF_STOP_MAYSLEEP when it's needed can lead to >> kernel hanging. Failure to add an alternative WDIOF_STOP_ATOMIC >> would lead to the kernel option being a no-op. >> >> I think a no-op stop_on_panic (or reset_on_panic) is a saner default. >> > >Agreed. Also, I like WDIOF_STOP_ATOMIC more than the WDIOF_STOP_NOSLEEP >I had suggested in my other response. 1. Instead of blacklisting drivers as WDIOF_STOP_MAYSLEEP, the option will an opt-in. 2. This may not be WDIOF_STOP_AOMIC, instead would be a generic flag not limited to STOP operation. May be WDIOF_OPS_ATOMIC (OPS include - .start, .stop, .set_timeout, .ping) 3. Remove the kernel command line option (stop_on_panic) and have a generic reset_on_panic. 4. reset_on_panic=60 (by default ) meaning on a panic the wdog timeout is updated to 60sec or the clamp_t(reset_on_panic, min, max_hw_heartbeat_ms). 5. if reset_on_panic=0, it means the watchdog is stopped on panic. 6. All of these to be done by default from panic handler incase of a configured kdump kernel. -George > >Thanks, >Guenter ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [EXTERNAL] Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-06 12:18 ` [EXTERNAL] " George Cherian @ 2025-03-06 17:22 ` Guenter Roeck 0 siblings, 0 replies; 21+ messages in thread From: Guenter Roeck @ 2025-03-06 17:22 UTC (permalink / raw) To: George Cherian Cc: Ahmad Fatoum, wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, imx@lists.linux.dev, linux-mips@vger.kernel.org, openbmc@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org, patches@opensource.cirrus.com, Marek Behún On Thu, Mar 06, 2025 at 12:18:20PM +0000, George Cherian wrote: > Hi Guenter, > > I am summarizing the topics we discussed in multiple threads here. > > >>On 3/5/25 03:01, Ahmad Fatoum wrote: > >> Hi George, > >> Hi Guenter, > >> > >> On 05.03.25 11:34, George Cherian wrote: > >>>> why is armada_37xx_wdt also here? > >>>> The stop function in that driver may not sleep. > >>> Marek, > >>> > >>> Thanks for reviewing. > >>> Since the stop function has a regmap_write(), I thought it might sleep. > >>> Now that you pointed it out, I assume that it is an MMIO based regmap being used for armada. > >>> I will update the same in the next version > >> > >> Failure to add WDIOF_STOP_MAYSLEEP when it's needed can lead to > >> kernel hanging. Failure to add an alternative WDIOF_STOP_ATOMIC > >> would lead to the kernel option being a no-op. > >> > >> I think a no-op stop_on_panic (or reset_on_panic) is a saner default. > >> > > > >Agreed. Also, I like WDIOF_STOP_ATOMIC more than the WDIOF_STOP_NOSLEEP > >I had suggested in my other response. > > 1. Instead of blacklisting drivers as WDIOF_STOP_MAYSLEEP, the option will an opt-in. > 2. This may not be WDIOF_STOP_AOMIC, instead would be a generic flag not limited to STOP > operation. May be WDIOF_OPS_ATOMIC (OPS include - .start, .stop, .set_timeout, .ping) I don't see a value in this because AFAICS atomic operation is only needed when stopping the watchdog. At least in theory, some watchdogs might need to sleep for other functions, but not for the stop operation. Please provide a rationale. > 3. Remove the kernel command line option (stop_on_panic) and have a generic reset_on_panic. > 4. reset_on_panic=60 (by default ) meaning on a panic the wdog timeout is updated to 60sec > or the clamp_t(reset_on_panic, min, max_hw_heartbeat_ms). Default should be the current behavior, that the watchdog keeps running with the configured timeout. > 5. if reset_on_panic=0, it means the watchdog is stopped on panic. If we need both a panic timeout and the ability to disable the watchdog entirely on panic, there should be two parameters - one to select the watchdog timeout on panic, and one to disable the watchdog entirely on panic. If there is only one parameter, it should be the watchdog timeout on panic, with ==0 meaning "keep the configured timeout" (i.e., the current behavior). Thanks, Guenter ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian 2025-03-05 10:18 ` Marek Behún @ 2025-03-05 10:30 ` Andy Shevchenko 2025-03-05 22:50 ` Julius Werner 2025-03-05 23:03 ` Guenter Roeck 3 siblings, 0 replies; 21+ messages in thread From: Andy Shevchenko @ 2025-03-05 10:30 UTC (permalink / raw) To: George Cherian Cc: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat, linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches On Wed, Mar 05, 2025 at 10:10:24AM +0000, George Cherian wrote: > A new option flag is added to watchdog_info. This helps the watchdog > core to check whether stop functions would sleep or not. > The option flags of individual drivers are also updated accordingly. ... > .options = WDIOF_SETTIMEOUT | > WDIOF_MAGICCLOSE | > - WDIOF_KEEPALIVEPING, > + WDIOF_KEEPALIVEPING | > + WDIOF_STOP_MAYSLEEP, You may heavily reduce this change if you squeeze the new option just before the last one. Currently it's a lot of unneeded churn that makes review a bit harder (each needs to be carefully checked for the correctness). -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian 2025-03-05 10:18 ` Marek Behún 2025-03-05 10:30 ` Andy Shevchenko @ 2025-03-05 22:50 ` Julius Werner 2025-03-06 9:40 ` George Cherian 2025-03-05 23:03 ` Guenter Roeck 3 siblings, 1 reply; 21+ messages in thread From: Julius Werner @ 2025-03-05 22:50 UTC (permalink / raw) To: George Cherian Cc: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat, linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches > static const struct watchdog_ops adv_ec_wdt_ops = { > diff --git a/drivers/watchdog/arm_smc_wdt.c b/drivers/watchdog/arm_smc_wdt.c > index 8f3d0c3a005f..794cf0086912 100644 > --- a/drivers/watchdog/arm_smc_wdt.c > +++ b/drivers/watchdog/arm_smc_wdt.c > @@ -90,7 +90,8 @@ static const struct watchdog_info smcwd_info = { > .identity = DRV_NAME, > .options = WDIOF_SETTIMEOUT | > WDIOF_KEEPALIVEPING | > - WDIOF_MAGICCLOSE, > + WDIOF_MAGICCLOSE | > + WDIOF_STOP_MAYSLEEP, > }; I don't think this driver can sleep, unless I'm missing something? `arm_smccc_smc()` does a synchronous call into firmware that always returns back to the caller. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 22:50 ` Julius Werner @ 2025-03-06 9:40 ` George Cherian 0 siblings, 0 replies; 21+ messages in thread From: George Cherian @ 2025-03-06 9:40 UTC (permalink / raw) To: Julius Werner Cc: linux@roeck-us.net, wim@linux-watchdog.org, evanbenn@chromium.org, kabel@kernel.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org, linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, chrome-platform@lists.linux.dev, imx@lists.linux.dev, linux-mips@vger.kernel.org, openbmc@lists.ozlabs.org, linuxppc-dev@lists.ozlabs.org, patches@opensource.cirrus.com Hi Julius, >> static const struct watchdog_ops adv_ec_wdt_ops = { >> diff --git a/drivers/watchdog/arm_smc_wdt.c b/drivers/watchdog/arm_smc_wdt.c >> index 8f3d0c3a005f..794cf0086912 100644 >> --- a/drivers/watchdog/arm_smc_wdt.c >> +++ b/drivers/watchdog/arm_smc_wdt.c >> @@ -90,7 +90,8 @@ static const struct watchdog_info smcwd_info = { >> .identity = DRV_NAME, >> .options = WDIOF_SETTIMEOUT | >> WDIOF_KEEPALIVEPING | >> - WDIOF_MAGICCLOSE, >> + WDIOF_MAGICCLOSE | >> + WDIOF_STOP_MAYSLEEP, >> }; > >I don't think this driver can sleep, unless I'm missing something? The only reason I added to avoid any inadvertent hang in TF-A. Anyways the approach is going to change so this patch is not needed anymore. >`arm_smccc_smc()` does a synchronous call into firmware that always >returns back to the caller. Thanks for the insight. -George ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian ` (2 preceding siblings ...) 2025-03-05 22:50 ` Julius Werner @ 2025-03-05 23:03 ` Guenter Roeck 3 siblings, 0 replies; 21+ messages in thread From: Guenter Roeck @ 2025-03-05 23:03 UTC (permalink / raw) To: George Cherian, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat Cc: linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches On 3/5/25 02:10, George Cherian wrote: > A new option flag is added to watchdog_info. This helps the watchdog > core to check whether stop functions would sleep or not. > The option flags of individual drivers are also updated accordingly. > > Signed-off-by: George Cherian <george.cherian@marvell.com> > --- > drivers/watchdog/advantech_ec_wdt.c | 3 ++- > drivers/watchdog/arm_smc_wdt.c | 3 ++- > drivers/watchdog/armada_37xx_wdt.c | 2 +- ... and many more. Sorry, I didn't expect that this would touch that many drivers. My bad. Let's do the opposite instead: Introduce WDIOF_STOP_NOSLEEP, and let drivers opt in instead of opting out. I still have to look into the other feedback. I think someone suggested to introduce a callback instead, which would stop the watchdog at runtime if needed (especially during kdump). That may be a better solution than having a module parameter. Either case, please separate driver patches from the patches introducing the new flag. Since the flag is opt-in, that should be ok - drivers supporting it can be modified over time. Thanks, Guenter ^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback 2025-03-05 10:10 [PATCH v4 0/2] Add stop_on_panic support for watchdog George Cherian 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian @ 2025-03-05 10:10 ` George Cherian 2025-03-05 10:33 ` Andy Shevchenko 2025-03-05 10:31 ` [PATCH v4 0/2] Add stop_on_panic support for watchdog Andy Shevchenko 2025-03-05 10:41 ` Ahmad Fatoum 3 siblings, 1 reply; 21+ messages in thread From: George Cherian @ 2025-03-05 10:10 UTC (permalink / raw) To: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat Cc: linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches, George Cherian Watchdog is not turned off in kernel panic situation. In certain systems this might prevent the successful loading of kdump kernel. The kdump kernel might hit a watchdog reset while it is booting. To avoid such scenarios add a panic notifier call back function which can stop the watchdog. This provision can be enabled by passing watchdog.stop_on_panic=1 via kernel command-line parameter. Signed-off-by: George Cherian <george.cherian@marvell.com> --- drivers/watchdog/watchdog_core.c | 35 ++++++++++++++++++++++++++++++++ include/linux/watchdog.h | 2 ++ 2 files changed, 37 insertions(+) diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c index d46d8c8c01f2..f0006d90da92 100644 --- a/drivers/watchdog/watchdog_core.c +++ b/drivers/watchdog/watchdog_core.c @@ -34,6 +34,7 @@ #include <linux/idr.h> /* For ida_* macros */ #include <linux/err.h> /* For IS_ERR macros */ #include <linux/of.h> /* For of_get_timeout_sec */ +#include <linux/panic_notifier.h> /* For panic handler */ #include <linux/suspend.h> #include "watchdog_core.h" /* For watchdog_dev_register/... */ @@ -47,6 +48,9 @@ static int stop_on_reboot = -1; module_param(stop_on_reboot, int, 0444); MODULE_PARM_DESC(stop_on_reboot, "Stop watchdogs on reboot (0=keep watching, 1=stop)"); +static bool stop_on_panic; +module_param(stop_on_panic, bool, 0444); +MODULE_PARM_DESC(stop_on_panic, "Stop watchdogs on panic (0=keep watching, 1=stop)"); /* * Deferred Registration infrastructure. * @@ -155,6 +159,23 @@ int watchdog_init_timeout(struct watchdog_device *wdd, } EXPORT_SYMBOL_GPL(watchdog_init_timeout); +static int watchdog_panic_notify(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct watchdog_device *wdd; + + wdd = container_of(nb, struct watchdog_device, panic_nb); + if (watchdog_active(wdd)) { + int ret; + + ret = wdd->ops->stop(wdd); + if (ret) + return NOTIFY_BAD; + } + + return NOTIFY_DONE; +} + static int watchdog_reboot_notifier(struct notifier_block *nb, unsigned long code, void *data) { @@ -334,6 +355,17 @@ static int ___watchdog_register_device(struct watchdog_device *wdd) wdd->id, ret); } + if (stop_on_panic) { + if (wdd->ops->stop && !(wdd->info->options & WDIOF_STOP_MAYSLEEP)) { + wdd->panic_nb.notifier_call = watchdog_panic_notify; + atomic_notifier_chain_register(&panic_notifier_list, + &wdd->panic_nb); + set_bit(WDOG_STOP_ON_PANIC, &wdd->status); + } else { + pr_warn("watchdog%d: stop_on_panic not supported\n", wdd->id); + } + } + return 0; } @@ -390,6 +422,9 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd) if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) unregister_reboot_notifier(&wdd->reboot_nb); + if (test_bit(WDOG_STOP_ON_PANIC, &wdd->status)) + atomic_notifier_chain_unregister(&panic_notifier_list, + &wdd->panic_nb); watchdog_dev_unregister(wdd); ida_free(&watchdog_ida, wdd->id); } diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h index 99660197a36c..ef6f1136a4c5 100644 --- a/include/linux/watchdog.h +++ b/include/linux/watchdog.h @@ -108,6 +108,7 @@ struct watchdog_device { struct notifier_block reboot_nb; struct notifier_block restart_nb; struct notifier_block pm_nb; + struct notifier_block panic_nb; void *driver_data; struct watchdog_core_data *wd_data; unsigned long status; @@ -118,6 +119,7 @@ struct watchdog_device { #define WDOG_HW_RUNNING 3 /* True if HW watchdog running */ #define WDOG_STOP_ON_UNREGISTER 4 /* Should be stopped on unregister */ #define WDOG_NO_PING_ON_SUSPEND 5 /* Ping worker should be stopped on suspend */ +#define WDOG_STOP_ON_PANIC 6 /* Should be stopped on panic for loading kdump kernels */ struct list_head deferred; }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback 2025-03-05 10:10 ` [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback George Cherian @ 2025-03-05 10:33 ` Andy Shevchenko 2025-03-06 0:00 ` Guenter Roeck 0 siblings, 1 reply; 21+ messages in thread From: Andy Shevchenko @ 2025-03-05 10:33 UTC (permalink / raw) To: George Cherian Cc: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat, linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches On Wed, Mar 05, 2025 at 10:10:25AM +0000, George Cherian wrote: > Watchdog is not turned off in kernel panic situation. > In certain systems this might prevent the successful loading > of kdump kernel. The kdump kernel might hit a watchdog reset > while it is booting. > > To avoid such scenarios add a panic notifier call back function > which can stop the watchdog. This provision can be enabled by > passing watchdog.stop_on_panic=1 via kernel command-line parameter. ... First of all, do we really need a new module parameter for that? Why can't it be done automatically if kdump is expected? > +static bool stop_on_panic; > +module_param(stop_on_panic, bool, 0444); > +MODULE_PARM_DESC(stop_on_panic, "Stop watchdogs on panic (0=keep watching, 1=stop)"); + blank line. Also I do not see the documentation update. Where is it lost? > /* -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback 2025-03-05 10:33 ` Andy Shevchenko @ 2025-03-06 0:00 ` Guenter Roeck 0 siblings, 0 replies; 21+ messages in thread From: Guenter Roeck @ 2025-03-06 0:00 UTC (permalink / raw) To: Andy Shevchenko, George Cherian Cc: wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat, linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches On 3/5/25 02:33, Andy Shevchenko wrote: > On Wed, Mar 05, 2025 at 10:10:25AM +0000, George Cherian wrote: >> Watchdog is not turned off in kernel panic situation. >> In certain systems this might prevent the successful loading >> of kdump kernel. The kdump kernel might hit a watchdog reset >> while it is booting. >> >> To avoid such scenarios add a panic notifier call back function >> which can stop the watchdog. This provision can be enabled by >> passing watchdog.stop_on_panic=1 via kernel command-line parameter. > > ... > > First of all, do we really need a new module parameter for that? Why can't it > be done automatically if kdump is expected? > Sounds like a good idea to me. Guenter ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog 2025-03-05 10:10 [PATCH v4 0/2] Add stop_on_panic support for watchdog George Cherian 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian 2025-03-05 10:10 ` [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback George Cherian @ 2025-03-05 10:31 ` Andy Shevchenko 2025-03-05 10:41 ` Ahmad Fatoum 3 siblings, 0 replies; 21+ messages in thread From: Andy Shevchenko @ 2025-03-05 10:31 UTC (permalink / raw) To: George Cherian Cc: linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat, linux-watchdog, linux-kernel, linux-arm-kernel, chrome-platform, imx, linux-mips, openbmc, linuxppc-dev, patches On Wed, Mar 05, 2025 at 10:10:23AM +0000, George Cherian wrote: > This series adds a new kernel command line option to watchdog core to > stop the watchdog on panic. This is useul in certain systems which prevents > successful loading of kdump kernel due to watchdog reset. > > Some of the watchdog drivers stop function could sleep. For such > drivers the stop_on_panic is not valid as the notifier callback happens > in atomic context. Introduce WDIOF_STOP_MAYSLEEP flag to watchdog_info > options to indicate whether the stop function would sleep. Should you only enable this if the kdump is enabled in the kernel configuration? -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog 2025-03-05 10:10 [PATCH v4 0/2] Add stop_on_panic support for watchdog George Cherian ` (2 preceding siblings ...) 2025-03-05 10:31 ` [PATCH v4 0/2] Add stop_on_panic support for watchdog Andy Shevchenko @ 2025-03-05 10:41 ` Ahmad Fatoum 2025-03-05 11:28 ` [EXTERNAL] " George Cherian 3 siblings, 1 reply; 21+ messages in thread From: Ahmad Fatoum @ 2025-03-05 10:41 UTC (permalink / raw) To: George Cherian, linux, wim, jwerner, evanbenn, kabel, krzk, mazziesaccount, thomas.richard, lma, bleung, support.opensource, shawnguo, s.hauer, kernel, festevam, andy, paul, alexander.usyskin, andreas.werner, daniel, romain.perier, avifishman70, tmaimon77, tali.perry1, venture, yuenn, benjaminfair, maddy, mpe, npiggin, christophe.leroy, naveen, mwalle, xingyu.wu, ziv.xu, hayashi.kunihiko, mhiramat Cc: chrome-platform, linux-watchdog, imx, patches, openbmc, linux-mips, linux-kernel, linuxppc-dev, linux-arm-kernel Hi George, On 05.03.25 11:10, George Cherian wrote: > This series adds a new kernel command line option to watchdog core to > stop the watchdog on panic. This is useul in certain systems which prevents > successful loading of kdump kernel due to watchdog reset. > > Some of the watchdog drivers stop function could sleep. For such > drivers the stop_on_panic is not valid as the notifier callback happens > in atomic context. Introduce WDIOF_STOP_MAYSLEEP flag to watchdog_info > options to indicate whether the stop function would sleep. Did you consider having a reset_on_panic instead, which sets a user-specified timeout on panic? This would make the mechanism useful also for watchdogs that can't be disabled and would protect against system lock up: Consider a memory-corruption bug (perhaps externally via DMA), which partially overwrites both main and kdump kernel. With a disabled watchdog, the system may not be able to recover on its own. If you did consider it, what made you decide against it? Thanks, Ahmad > > > Changelog: > v1 -> v2 > - Remove the per driver flag setting option > - Take the parameter via kernel command-line parameter to watchdog_core. > > v2 -> v3 > - Remove the helper function watchdog_stop_on_panic() from watchdog.h. > - There are no users for this. > > v3 -> v4 > - Since the panic notifier is in atomic context, watchdog functions > which sleep can't be called. > - Add an options flag WDIOF_STOP_MAYSLEEP to indicate whether stop > function sleeps. > - Simplify the stop_on_panic kernel command line parsing. > - Enable the panic notiffier only if the watchdog stop function doesn't > sleep > > George Cherian (2): > watchdog: Add a new flag WDIOF_STOP_MAYSLEEP > drivers: watchdog: Add support for panic notifier callback > > drivers/watchdog/advantech_ec_wdt.c | 3 ++- > drivers/watchdog/arm_smc_wdt.c | 3 ++- > drivers/watchdog/armada_37xx_wdt.c | 2 +- > drivers/watchdog/asm9260_wdt.c | 2 +- > drivers/watchdog/bcm47xx_wdt.c | 3 ++- > drivers/watchdog/bd9576_wdt.c | 2 +- > drivers/watchdog/bd96801_wdt.c | 2 +- > drivers/watchdog/cgbc_wdt.c | 2 +- > drivers/watchdog/cros_ec_wdt.c | 5 ++++- > drivers/watchdog/da9052_wdt.c | 3 ++- > drivers/watchdog/da9055_wdt.c | 4 +++- > drivers/watchdog/da9062_wdt.c | 4 +++- > drivers/watchdog/da9063_wdt.c | 4 +++- > drivers/watchdog/db8500_wdt.c | 5 ++++- > drivers/watchdog/dw_wdt.c | 5 +++-- > drivers/watchdog/f71808e_wdt.c | 3 ++- > drivers/watchdog/gpio_wdt.c | 2 +- > drivers/watchdog/i6300esb.c | 5 ++++- > drivers/watchdog/imx_sc_wdt.c | 2 +- > drivers/watchdog/intel-mid_wdt.c | 5 ++++- > drivers/watchdog/it87_wdt.c | 5 ++++- > drivers/watchdog/jz4740_wdt.c | 5 ++++- > drivers/watchdog/kempld_wdt.c | 3 ++- > drivers/watchdog/lenovo_se10_wdt.c | 5 ++++- > drivers/watchdog/max77620_wdt.c | 5 ++++- > drivers/watchdog/mei_wdt.c | 3 ++- > drivers/watchdog/menf21bmc_wdt.c | 4 +++- > drivers/watchdog/mlx_wdt.c | 2 +- > drivers/watchdog/msc313e_wdt.c | 5 ++++- > drivers/watchdog/npcm_wdt.c | 3 ++- > drivers/watchdog/omap_wdt.c | 5 ++++- > drivers/watchdog/pm8916_wdt.c | 5 +++-- > drivers/watchdog/pseries-wdt.c | 2 +- > drivers/watchdog/rave-sp-wdt.c | 5 ++++- > drivers/watchdog/renesas_wdt.c | 7 ++++-- > drivers/watchdog/retu_wdt.c | 5 ++++- > drivers/watchdog/rn5t618_wdt.c | 6 +++-- > drivers/watchdog/rzg2l_wdt.c | 5 ++++- > drivers/watchdog/rzv2h_wdt.c | 5 ++++- > drivers/watchdog/shwdt.c | 6 +++-- > drivers/watchdog/sl28cpld_wdt.c | 5 ++++- > drivers/watchdog/softdog.c | 5 ++++- > drivers/watchdog/sp805_wdt.c | 5 ++++- > drivers/watchdog/starfive-wdt.c | 3 ++- > drivers/watchdog/stpmic1_wdt.c | 5 ++++- > drivers/watchdog/ts4800_wdt.c | 5 ++++- > drivers/watchdog/twl4030_wdt.c | 5 ++++- > drivers/watchdog/uniphier_wdt.c | 3 ++- > drivers/watchdog/w83627hf_wdt.c | 5 ++++- > drivers/watchdog/watchdog_core.c | 35 +++++++++++++++++++++++++++++ > drivers/watchdog/wm831x_wdt.c | 5 ++++- > drivers/watchdog/wm8350_wdt.c | 5 ++++- > drivers/watchdog/xen_wdt.c | 5 ++++- > drivers/watchdog/ziirave_wdt.c | 5 ++++- > include/linux/watchdog.h | 2 ++ > include/uapi/linux/watchdog.h | 1 + > 56 files changed, 198 insertions(+), 58 deletions(-) > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* RE: [EXTERNAL] Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog 2025-03-05 10:41 ` Ahmad Fatoum @ 2025-03-05 11:28 ` George Cherian 2025-03-05 11:39 ` Ahmad Fatoum 0 siblings, 1 reply; 21+ messages in thread From: George Cherian @ 2025-03-05 11:28 UTC (permalink / raw) To: Ahmad Fatoum, linux@roeck-us.net, wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, kabel@kernel.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org Cc: chrome-platform@lists.linux.dev, linux-watchdog@vger.kernel.org, imx@lists.linux.dev, patches@opensource.cirrus.com, openbmc@lists.ozlabs.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Hi Ahmad, >Hi George, > On 05.03.25 11:10, George Cherian wrote: >> This series adds a new kernel command line option to watchdog core to >> stop the watchdog on panic. This is useul in certain systems which prevents >> successful loading of kdump kernel due to watchdog reset. >> >> Some of the watchdog drivers stop function could sleep. For such >> drivers the stop_on_panic is not valid as the notifier callback happens >> in atomic context. Introduce WDIOF_STOP_MAYSLEEP flag to watchdog_info >> options to indicate whether the stop function would sleep. > >Did you consider having a reset_on_panic instead, which sets a user-specified >timeout on panic? This would make the mechanism useful also for watchdogs /proc/sys/kernel/panic already provides that support. You may echo a non-zero value and the system tries for a soft reboot after those many seconds. But this doesn't happen in case of a kdump kernel load after panic. >that can't be disabled and would protect against system lock up: >Consider a memory-corruption bug (perhaps externally via DMA), which partially >overwrites both main and kdump kernel. With a disabled watchdog, the system >may not be able to recover on its own. Yes, that is the reason why the kernel command-line is optional and by default it is set to zero. So that in cases if you have a corrupted kdump kernel then watchdog kicks in. > >If you did consider it, what made you decide against it? watchdog.stop_on_panic=1 is specifically for systems which can't boot a kdump kernel due to the fact that the kdump kernel gets a watchdog reset while booting, may be due to a shorter watchdog time. For eg: a 32-bit watchdog down counter running at 1GHz. reset_on_panic can guarantee only the largest watchdog timeout supported by HW, since there is no one to ping the watchdog. > >Thanks, >Ahmad > >> >> > Changelog: > v1 -> v2 > - Remove the per driver flag setting option > - Take the parameter via kernel command-line parameter to watchdog_core. > > v2 -> v3 > - Remove the helper function watchdog_stop_on_panic() from watchdog.h. > - There are no users for this. > > v3 -> v4 > - Since the panic notifier is in atomic context, watchdog functions > which sleep can't be called. > - Add an options flag WDIOF_STOP_MAYSLEEP to indicate whether stop > function sleeps. > - Simplify the stop_on_panic kernel command line parsing. > - Enable the panic notiffier only if the watchdog stop function doesn't > sleep > > George Cherian (2): > watchdog: Add a new flag WDIOF_STOP_MAYSLEEP > drivers: watchdog: Add support for panic notifier callback - George ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [EXTERNAL] Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog 2025-03-05 11:28 ` [EXTERNAL] " George Cherian @ 2025-03-05 11:39 ` Ahmad Fatoum 2025-03-05 12:15 ` George Cherian 0 siblings, 1 reply; 21+ messages in thread From: Ahmad Fatoum @ 2025-03-05 11:39 UTC (permalink / raw) To: George Cherian, linux@roeck-us.net, wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, kabel@kernel.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org Cc: chrome-platform@lists.linux.dev, linux-watchdog@vger.kernel.org, imx@lists.linux.dev, patches@opensource.cirrus.com, openbmc@lists.ozlabs.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Hi George, On 05.03.25 12:28, George Cherian wrote: > Hi Ahmad, >> Hi George, >> On 05.03.25 11:10, George Cherian wrote: >>> This series adds a new kernel command line option to watchdog core to >>> stop the watchdog on panic. This is useul in certain systems which prevents >>> successful loading of kdump kernel due to watchdog reset. >>> >>> Some of the watchdog drivers stop function could sleep. For such >>> drivers the stop_on_panic is not valid as the notifier callback happens >>> in atomic context. Introduce WDIOF_STOP_MAYSLEEP flag to watchdog_info >>> options to indicate whether the stop function would sleep. >> >> Did you consider having a reset_on_panic instead, which sets a user-specified >> timeout on panic? This would make the mechanism useful also for watchdogs > > /proc/sys/kernel/panic already provides that support. You may echo a non-zero value > and the system tries for a soft reboot after those many seconds. But this doesn't happen > in case of a kdump kernel load after panic. The timeout specified to the Watchdog reset_on_panic option would be programmed into the active watchdogs and not be used to trigger a software-induced reboot. >> that can't be disabled and would protect against system lock up: >> Consider a memory-corruption bug (perhaps externally via DMA), which partially >> overwrites both main and kdump kernel. With a disabled watchdog, the system >> may not be able to recover on its own. > > Yes, that is the reason why the kernel command-line is optional and by default it is set to zero. > So that in cases if you have a corrupted kdump kernel then watchdog kicks in. The existing option isn't enough for the kdump kernel use case. If we (i.e. you) are going to do something about it, wouldn't it be better to have a solution that's applicable to a wider number of watchdog devices? >> If you did consider it, what made you decide against it? > watchdog.stop_on_panic=1 is specifically for systems which can't boot a kdump kernel due to the fact > that the kdump kernel gets a watchdog reset while booting, may be due to a shorter watchdog time. > For eg: a 32-bit watchdog down counter running at 1GHz. > reset_on_panic can guarantee only the largest watchdog timeout supported by HW, > since there is no one to ping the watchdog. If you are serious with the watchdog use, you'll want to use the watchdog to monitor kernel startup as well. If the bootloader can set a watchdog timeout just before starting the kernel and it doesn't expire before the kernel watchdog driver takes over, why can't we do the same just before starting the dumpkernel? Thanks, Ahmad >> >> Thanks, >> Ahmad >> >>> >>> >> Changelog: >> v1 -> v2 >> - Remove the per driver flag setting option >> - Take the parameter via kernel command-line parameter to watchdog_core. >> >> v2 -> v3 >> - Remove the helper function watchdog_stop_on_panic() from watchdog.h. >> - There are no users for this. >> >> v3 -> v4 >> - Since the panic notifier is in atomic context, watchdog functions >> which sleep can't be called. >> - Add an options flag WDIOF_STOP_MAYSLEEP to indicate whether stop >> function sleeps. >> - Simplify the stop_on_panic kernel command line parsing. >> - Enable the panic notiffier only if the watchdog stop function doesn't >> sleep >> >> George Cherian (2): >> watchdog: Add a new flag WDIOF_STOP_MAYSLEEP >> drivers: watchdog: Add support for panic notifier callback > > - George -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog 2025-03-05 11:39 ` Ahmad Fatoum @ 2025-03-05 12:15 ` George Cherian 2025-03-05 12:23 ` Ahmad Fatoum 0 siblings, 1 reply; 21+ messages in thread From: George Cherian @ 2025-03-05 12:15 UTC (permalink / raw) To: Ahmad Fatoum, linux@roeck-us.net, wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, kabel@kernel.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org Cc: chrome-platform@lists.linux.dev, linux-watchdog@vger.kernel.org, imx@lists.linux.dev, patches@opensource.cirrus.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Hi Ahmad, >Hi George, > >On 05.03.25 12:28, George Cherian wrote: > Hi Ahmad, >>> Hi George, >>> On 05.03.25 11:10, George Cherian wrote: >>>> This series adds a new kernel command line option to watchdog core to >>>> stop the watchdog on panic. This is useul in certain systems which prevents >>>> successful loading of kdump kernel due to watchdog reset. >>>> >>>> Some of the watchdog drivers stop function could sleep. For such >>>> drivers the stop_on_panic is not valid as the notifier callback happens >>>> in atomic context. Introduce WDIOF_STOP_MAYSLEEP flag to watchdog_info >>>> options to indicate whether the stop function would sleep. >>> >>> Did you consider having a reset_on_panic instead, which sets a user-specified >>> timeout on panic? This would make the mechanism useful also for watchdogs >> >> /proc/sys/kernel/panic already provides that support. You may echo a non-zero value >> and the system tries for a soft reboot after those many seconds. But this doesn't happen >> in case of a kdump kernel load after panic. > >The timeout specified to the Watchdog reset_on_panic option would be programmed into >the active watchdogs and not be used to trigger a software-induced reboot. Yes. > >>> that can't be disabled and would protect against system lock up: >>> Consider a memory-corruption bug (perhaps externally via DMA), which partially >>> overwrites both main and kdump kernel. With a disabled watchdog, the system >>> may not be able to recover on its own. >> >> Yes, that is the reason why the kernel command-line is optional and by default it is set to zero. >> So that in cases if you have a corrupted kdump kernel then watchdog kicks in. > >The existing option isn't enough for the kdump kernel use case. >If we (i.e. you) are going to do something about it, wouldn't it be >better to have a solution that's applicable to a wider number of >watchdog devices? I need a slight clarification here. 1. reset_on_panic takes the number of seconds to be reloaded to watchdog HW, so that it initiates a watchdog reset after the specified timeout, if kdump kernel fails to boot or hung while booting. 2. in case reset_on_panic = 0 then it behaves like stop_on_panic=1. Is this what you meant? I would let Guenter comment on this approach. >>> If you did consider it, what made you decide against it? >> watchdog.stop_on_panic=1 is specifically for systems which can't boot a kdump kernel due to the fact >> that the kdump kernel gets a watchdog reset while booting, may be due to a shorter watchdog time. >> For eg: a 32-bit watchdog down counter running at 1GHz. >> reset_on_panic can guarantee only the largest watchdog timeout supported by HW, >> since there is no one to ping the watchdog. >If you are serious with the watchdog use, you'll want to use the watchdog to >monitor kernel startup as well. If the bootloader can set a watchdog timeout >just before starting the kernel and it doesn't expire before the kernel watchdog >driver takes over, why can't we do the same just before starting the dumpkernel? Yes, in an ideal world with ideal HW. But there are HW with issues which cannot have large enough Watchdog time. Such HW would boot from FW to kernel without watchdog enabled. And stop_on_panic does the similar for kdump kernel too. -George > >Thanks, >Ahmad > > >> >> Thanks, >> Ahmad >> >>> >>> >> Changelog: >> v1 -> v2 >> - Remove the per driver flag setting option >> - Take the parameter via kernel command-line parameter to watchdog_core. >> >> v2 -> v3 >> - Remove the helper function watchdog_stop_on_panic() from watchdog.h. >> - There are no users for this. >> >> v3 -> v4 >> - Since the panic notifier is in atomic context, watchdog functions >> which sleep can't be called. >> - Add an options flag WDIOF_STOP_MAYSLEEP to indicate whether stop >> function sleeps. >> - Simplify the stop_on_panic kernel command line parsing. >> - Enable the panic notiffier only if the watchdog stop function doesn't >> sleep >> >> George Cherian (2): >> watchdog: Add a new flag WDIOF_STOP_MAYSLEEP >> drivers: watchdog: Add support for panic notifier callback > > - George -- Pengutronix e.K. | | Steuerwalder Str. 21 | https://urldefense.proofpoint.com/v2/url?u=http-3A__www.pengutronix.de_&d=DwICaQ&c=nKjWec2b6R0mOyPaz7xtfQ&r=npgTSgHrUSLmXpBZJKVhk0lE_XNvtVDl8ZA2zBvBqPw&m=Df3J3ZRga7XxcgUdJOqYVMJ-ALX5jC3eiII4YhsAdC5pYhr1xwcqbzhIy6MCEqws&s=ybglw-WK4VGE8gHGNwMrC1_VliOv72pjDLEIm9FF_dE&e= | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog 2025-03-05 12:15 ` George Cherian @ 2025-03-05 12:23 ` Ahmad Fatoum 0 siblings, 0 replies; 21+ messages in thread From: Ahmad Fatoum @ 2025-03-05 12:23 UTC (permalink / raw) To: George Cherian, linux@roeck-us.net, wim@linux-watchdog.org, jwerner@chromium.org, evanbenn@chromium.org, kabel@kernel.org, krzk@kernel.org, mazziesaccount@gmail.com, thomas.richard@bootlin.com, lma@chromium.org, bleung@chromium.org, support.opensource@diasemi.com, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, andy@kernel.org, paul@crapouillou.net, alexander.usyskin@intel.com, andreas.werner@men.de, daniel@thingy.jp, romain.perier@gmail.com, avifishman70@gmail.com, tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com, yuenn@google.com, benjaminfair@google.com, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, christophe.leroy@csgroup.eu, naveen@kernel.org, mwalle@kernel.org, xingyu.wu@starfivetech.com, ziv.xu@starfivetech.com, hayashi.kunihiko@socionext.com, mhiramat@kernel.org Cc: chrome-platform@lists.linux.dev, linux-watchdog@vger.kernel.org, imx@lists.linux.dev, patches@opensource.cirrus.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Hello George, On 05.03.25 13:15, George Cherian wrote: >> On 05.03.25 12:28, George Cherian wrote: >>>> that can't be disabled and would protect against system lock up: >>>> Consider a memory-corruption bug (perhaps externally via DMA), which partially >>>> overwrites both main and kdump kernel. With a disabled watchdog, the system >>>> may not be able to recover on its own. >>> >>> Yes, that is the reason why the kernel command-line is optional and by default it is set to zero. >>> So that in cases if you have a corrupted kdump kernel then watchdog kicks in. >> >> The existing option isn't enough for the kdump kernel use case. >> If we (i.e. you) are going to do something about it, wouldn't it be >> better to have a solution that's applicable to a wider number of >> watchdog devices? > > I need a slight clarification here. > 1. reset_on_panic takes the number of seconds to be reloaded to watchdog HW, so that it initiates a > watchdog reset after the specified timeout, if kdump kernel fails to boot or hung while booting. Yes. > 2. in case reset_on_panic = 0 then it behaves like stop_on_panic=1. > Is this what you meant? Alternatively, reset_on_panic = 0 could also mean stopping the watchdog as you do now. I haven't thought though yet what would make the most sense. > I would let Guenter comment on this approach. +1. >> If you are serious with the watchdog use, you'll want to use the watchdog to >> monitor kernel startup as well. If the bootloader can set a watchdog timeout >> just before starting the kernel and it doesn't expire before the kernel watchdog >> driver takes over, why can't we do the same just before starting the dumpkernel? > > Yes, in an ideal world with ideal HW. But there are HW with issues which cannot have large > enough Watchdog time. Such HW would boot from FW to kernel without watchdog enabled. > And stop_on_panic does the similar for kdump kernel too. Yes, but there is likely more kinds of watchdog devices that can not be disabled, so it makes sense to have a solution that is more broadly applicable from the get-go. Cheers, Ahmad > > -George >> >> Thanks, >> Ahmad >> >> >>> >>> Thanks, >>> Ahmad >>> >>>> >>>> >>> Changelog: >>> v1 -> v2 >>> - Remove the per driver flag setting option >>> - Take the parameter via kernel command-line parameter to watchdog_core. >>> >>> v2 -> v3 >>> - Remove the helper function watchdog_stop_on_panic() from watchdog.h. >>> - There are no users for this. >>> >>> v3 -> v4 >>> - Since the panic notifier is in atomic context, watchdog functions >>> which sleep can't be called. >>> - Add an options flag WDIOF_STOP_MAYSLEEP to indicate whether stop >>> function sleeps. >>> - Simplify the stop_on_panic kernel command line parsing. >>> - Enable the panic notiffier only if the watchdog stop function doesn't >>> sleep >>> >>> George Cherian (2): >>> watchdog: Add a new flag WDIOF_STOP_MAYSLEEP >>> drivers: watchdog: Add support for panic notifier callback >> >> - George > > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2025-03-06 17:22 UTC | newest] Thread overview: 21+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-03-05 10:10 [PATCH v4 0/2] Add stop_on_panic support for watchdog George Cherian 2025-03-05 10:10 ` [PATCH v4 1/2] watchdog: Add a new flag WDIOF_STOP_MAYSLEEP George Cherian 2025-03-05 10:18 ` Marek Behún 2025-03-05 10:34 ` George Cherian 2025-03-05 11:01 ` Ahmad Fatoum 2025-03-05 23:58 ` Guenter Roeck 2025-03-06 12:18 ` [EXTERNAL] " George Cherian 2025-03-06 17:22 ` Guenter Roeck 2025-03-05 10:30 ` Andy Shevchenko 2025-03-05 22:50 ` Julius Werner 2025-03-06 9:40 ` George Cherian 2025-03-05 23:03 ` Guenter Roeck 2025-03-05 10:10 ` [PATCH v4 2/2] drivers: watchdog: Add support for panic notifier callback George Cherian 2025-03-05 10:33 ` Andy Shevchenko 2025-03-06 0:00 ` Guenter Roeck 2025-03-05 10:31 ` [PATCH v4 0/2] Add stop_on_panic support for watchdog Andy Shevchenko 2025-03-05 10:41 ` Ahmad Fatoum 2025-03-05 11:28 ` [EXTERNAL] " George Cherian 2025-03-05 11:39 ` Ahmad Fatoum 2025-03-05 12:15 ` George Cherian 2025-03-05 12:23 ` Ahmad Fatoum
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).