<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/watchdog/watchdog_dev.c, branch linux-4.8.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.8.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2016-07-25T10:03:04Z</updated>
<entry>
<title>watchdog: core: Clear WDOG_HW_RUNNING before calling the stop function</title>
<updated>2016-07-25T10:03:04Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-07-21T21:21:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3c10bbde10fe4dca52726e246cefa6b0a1dfbd3e'/>
<id>urn:sha1:3c10bbde10fe4dca52726e246cefa6b0a1dfbd3e</id>
<content type='text'>
WDOG_HW_RUNNING indicates that the hardware watchdog is running while the
watchdog device is closed. The flag may be set by the driver when it is
instantiated to indicate that the watchdog is running, and that the
watchdog core needs to send heartbeat requests to the driver until the
watchdog device is opened.

When the watchdog device is closed, the flag can be used by the driver's
stop function to indicate to the watchdog core that it was unable to stop
the watchdog, and that the watchdog core needs to send heartbeat requests.
This only works if the flag is actually cleared when the watchdog is
stopped. To avoid having to clear the flag in each driver's stop function,
clear it in the watchdog core before calling the stop function.

Reported-by: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
Fixes: ee142889e32f ("watchdog: Introduce WDOG_HW_RUNNING flag")
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: core: Fix error handling of watchdog_dev_init()</title>
<updated>2016-07-25T10:02:55Z</updated>
<author>
<name>Wei Yongjun</name>
</author>
<published>2016-07-19T11:22:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=138913cb632be12344982e54ccd12f6f15971bf7'/>
<id>urn:sha1:138913cb632be12344982e54ccd12f6f15971bf7</id>
<content type='text'>
Fix the error handling paths of watchdog_dev_init().

Signed-off-by: Wei Yongjun &lt;yongjun_wei@trendmicro.com.cn&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: Implement status function in watchdog core</title>
<updated>2016-07-19T08:09:07Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-07-17T22:04:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=90b826f17a4e1c4ff2b3ef69512a6409e94f4d64'/>
<id>urn:sha1:90b826f17a4e1c4ff2b3ef69512a6409e94f4d64</id>
<content type='text'>
Up to now, the watchdog status function called a driver function,
which was supposed to return the watchdog status. All but one
driver using the watchdog core did not implement this function,
and the driver implementing it did not implement it correctly
(the function is supposed to return WDIOF_ flags). At the same time,
at least some of the status information can be provided by the watchdog
core.

Provide the available status bits directly from the watchdog driver core.
Call the driver status function if it exists to get the boot status, but
always provide WDIOF_MAGICCLOSE and WDIOF_KEEPALIVEPING internally.
This patch makes the 'status' sysfs attribute always available.
This attribute is now displayed as hex number with 0x prepended to be
easier to decode.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: change watchdog_need_worker logic</title>
<updated>2016-07-17T19:25:53Z</updated>
<author>
<name>Rasmus Villemoes</name>
</author>
<published>2016-07-14T09:16:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3fbfe9264756d3fd99a9210345016c94ec4ada73'/>
<id>urn:sha1:3fbfe9264756d3fd99a9210345016c94ec4ada73</id>
<content type='text'>
If the driver indicates that the watchdog is running, the framework
should feed it until userspace opens the device, regardless of whether
the driver has set max_hw_heartbeat_ms.

This patch only affects the case where wdd-&gt;max_hw_heartbeat_ms is
zero, wdd-&gt;timeout is non-zero, the watchdog is not active and the
hardware device is running (*):

- If wdd-&gt;timeout is zero, watchdog_need_worker() returns false both
before and after this patch, and watchdog_next_keepalive() is not
called.

- If watchdog_active(wdd), the return value from watchdog_need_worker
is also the same as before (namely, hm &amp;&amp; t &gt; hm). Hence in that case,
watchdog_next_keepalive() is only called if hm == max_hw_heartbeat_ms
is non-zero, so the change to min_not_zero there is a no-op.

- If the watchdog is not active and the device is not running, we
return false from watchdog_need_worker just as before.

That leaves the watchdog_hw_running(wdd) &amp;&amp; !watchdog_active(wdd) &amp;&amp;
wdd-&gt;timeout case. Again, it's easy to see that if
wdd-&gt;max_hw_heartbeat_ms is non-zero, we return true from
watchdog_need_worker with and without this patch, and the logic in
watchdog_next_keepalive is unchanged. Finally, if
wdd-&gt;max_hw_heartbeat_ms is 0, we used to end up in the
cancel_delayed_work branch, whereas with this patch we end up
scheduling a ping timeout_ms/2 from now.

(*) This should imply that no current kernel drivers are affected,
since the only drivers which explicitly set WDOG_HW_RUNNING are
imx2_wdt.c and dw_wdt.c, both of which also provide a non-zero value
for max_hw_heartbeat_ms. The watchdog core also sets WDOG_HW_RUNNING,
but only when the driver doesn't provide -&gt;stop, in which case it
must, according to Documentation/watchdog/watchdog-kernel-api.txt, set
max_hw_heartbeat_ms.

Signed-off-by: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
Reviewed-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: core: Fix circular locking dependency</title>
<updated>2016-05-14T14:10:33Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-04-21T14:38:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e1f30282a1d3d0c75d5a08e47c6ac1563065be52'/>
<id>urn:sha1:e1f30282a1d3d0c75d5a08e47c6ac1563065be52</id>
<content type='text'>
lockdep reports the following circular locking dependency.

======================================================
INFO: possible circular locking dependency detected ]
4.6.0-rc3-00191-gfabf418 #162 Not tainted
-------------------------------------------------------
systemd/1 is trying to acquire lock:
((&amp;(&amp;wd_data-&gt;work)-&gt;work)){+.+...}, at: [&lt;80141650&gt;] flush_work+0x0/0x280

but task is already holding lock:

(&amp;wd_data-&gt;lock){+.+...}, at: [&lt;804acfa8&gt;] watchdog_release+0x18/0x190

which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:

-&gt; #1 (&amp;wd_data-&gt;lock){+.+...}:
	[&lt;80662310&gt;] mutex_lock_nested+0x64/0x4a8
	[&lt;804aca4c&gt;] watchdog_ping_work+0x18/0x4c
	[&lt;80143128&gt;] process_one_work+0x1ac/0x500
	[&lt;801434b4&gt;] worker_thread+0x38/0x554
	[&lt;80149510&gt;] kthread+0xf4/0x108
	[&lt;80107c10&gt;] ret_from_fork+0x14/0x24

-&gt; #0 ((&amp;(&amp;wd_data-&gt;work)-&gt;work)){+.+...}:
	[&lt;8017c4e8&gt;] lock_acquire+0x70/0x90
	[&lt;8014169c&gt;] flush_work+0x4c/0x280
	[&lt;801440f8&gt;] __cancel_work_timer+0x9c/0x1e0
	[&lt;804acfcc&gt;] watchdog_release+0x3c/0x190
	[&lt;8022c5e8&gt;] __fput+0x80/0x1c8
	[&lt;80147b28&gt;] task_work_run+0x94/0xc8
	[&lt;8010b998&gt;] do_work_pending+0x8c/0xb4
	[&lt;80107ba8&gt;] slow_work_pending+0xc/0x20

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0                    CPU1
----                    ----
lock(&amp;wd_data-&gt;lock);
                        lock((&amp;(&amp;wd_data-&gt;work)-&gt;work));
                        lock(&amp;wd_data-&gt;lock);
lock((&amp;(&amp;wd_data-&gt;work)-&gt;work));

*** DEADLOCK ***

1 lock held by systemd/1:

stack backtrace:
CPU: 2 PID: 1 Comm: systemd Not tainted 4.6.0-rc3-00191-gfabf418 #162
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
[&lt;8010f5e4&gt;] (unwind_backtrace) from [&lt;8010c038&gt;] (show_stack+0x10/0x14)
[&lt;8010c038&gt;] (show_stack) from [&lt;8039d7fc&gt;] (dump_stack+0xa8/0xd4)
[&lt;8039d7fc&gt;] (dump_stack) from [&lt;80177ee0&gt;] (print_circular_bug+0x214/0x334)
[&lt;80177ee0&gt;] (print_circular_bug) from [&lt;80179230&gt;] (check_prevs_add+0x4dc/0x8e8)
[&lt;80179230&gt;] (check_prevs_add) from [&lt;8017b3d8&gt;] (__lock_acquire+0xc6c/0x14ec)
[&lt;8017b3d8&gt;] (__lock_acquire) from [&lt;8017c4e8&gt;] (lock_acquire+0x70/0x90)
[&lt;8017c4e8&gt;] (lock_acquire) from [&lt;8014169c&gt;] (flush_work+0x4c/0x280)
[&lt;8014169c&gt;] (flush_work) from [&lt;801440f8&gt;] (__cancel_work_timer+0x9c/0x1e0)
[&lt;801440f8&gt;] (__cancel_work_timer) from [&lt;804acfcc&gt;] (watchdog_release+0x3c/0x190)
[&lt;804acfcc&gt;] (watchdog_release) from [&lt;8022c5e8&gt;] (__fput+0x80/0x1c8)
[&lt;8022c5e8&gt;] (__fput) from [&lt;80147b28&gt;] (task_work_run+0x94/0xc8)
[&lt;80147b28&gt;] (task_work_run) from [&lt;8010b998&gt;] (do_work_pending+0x8c/0xb4)
[&lt;8010b998&gt;] (do_work_pending) from [&lt;80107ba8&gt;] (slow_work_pending+0xc/0x20)

Turns out the call to cancel_delayed_work_sync() in watchdog_release()
is not necessary and can be dropped. If the worker is no longer necessary,
the subsequent call to watchdog_update_worker() will cancel it. If it is
already running, it won't do anything, since the worker function checks
if it needs to ping the watchdog or not.

Reported-by: Clemens Gruber &lt;clemens.gruber@pqgruber.com&gt;
Tested-by: Clemens Gruber &lt;clemens.gruber@pqgruber.com&gt;
Fixes: 11d7aba9ceb7 ("watchdog: imx2: Convert to use infrastructure triggered keepalives")
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
Cc: stable &lt;stable@vger.kernel.org&gt;
</content>
</entry>
<entry>
<title>watchdog: Ensure that wdd is not dereferenced if NULL</title>
<updated>2016-03-16T20:11:50Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-03-09T02:46:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d1ed3ba4e3d76b4ebec239c64f990c26d7935700'/>
<id>urn:sha1:d1ed3ba4e3d76b4ebec239c64f990c26d7935700</id>
<content type='text'>
Smatch rightfully complains that wdd is dereferenced in the watchdog
release function after being checked for NULL. Also make sure that it
is not accessed outside mutex protection to avoid use-after-free problems.

Fixes: e6c71e84e4c0 ("watchdog: Introduce WDOG_HW_RUNNING flag")
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: Add support for minimum time between heartbeats</title>
<updated>2016-03-16T20:11:19Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-02-28T21:12:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=15013ad813f6544be8e79afc23672745950d59bc'/>
<id>urn:sha1:15013ad813f6544be8e79afc23672745950d59bc</id>
<content type='text'>
Some watchdogs require a minimum time between heartbeats.
Examples are the watchdogs in DA9062 and AT91SAM9x.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: Make stop function optional</title>
<updated>2016-03-16T20:11:16Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-02-28T21:12:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d0684c8a9354953efdea214b437445c00743cf49'/>
<id>urn:sha1:d0684c8a9354953efdea214b437445c00743cf49</id>
<content type='text'>
Not all hardware watchdogs can be stopped. The driver for
such watchdogs would typically only set the WATCHDOG_HW_RUNNING
flag in its stop function. Make the stop function optional and set
WATCHDOG_HW_RUNNING in the watchdog core if it is not provided.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: Introduce WDOG_HW_RUNNING flag</title>
<updated>2016-03-16T20:11:15Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-02-28T21:12:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ee142889e32f564f9b5e57b68b06693ec5473074'/>
<id>urn:sha1:ee142889e32f564f9b5e57b68b06693ec5473074</id>
<content type='text'>
The WDOG_HW_RUNNING flag is expected to be set by watchdog drivers if
the hardware watchdog is running. If the flag is set, the watchdog
subsystem will ping the watchdog even if the watchdog device is closed.

The watchdog driver stop function is now optional and may be omitted
if the watchdog can not be stopped. If stopping the watchdog is not
possible but the driver implements a stop function, it is responsible
to set the WDOG_HW_RUNNING flag in its stop function.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
<entry>
<title>watchdog: Introduce hardware maximum heartbeat in watchdog core</title>
<updated>2016-03-16T20:11:14Z</updated>
<author>
<name>Guenter Roeck</name>
</author>
<published>2016-02-28T21:12:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=664a39236e718f9f03fa73fc01006da9ced04efc'/>
<id>urn:sha1:664a39236e718f9f03fa73fc01006da9ced04efc</id>
<content type='text'>
Introduce an optional hardware maximum heartbeat in the watchdog core.
The hardware maximum heartbeat can be lower than the maximum timeout.

Drivers can set the maximum hardware heartbeat value in the watchdog data
structure. If the configured timeout exceeds the maximum hardware heartbeat,
the watchdog core enables a timer function to assist sending keepalive
requests to the watchdog driver.

Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Signed-off-by: Wim Van Sebroeck &lt;wim@iguana.be&gt;
</content>
</entry>
</feed>
