Hi Vladimir, > 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 > > Watchdogs with WDIOF_PRETIMEOUT capability now may have three device > attributes in sysfs: read only pretimeout value attribute, read/write > pretimeout_governor attribute, 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 two simple watchdog pretimeout governors > are added for review: noop (default) and panic. > > This series is based on current Wim's watchdog/master branch, also > I took the liberty of adding commit message tags provided by Wolfram > and Guenter for v5, because the only functional change between v5 and > v6 is quite trivial, please feel free to revoke or confirm the tags: > > diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h > index c776debde228..35a4d8185b51 100644 > --- a/include/linux/watchdog.h > +++ b/include/linux/watchdog.h > @@ -194,7 +194,7 @@ void watchdog_notify_pretimeout(struct watchdog_device *wdd); > #else > static inline void watchdog_notify_pretimeout(struct watchdog_device *wdd) > { > - panic("watchdog pretimeout event\n"); > + pr_alert("watchdog%d: pretimeout event\n", wdd->id); > } > #endif > > Changes from v5 to v6: > * rebased on top of Wim's watchdog/master branch for v4.9 release, > 3 commits are already applied, thus they are dropped from the series, > * swapped panic and noop governors per Wim's request, now noop > action on pretimeout is set by default (same as in v1 of the series), > * slightly extended a commit message of the panic pretimeout governor, > * added reviewed-by and tested-by tags given by Wolfram and Guenter. > > Changes from v4 to v5: > * fixed in source tree compilation issue, thanks to Wolfram > * replaced strncmp() with more suitable sysfs_streq() to > compare strings passed over sysfs (Wolfram) > * added Wolfram's implementation of pretimeout to softdog driver > * added watchdog pretimeout support to iMX2+ driver > * minor whitespace issue fixes reported by checkpatch > > Changes from v3 to v4 : > * took Wolfram's more advanced flavour of "watchdog: add > set_pretimeout interface" change, which is based on originally > written by Robin Gong code (Wolfram) > * documented new watchdog_notify_pretimeout() function for developers > of watchdog device drivers (Guenter) > * reordered logical operations in wdt_is_visible() for better clarity (Guenter) > * if watchdog pretimeout governor is not registered return empty > string on reading "pretimeout_governor" device attribute, however with > the default governor built-in this should never happen on practice (Guenter) > * removed a number of sanity checks from functions which are assumed > to be exported, callers are expected to write correct code, also this > fixes one bug in watchdog_register_governor() noticed by Guenter (Guenter) > * reworded some commit messages (Guenter) > * moved registration of watchdog pretimeout event by from watchdog_core.c to > watchdog_dev.c (Wolfram) > * from the series removed support of potentially sleeping governors (Wolfram) > * removed "panic panic" duplication in a user's message (Wolfram) > * report watchdog name in a message given by noop governor (Wolfram) > * exploiting the fact that there is only one default governor selected > at build time allows to remove .is_default from "struct governor_priv" > and find_default_governor() helper function, this is a change against > complete version v2 > * by unloading some assigned non-default governor a watchdog device > falls back to default governor, this allows to avoid complicated > module locking scheme by module owners, this is a change against > completeversion v2 > * to avoid spreading of watchdog device "struct device" operations > while adding device attributes by watchdog_pretimeout_governor_[gs]et() > and watchdog_pretimeout_available_governors_get() functions called > from watchdog_dev.c, this is a change against complete version v2 > * split the main change into 3 to hopefully enlighten review process: > 1) default governor support only, 2) selectable by a user governor in > runtime, 3) added pretimeout_available_governors attribute > * fixed a list element deregistration bug > > Changes from v2 to v3: > * from watchdog_pretimeout.c removed all features mentioned above > * rebased panic and noop governors on top of the simplified watchdog pretimeout > framework > * added 2 rebased and cleaned up changes done by Robin Gong to the series, > Robin's changes allow to test the series, if some individual watchdog driver > adds WDIOF_PRETIMEOUT support and calls watchdog_notify_pretimeout(), > for example Robin implemented the feature for imx2+ watchdog driver > * added pretimeout value display over sysfs for WDIOF_PRETIMEOUT capable > watchdog devices > * moved sysfs device attributes to watchdog_dev.c, this required to add > exported watchdog_pretimeout_governor_name() interface > * if pretimeout framework is not selected, then pretimeout event ends up > in kernel panic -- this behaviour as a default one was asked by Guenter > * due to removal of support to sleeing governors removed userspace > notification pretimeout governor from the series > * minor clean-ups and adjustments > > 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 (6): > watchdog: add watchdog pretimeout governor framework > watchdog: pretimeout: add noop pretimeout governor > watchdog: pretimeout: add panic pretimeout governor > watchdog: pretimeout: add option to select a pretimeout governor in runtime > watchdog: pretimeout: add pretimeout_available_governors attribute > watchdog: imx2_wdt: add pretimeout function support > > Wolfram Sang (1): > watchdog: softdog: implement pretimeout support > > Documentation/watchdog/watchdog-kernel-api.txt | 13 ++ > drivers/watchdog/Kconfig | 49 ++++++ > drivers/watchdog/Makefile | 8 +- > drivers/watchdog/imx2_wdt.c | 48 ++++++ > drivers/watchdog/pretimeout_noop.c | 47 ++++++ > drivers/watchdog/pretimeout_panic.c | 47 ++++++ > drivers/watchdog/softdog.c | 22 ++- > drivers/watchdog/watchdog_dev.c | 45 +++++ > drivers/watchdog/watchdog_pretimeout.c | 220 +++++++++++++++++++++++++ > drivers/watchdog/watchdog_pretimeout.h | 60 +++++++ > include/linux/watchdog.h | 13 ++ > 11 files changed, 570 insertions(+), 2 deletions(-) > create mode 100644 drivers/watchdog/pretimeout_noop.c > create mode 100644 drivers/watchdog/pretimeout_panic.c > create mode 100644 drivers/watchdog/watchdog_pretimeout.c > create mode 100644 drivers/watchdog/watchdog_pretimeout.h > > -- > 2.8.1 > This series is added to linux-watchdog-next. Kind regards, Wim. -- 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