mbox series

[v5,0/2] Add reset_on_panic support for watchdog

Message ID 20250409053452.3173447-1-george.cherian@marvell.com
Headers show
Series Add reset_on_panic support for watchdog | expand

Message

George Cherian April 9, 2025, 5:34 a.m. UTC
This series adds a new option to watchdog core to reconfigure the
watchdog timeout on panic. This is useul in certain systems which prevents
successful loading of kdump kernel due to watchdog reset.

Some of the watchdog drivers ops could sleep. For such drivers the 
reset_on_panic is not valid as the notifier callback happens
in atomic context. Introduce WDIOF_OPS_ATOMIC flag to watchdog_info
options to indicate whether the stop/set_timeout 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

v4 -> v5
- Remove the kernel command line option.
- Incorporate the suggestions by Ahamad Fatoum.
- Give an option to watchdog core to set the timeout in case of panic.
- This timeout is configurable runtime via sysfs.
- This way it addresses all the watchdogs as long as they have watchdog
  ops  atomic.
- Enable this feature to sbsa watchdog.

George Cherian (2):
  drivers: watchdog: Introduce watchdog reset timeout on panic
  drivers: sbsa_gwdt: Enable the reset_on_panic feature

 drivers/watchdog/sbsa_gwdt.c     |  3 +++
 drivers/watchdog/watchdog_core.c | 33 ++++++++++++++++++++++++++++++++
 drivers/watchdog/watchdog_dev.c  | 28 +++++++++++++++++++++++++++
 include/linux/watchdog.h         |  3 +++
 include/uapi/linux/watchdog.h    |  1 +
 5 files changed, 68 insertions(+)