Re: [PATCH v4 0/2] Add stop_on_panic support for watchdog
From: Ahmad Fatoum
Date: Wed Mar 05 2025 - 05:45:10 EST
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 |