From: timo.kokkonen@offcode.fi (Timo Kokkonen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv7 0/8] watchdog: Extend kernel API and add early_timeout_sec feature
Date: Wed, 22 Apr 2015 14:11:34 +0300 [thread overview]
Message-ID: <1429701102-22320-1-git-send-email-timo.kokkonen@offcode.fi> (raw)
The watchdog kernel API is quite limited. It has support for providing
generic device handling, but it doesn't really know anything about the
watchdog hardware or its constraints. The watchdog drivers come with a
lot of diversity and their own set of quirks and constraints. Some of
their limitations are not nice for the user space, so the drivers work
around them with all sorts of ad hoc implementations.
One common pattern is to use kernel timers or work queues to allow
longer timeout parameters than the actual hardware supports. To solve
this problem, this patch set extends the kernel watchdog API with a few
parameters that let the core know more about the watchdog HW and take
care about the timeout extending.
The patch set also implements "early_timeout_sec" feature that is very
common on many production systems where early kernel or user space
crashes must lead to a device reset. Traditional watchdog handling
does not allow this as the watchdog is stopped (fully or emulating
stopped state with kernel timers) before user space opens it for the
first time.
As a consequence of the core being able to extend the HW timeout, the
maximum timeout parameter is no longer used with the drivers that use
the new API extension. Instead, arbitrary timeout parameters are
supported, as long as they are longer than the minimum supported by
the driver.
The changes in this series are designed to be taken in use one driver
at time. Old drivers continue to work exactly the same as before.
This patch set converts at91sam9_wdt, imx2_wdt and omap_wdt to use the
new API. The patches have been tested on three ARM boards: ADG42 (at91
sama5d3), beaglebone and wandboard dual.
Please review and give feedback.
Patch revision history:
-v7: Convert also omap_wdt and imx2_wdt drivers in addition to
at91sam9_wdt to use the new core API. This allowed me to test a lot
more use cases and find many bugs I had left in previous
version. The max_timeout parameter is no longer needed for new
drivers as watchdog core can extend the timeout and support
unlimited timeout values on behalf of the HW.
-v6: Fixed some issued based on feedback from Wenyou Yang. The logic
in watchdog_worker() function is now significantly easier to
read. Several errors with stopping and starting the worker are also
now fixed.
-v5: Re-think the approach to be fully generic. The early_timeout_sec
handling is no longer in the driver but in the watchdog core. As a
result the core needed to gain knowledge about the watchdog
hardware. Appropriate handling is added in the core. The side effect
for this is that drivers using the new extensions can be simplified
a lot and different kinds of watchdog hardware can be made to
behave the same for the user space.
-v4: Binding documentation is now separated completely from the driver
patch. The documentation no longer makes any assumptions about how
the actual implementation is made, it just describes the actual
behavior the driver should implement in order to satisfy the
requirement.
- v3: Rename the property to "early-timeout-sec" and use it as a
timeout value that stops the timer in the atmel driver after the
timeout expires. A watchdog.txt is also introduced for documenting
the common watchdog properties, including now this one and
"timeout-sec" property.
- v2: Rename the property to "enable-early-reset" as the behavior
itself is not atmel specific. This way other drivers are free to
implement same behavior with the same property name.
- v1: Propose property name "atmle,no-early-timer" for disabling the
timer that keeps the atmel watchdog running until user space opens
the device.
Timo Kokkonen (8):
watchdog: Extend kernel API to know about HW limitations
watchdog: Allow watchdog to reset device at early boot
devicetree: Document generic watchdog properties
Documentation/watchdog: watchdog-test.c: Add support for changing
timeout
watchdog: at91sam9_wdt: Convert to use new watchdog core extensions
watchdog: imx2_wdt: Convert to use new core extensions
watchdog: omap_wdt: Fix memory leak on probe fail
watchdog: omap_wdt: Convert to use new core extensions
.../devicetree/bindings/watchdog/watchdog.txt | 20 ++++
Documentation/watchdog/src/watchdog-test.c | 6 +
drivers/watchdog/at91sam9_wdt.c | 62 +++-------
drivers/watchdog/imx2_wdt.c | 43 ++-----
drivers/watchdog/omap_wdt.c | 48 ++++++--
drivers/watchdog/watchdog_core.c | 127 ++++++++++++++++++++-
drivers/watchdog/watchdog_dev.c | 79 +++++++++++--
include/linux/watchdog.h | 24 ++++
8 files changed, 313 insertions(+), 96 deletions(-)
create mode 100644 Documentation/devicetree/bindings/watchdog/watchdog.txt
--
2.1.0
next reply other threads:[~2015-04-22 11:11 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-22 11:11 Timo Kokkonen [this message]
2015-04-22 11:11 ` [PATCHv7 1/8] watchdog: Extend kernel API to know about HW limitations Timo Kokkonen
2015-04-24 17:08 ` Guenter Roeck
2015-04-27 5:41 ` Timo Kokkonen
2015-05-04 7:58 ` Uwe Kleine-König
2015-05-04 9:40 ` Timo Kokkonen
2015-05-04 15:43 ` Guenter Roeck
2015-05-05 6:26 ` Timo Kokkonen
2015-05-04 21:17 ` Marc Kleine-Budde
2015-04-22 11:11 ` [PATCHv7 2/8] watchdog: Allow watchdog to reset device at early boot Timo Kokkonen
2015-04-22 11:11 ` [PATCHv7 3/8] devicetree: Document generic watchdog properties Timo Kokkonen
2015-04-22 11:11 ` [PATCHv7 4/8] Documentation/watchdog: watchdog-test.c: Add support for changing timeout Timo Kokkonen
2015-04-22 11:11 ` [PATCHv7 5/8] watchdog: at91sam9_wdt: Convert to use new watchdog core extensions Timo Kokkonen
2015-04-22 11:11 ` [PATCHv7 6/8] watchdog: imx2_wdt: Convert to use new " Timo Kokkonen
2015-05-05 8:11 ` Marc Kleine-Budde
2015-05-05 8:31 ` Marc Kleine-Budde
2015-05-05 9:07 ` Timo Kokkonen
2015-04-22 11:11 ` [PATCHv7 7/8] watchdog: omap_wdt: Fix memory leak on probe fail Timo Kokkonen
2015-04-26 15:32 ` Guenter Roeck
2015-04-27 5:50 ` Timo Kokkonen
2015-04-22 11:11 ` [PATCHv7 8/8] watchdog: omap_wdt: Convert to use new core extensions Timo Kokkonen
2015-05-03 18:56 ` Uwe Kleine-König
2015-05-04 5:59 ` Timo Kokkonen
2015-05-04 7:04 ` Uwe Kleine-König
2015-05-04 10:06 ` Timo Kokkonen
2015-05-07 6:42 ` Timo Kokkonen
2015-05-07 7:30 ` Uwe Kleine-König
2015-05-07 7:39 ` Timo Kokkonen
2015-05-04 16:08 ` Guenter Roeck
2015-05-05 13:50 ` [PATCHv7 0/8] watchdog: Extend kernel API and add early_timeout_sec feature Uwe Kleine-König
2015-05-06 7:26 ` Timo Kokkonen
2015-05-06 7:48 ` Uwe Kleine-König
2015-05-06 8:23 ` Timo Kokkonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1429701102-22320-1-git-send-email-timo.kokkonen@offcode.fi \
--to=timo.kokkonen@offcode.fi \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).