linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Disabling watchdog when closing /dev/watchdog
@ 2013-10-09 23:47 Markus Mayer
  2013-10-12 22:28 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Mayer @ 2013-10-09 23:47 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: Linux Watchdog

Currently, the watchdog framework works such that upon closing
/dev/watchdog it will attempt to disable the watchdog timer and,
failing that, will poke the watchdog (via the watchdog_release()
function).

I am working on a new watchdog driver for a Broadcom SoC, and for test
purposes at least, it would be helpful if the watchdog could be left
alone when the device is closed (i.e. the watchdog is neither stopped
nor poked). That way I could use a command line utility to issue ioctl
calls and observe the effect of these calls.

Right now, using my line tool to check the "time left" will return the
proper amount of time left, but it will also poke the watchdog,
therefore changing the time that's actually left until the watchdog
expires (the command line tool opens /dev/watchdog, issues an ioctl
and closes /dev/watchdog), turning a "read-only" operation into one
that actually changes the watchdog's status.

Automatically stopping or poking the watchdog upon close only makes
sense in the case of a continuously running daemon that keeps
/dev/watchdog open at all times. It doesn't work for case where an
application would open the watchdog device only for brief amounts of
time.

Would it make sense to add a flag like "WDOG_LEAVE_ON" to, say, struct
watchdog_device's "status" values, which the driver could set,
allowing watchdog_release() to leave the watchdog alone upon closing
the device? Or is there a different way to achieve this? A daemon is
not practicable for me at this point, and even later on, we may not
want to go with a daemon solution, but may want to rely on the
watchdog continuing to run even if the device is closed.

Thanks,
-Markus

-- 
Markus Mayer
Broadcom Landing Team

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Disabling watchdog when closing /dev/watchdog
  2013-10-09 23:47 Disabling watchdog when closing /dev/watchdog Markus Mayer
@ 2013-10-12 22:28 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2013-10-12 22:28 UTC (permalink / raw)
  To: Markus Mayer, Wim Van Sebroeck; +Cc: Linux Watchdog

On 10/09/2013 04:47 PM, Markus Mayer wrote:
> Currently, the watchdog framework works such that upon closing
> /dev/watchdog it will attempt to disable the watchdog timer and,
> failing that, will poke the watchdog (via the watchdog_release()
> function).
>
> I am working on a new watchdog driver for a Broadcom SoC, and for test
> purposes at least, it would be helpful if the watchdog could be left
> alone when the device is closed (i.e. the watchdog is neither stopped
> nor poked). That way I could use a command line utility to issue ioctl
> calls and observe the effect of these calls.
>
> Right now, using my line tool to check the "time left" will return the
> proper amount of time left, but it will also poke the watchdog,
> therefore changing the time that's actually left until the watchdog
> expires (the command line tool opens /dev/watchdog, issues an ioctl
> and closes /dev/watchdog), turning a "read-only" operation into one
> that actually changes the watchdog's status.
>
> Automatically stopping or poking the watchdog upon close only makes
> sense in the case of a continuously running daemon that keeps
> /dev/watchdog open at all times. It doesn't work for case where an
> application would open the watchdog device only for brief amounts of
> time.
>
> Would it make sense to add a flag like "WDOG_LEAVE_ON" to, say, struct
> watchdog_device's "status" values, which the driver could set,
> allowing watchdog_release() to leave the watchdog alone upon closing
> the device? Or is there a different way to achieve this? A daemon is
> not practicable for me at this point, and even later on, we may not
> want to go with a daemon solution, but may want to rely on the
> watchdog continuing to run even if the device is closed.
>

It might make more sense to use sysfs attributes to provide this
functionality (name, status, ping, configured timeout, time left,
reboot reason, ...). I think that would be much cleaner and accomplish
the same. Another option might be debugfs if this is supposed
to be used for debugging only.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-12 22:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09 23:47 Disabling watchdog when closing /dev/watchdog Markus Mayer
2013-10-12 22:28 ` Guenter Roeck

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).