The change adds a simple watchdog pretimeout framework infrastructure, its purpose is to allow users to select a desired handling of watchdog pretimeout events, which may be generated by a watchdog driver. The idea of adding this kind of a framework appeared after reviewing several attempts to add hardcoded pretimeout event handling to some watchdog driver and after a discussion with Guenter, see https://lkml.org/lkml/2015/11/4/346 By design every watchdog pretimeout governor may be compiled as a kernel module, a user selects a default watchdog pretimeout governor during compilation stage (always built-in) and can select another governor in runtime. The design features of the watchdog pretimeout framework are similar to cpufreq, devfreq and thermal governors, this includes * option to compile governors as kernel modules, * compile time selection of a default governor, * similar per-device sysfs attributes and one governor to one device link model. Watchdogs with WDIOF_PRETIMEOUT capability now have two device attributes in sysfs: read/write pretimeout_governor attribute and read only pretimeout_available_governors attribute. To throw a pretimeout event for further processing a watchdog driver should call exported watchdog_notify_pretimeout(wdd) interface. In addition to the framework a number of simple watchdog pretimeout governors are added for review: panic, noop and userspace notifier. Hopefully the change opens a possibility to complete development of device specific watchdog pretimeout bits. Changes from v1 to v2, thanks to Guenter for review and discussion: * removed re-ping pretimeout governor, the functionality is supposed to be covered by the pending infrastructure enhancements, * removed watchdog driver specific pretimeout governor, at the moment it is not expected to add driver specific handlers, * reordered governors, panic comes in the first place, * removed framework private bits from struct watchdog_governor, * centralized compile-time selection of a default governor in watchdog_pretimeout.h, * added can_sleep option, now only sleeping governors (e.g. userspace) will be executed in a special workqueue, * changed fallback logic, if a governor in use is removed, now this situation is not possible, because in use governors have non-zero module refcount, * slightly improved description of the governors in Kconfig. Vladimir Zapolskiy (4): watchdog: add watchdog pretimeout framework watchdog: pretimeout: add panic pretimeout governor watchdog: pretimeout: add noop pretimeout governor watchdog: pretimeout: add userspace notifier pretimeout governor drivers/watchdog/Kconfig | 68 ++++++ drivers/watchdog/Makefile | 9 +- drivers/watchdog/pretimeout_noop.c | 47 ++++ drivers/watchdog/pretimeout_panic.c | 47 ++++ drivers/watchdog/pretimeout_userspace.c | 48 +++++ drivers/watchdog/watchdog_core.c | 14 +- drivers/watchdog/watchdog_pretimeout.c | 370 ++++++++++++++++++++++++++++++++ drivers/watchdog/watchdog_pretimeout.h | 43 ++++ include/linux/watchdog.h | 10 + 9 files changed, 653 insertions(+), 3 deletions(-) create mode 100644 drivers/watchdog/pretimeout_noop.c create mode 100644 drivers/watchdog/pretimeout_panic.c create mode 100644 drivers/watchdog/pretimeout_userspace.c create mode 100644 drivers/watchdog/watchdog_pretimeout.c create mode 100644 drivers/watchdog/watchdog_pretimeout.h -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html