From: Wim Coekaerts <wim.coekaerts@oracle.com>
To: Julian Calaby <julian.calaby@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
wim@iguana.be, linux-watchdog@vger.kernel.org,
sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCH] watchdog: add sun4v_wdt device support
Date: Wed, 20 Jan 2016 18:36:30 -0800 [thread overview]
Message-ID: <56A0442E.9020703@oracle.com> (raw)
In-Reply-To: <CAGRGNgXPfeSpwk3jS1m55qFDzjfHu=tZb7LsEbgCyKw9W-UmNQ@mail.gmail.com>
On 1/20/16 6:23 PM, Julian Calaby wrote:
> Hi Wim,
>
> On Thu, Jan 21, 2016 at 12:35 PM, Wim Coekaerts
> <wim.coekaerts@oracle.com> wrote:
>>
>> On 1/20/16 3:45 PM, Guenter Roeck wrote:
>>> On Wed, Jan 20, 2016 at 03:19:46PM -0800, Wim Coekaerts wrote:
>>>> On 01/20/2016 02:43 PM, Julian Calaby wrote:
>>>>> Hi Wim Coekaerts,
>>>>>
>>>>> On Thu, Jan 21, 2016 at 7:30 AM, <wim.coekaerts@oracle.com> wrote:
>>>>>> From: Wim Coekaerts <wim.coekaerts@oracle.com>
>>>>>>
>>>>>> This adds a simple watchdog timer for the SPARC sunv4 architecture.
>>>>>> Export the sun4v_mach_set_watchdog() hv call, and add the target.
>>>>>>
>>>>>> The driver is implemented using the new watchdog api framework.
>>>>>>
>>>>>> Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
>>>>> This all looks _much_ better.
>>>> thanks! :)
>>>>> There's nothing glaringly wrong with the code like the last version,
>>>>> so I've only got a couple of general questions:
>>>>>
>>>>> 1. Is the platform device and driver necessary? Can't you just
>>>>> register the watchdog device directly from sun4v_wdt_init_module()?
>>>>>
>>>>> 2. If the platform device is unnecessary, do you still need a struct
>>>>> watchdog_device in struct sun4v_wdt? I.e. does the watchdog core stop
>>>>> watchdogs when you call watchdog_unregister_device()? (Or could you
>>>>> refactor to not require it?)
>>>> I like to be able to implement support for suspend/resume for ldoms
>>>> as we add more support for that in the future, and support for migrating
>>>> domains and such. So having a platform driver is useful to here as a
>>>> framework.
>>>>
>>>>> 3. Is it possible to get the data for sun4v_wdt_get_timeleft() by
>>>>> calling some other sun4v_mach_*() function?
>>>> No there is only one hv call for watchdog and that's this one.
>>>>
>>>> time_remaining is the time that was left until the timer was going
>>>> to expire when making the call so it's not useful for the future time.
>>>>
>>>> And you can't just make a call to get time_remaining except to reset
>>>> the timer or disable it along with it. quantum physics timer :)
>>>>
>>> I'll comment on the rest of the driver separately. However, since
>>> get_timeleft()
>>> was brought up - the idea here is to report the time left as reported from
>>> the
>>> hardware, not the time left calculated by software. If we want to
>>> calculate
>>> the time left until expiry in software, it should be done in the watchdog
>>> core.
>>> It should not be done in drivers.
>>>
>> I guess you could add a soft_get_timeleft() so that it's clear that if a
>> driver doesn't
>> implement the call, you get a best effort response.
>>
>> Happy to remove the op from the driver and maybe we can implement it
>> separately in core in a separate patch if that's of interest.
>>
>> However, this makes me ponder what could be done with the "time_remaining"
>> behavior on sun4v. It could be useful for a piece of software to use that
>> value
>> to see the drift. "I pinged 30 seconds ago, per my assumption of time but
>> the
>> timer says it was 50 seconds ago, something is wrong".
>>
>> What if I would report back time_remaining like that, but of course now
>> that it's
>> pinged again it reset the timer. Not sure whether you can see any use of
>> such
>> behavior. It wouldn't be get_timeleft() but more get_timewasleft() ;) or
>> it could be a positive return from _ping... just noodling
> How about _start() and _ping() set wdt->expires like this:
>
> err = sun4v_mach_set_watchdog(wdd->timeout * 1000, &time_remaining);
> wdt->expires = ktime_to_timespec(ktime_get()).tv_sec + time_remaining / 1000;
>
> Then _timeleft() could be something like:
>
> return wdt->expires - ktime_to_timespec(ktime_get()).tv_sec;
>
> Thanks,
>
This is how the return works :
let's say wdd->timeout = 60
I call it at time [0s] - so my timer expires in 60s (at time [60s])
at time [20s], I ping, it will end up with :
set_watchdog(60, &time_remaining)
timer expires is back to 60s from time [20s] so would expires at time [80s]
however, at time [20s] time_remaining will return 40 (time remaining on
timer when I made the call).
as this returns the time remaining from the previous timer.
40 is clearly wrong for the use of timeleft or expires because the timer
is reset back to 60s countdown
WARNING: multiple messages have this Message-ID (diff)
From: Wim Coekaerts <wim.coekaerts@oracle.com>
To: Julian Calaby <julian.calaby@gmail.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
wim@iguana.be, linux-watchdog@vger.kernel.org,
sparclinux <sparclinux@vger.kernel.org>
Subject: Re: [PATCH] watchdog: add sun4v_wdt device support
Date: Thu, 21 Jan 2016 02:36:30 +0000 [thread overview]
Message-ID: <56A0442E.9020703@oracle.com> (raw)
In-Reply-To: <CAGRGNgXPfeSpwk3jS1m55qFDzjfHu=tZb7LsEbgCyKw9W-UmNQ@mail.gmail.com>
On 1/20/16 6:23 PM, Julian Calaby wrote:
> Hi Wim,
>
> On Thu, Jan 21, 2016 at 12:35 PM, Wim Coekaerts
> <wim.coekaerts@oracle.com> wrote:
>>
>> On 1/20/16 3:45 PM, Guenter Roeck wrote:
>>> On Wed, Jan 20, 2016 at 03:19:46PM -0800, Wim Coekaerts wrote:
>>>> On 01/20/2016 02:43 PM, Julian Calaby wrote:
>>>>> Hi Wim Coekaerts,
>>>>>
>>>>> On Thu, Jan 21, 2016 at 7:30 AM, <wim.coekaerts@oracle.com> wrote:
>>>>>> From: Wim Coekaerts <wim.coekaerts@oracle.com>
>>>>>>
>>>>>> This adds a simple watchdog timer for the SPARC sunv4 architecture.
>>>>>> Export the sun4v_mach_set_watchdog() hv call, and add the target.
>>>>>>
>>>>>> The driver is implemented using the new watchdog api framework.
>>>>>>
>>>>>> Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
>>>>> This all looks _much_ better.
>>>> thanks! :)
>>>>> There's nothing glaringly wrong with the code like the last version,
>>>>> so I've only got a couple of general questions:
>>>>>
>>>>> 1. Is the platform device and driver necessary? Can't you just
>>>>> register the watchdog device directly from sun4v_wdt_init_module()?
>>>>>
>>>>> 2. If the platform device is unnecessary, do you still need a struct
>>>>> watchdog_device in struct sun4v_wdt? I.e. does the watchdog core stop
>>>>> watchdogs when you call watchdog_unregister_device()? (Or could you
>>>>> refactor to not require it?)
>>>> I like to be able to implement support for suspend/resume for ldoms
>>>> as we add more support for that in the future, and support for migrating
>>>> domains and such. So having a platform driver is useful to here as a
>>>> framework.
>>>>
>>>>> 3. Is it possible to get the data for sun4v_wdt_get_timeleft() by
>>>>> calling some other sun4v_mach_*() function?
>>>> No there is only one hv call for watchdog and that's this one.
>>>>
>>>> time_remaining is the time that was left until the timer was going
>>>> to expire when making the call so it's not useful for the future time.
>>>>
>>>> And you can't just make a call to get time_remaining except to reset
>>>> the timer or disable it along with it. quantum physics timer :)
>>>>
>>> I'll comment on the rest of the driver separately. However, since
>>> get_timeleft()
>>> was brought up - the idea here is to report the time left as reported from
>>> the
>>> hardware, not the time left calculated by software. If we want to
>>> calculate
>>> the time left until expiry in software, it should be done in the watchdog
>>> core.
>>> It should not be done in drivers.
>>>
>> I guess you could add a soft_get_timeleft() so that it's clear that if a
>> driver doesn't
>> implement the call, you get a best effort response.
>>
>> Happy to remove the op from the driver and maybe we can implement it
>> separately in core in a separate patch if that's of interest.
>>
>> However, this makes me ponder what could be done with the "time_remaining"
>> behavior on sun4v. It could be useful for a piece of software to use that
>> value
>> to see the drift. "I pinged 30 seconds ago, per my assumption of time but
>> the
>> timer says it was 50 seconds ago, something is wrong".
>>
>> What if I would report back time_remaining like that, but of course now
>> that it's
>> pinged again it reset the timer. Not sure whether you can see any use of
>> such
>> behavior. It wouldn't be get_timeleft() but more get_timewasleft() ;) or
>> it could be a positive return from _ping... just noodling
> How about _start() and _ping() set wdt->expires like this:
>
> err = sun4v_mach_set_watchdog(wdd->timeout * 1000, &time_remaining);
> wdt->expires = ktime_to_timespec(ktime_get()).tv_sec + time_remaining / 1000;
>
> Then _timeleft() could be something like:
>
> return wdt->expires - ktime_to_timespec(ktime_get()).tv_sec;
>
> Thanks,
>
This is how the return works :
let's say wdd->timeout = 60
I call it at time [0s] - so my timer expires in 60s (at time [60s])
at time [20s], I ping, it will end up with :
set_watchdog(60, &time_remaining)
timer expires is back to 60s from time [20s] so would expires at time [80s]
however, at time [20s] time_remaining will return 40 (time remaining on
timer when I made the call).
as this returns the time remaining from the previous timer.
40 is clearly wrong for the use of timeleft or expires because the timer
is reset back to 60s countdown
next prev parent reply other threads:[~2016-01-21 2:37 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-20 20:30 [PATCH] watchdog: add sun4v_wdt device support wim.coekaerts
2016-01-20 20:30 ` wim.coekaerts
2016-01-20 22:43 ` Julian Calaby
2016-01-20 22:43 ` Julian Calaby
2016-01-20 23:19 ` Wim Coekaerts
2016-01-20 23:19 ` Wim Coekaerts
2016-01-20 23:40 ` Julian Calaby
2016-01-20 23:40 ` Julian Calaby
2016-01-20 23:45 ` Guenter Roeck
2016-01-20 23:45 ` Guenter Roeck
2016-01-21 1:35 ` Wim Coekaerts
2016-01-21 1:35 ` Wim Coekaerts
2016-01-21 2:23 ` Julian Calaby
2016-01-21 2:23 ` Julian Calaby
2016-01-21 2:36 ` Wim Coekaerts [this message]
2016-01-21 2:36 ` Wim Coekaerts
2016-01-21 2:41 ` Julian Calaby
2016-01-21 2:41 ` Julian Calaby
2016-01-20 23:37 ` Wim Coekaerts
2016-01-20 23:37 ` Wim Coekaerts
-- strict thread matches above, loose matches on Subject: below --
2016-01-21 16:34 Guenter Roeck
2016-01-21 16:34 ` Guenter Roeck
2016-01-22 19:06 ` Wim Coekaerts
2016-01-22 19:06 ` Wim Coekaerts
2016-01-12 23:10 wim.coekaerts
2016-01-12 23:10 ` wim.coekaerts
2016-01-13 0:06 ` Julian Calaby
2016-01-13 0:06 ` Julian Calaby
2016-01-13 1:12 ` Guenter Roeck
2016-01-13 1:12 ` Guenter Roeck
2016-01-14 16:27 ` Wim Coekaerts
2016-01-14 16:27 ` Wim Coekaerts
2016-01-15 20:21 ` David Miller
2016-01-15 20:21 ` David Miller
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=56A0442E.9020703@oracle.com \
--to=wim.coekaerts@oracle.com \
--cc=julian.calaby@gmail.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sparclinux@vger.kernel.org \
--cc=wim@iguana.be \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.