linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rasmus Villemoes <Rasmus.Villemoes@prevas.se>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Jonathan Corbet <corbet@lwn.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	Esben Haabendal <esben@haabendal.dk>,
	"martin@hundeboll.net" <martin@hundeboll.net>
Subject: Re: [PATCH v9 1/3] watchdog: introduce watchdog.open_timeout commandline parameter
Date: Wed, 30 Jan 2019 07:40:15 +0000	[thread overview]
Message-ID: <354edbef-1ad5-78d8-e210-e55c38798962@prevas.se> (raw)
In-Reply-To: <de4bd94c-d2f7-66c2-6386-8b1cec57af03@prevas.dk>

On 29/01/2019 21.35, Rasmus Villemoes wrote:
> On 22/01/2019 18.29, Guenter Roeck wrote:
>> On Mon, Jan 21, 2019 at 08:45:39PM +0000, Rasmus Villemoes wrote:
>>>  
>>>  static void watchdog_ping_work(struct kthread_work *work)
>>> @@ -297,7 +317,7 @@ static int watchdog_stop(struct watchdog_device *wdd)
>>>  		return -EBUSY;
>>>  	}
>>>  
>>> -	if (wdd->ops->stop) {
>>> +	if (wdd->ops->stop && !open_timeout) {
>>
>> This changes the semantics of WDIOC_SETOPTIONS / WDIOS_DISABLECARD.
>> "Turn off the watchdog timer" is well defined and doesn't leave
>> the option of setting a timeout on it.
> 
> I can drop this hunk, since it's mostly irrelevant to the actual use
> cases I have in mind. It makes testing the feature on reference boards a
> little more awkward, but I can live with that.

Actually, that's not enough - if there was a non-zero open_timeout at
boot, the device has had its ->open_deadline set to some finite (not
KTIME_MAX) value, and ->open_deadline does not get updated on the
WDIOC_SETOPTIONS / WDIOS_DISABLECARD path.

So, I think one way to preserve the semantics of WDIOS_DISABLECARD
(which, for a non-stopable watchdog really means "please let the kernel
take care of this indefinitely, or until WDIOS_ENABLECARD") is to extend
watchdog_stop with a timeout parameter, and do the call of
watchdog_set_open_deadline() from watchdog_stop() using the passed
timeout value. When called from the WDIOS_DISABLECARD case, we'd pass 0
for that timeout, while the call from _release would pass the module
parameter open_timeout. [Obviously, watchdog_set_open_deadline() would
also take the timeout as a parameter instead of referring to the
open_timeout directly.]

Thanks for pointing out the WDIOS_DISABLECARD case. I'll try to make the
above into code to see how it looks.

Rasmus


  reply	other threads:[~2019-01-30  7:40 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-16 12:14 [PATCH v8 0/3] watchdog: allow setting deadline for opening /dev/watchdogN Rasmus Villemoes
2019-01-16 12:14 ` [PATCH v8 1/3] watchdog: introduce watchdog.open_timeout commandline parameter Rasmus Villemoes
2019-01-17 21:24   ` Guenter Roeck
2019-01-16 12:14 ` [PATCH v8 2/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_TIMEOUT Rasmus Villemoes
2019-01-16 12:14 ` [PATCH v8 3/3] watchdog: make the device time out at open_deadline when open_timeout is used Rasmus Villemoes
2019-01-16 14:45 ` [PATCH v8 0/3] watchdog: allow setting deadline for opening /dev/watchdogN Esben Haabendal
2019-01-21 20:45 ` [PATCH v9 " Rasmus Villemoes
2019-01-21 20:45   ` [PATCH v9 1/3] watchdog: introduce watchdog.open_timeout commandline parameter Rasmus Villemoes
2019-01-22 17:29     ` Guenter Roeck
2019-01-29 20:35       ` Rasmus Villemoes
2019-01-30  7:40         ` Rasmus Villemoes [this message]
2019-01-21 20:45   ` [PATCH v9 2/3] watchdog: introduce CONFIG_WATCHDOG_OPEN_TIMEOUT Rasmus Villemoes
2019-01-21 20:45   ` [PATCH v9 3/3] watchdog: make the device time out at open_deadline when open_timeout is used Rasmus Villemoes
2019-05-01  0:05   ` [PATCH v9 0/3] watchdog: allow setting deadline for opening /dev/watchdogN Jerry Hoemann
2019-05-01  6:32     ` Rasmus Villemoes

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=354edbef-1ad5-78d8-e210-e55c38798962@prevas.se \
    --to=rasmus.villemoes@prevas.se \
    --cc=corbet@lwn.net \
    --cc=esben@haabendal.dk \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=martin@hundeboll.net \
    --cc=wim@linux-watchdog.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).