linux-watchdog.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: "Klein, Curtis" <curtis.klein@hpe.com>,
	Jiri Slaby <jirislaby@kernel.org>,
	"wim@linux-watchdog.org" <wim@linux-watchdog.org>
Cc: "linux-watchdog@vger.kernel.org" <linux-watchdog@vger.kernel.org>
Subject: Re: was [Re: [PATCH v3] watchdog: Add hrtimer-based pretimeout feature]
Date: Sun, 5 Sep 2021 15:56:57 -0700	[thread overview]
Message-ID: <ab0b4ca3-28f4-227b-faf8-984ca1d8fbe5@roeck-us.net> (raw)
In-Reply-To: <CS1PR8401MB1270909863CE345530C9FFFB89D19@CS1PR8401MB1270.NAMPRD84.PROD.OUTLOOK.COM>

On 9/5/21 3:22 PM, Klein, Curtis wrote:
> On 9/4/21, 1:19AM, Jiri Slaby wrote:
>> On 04. 09. 21, 10:16, Jiri Slaby wrote:
>>> On 02. 09. 21, 16:05, Guenter Roeck wrote:
>>>> On 9/1/21 11:55 PM, Jiri Slaby wrote:
>>>>> On 03. 02. 21, 21:11, Curtis Klein wrote:
>>>>>> This adds the option to use a hrtimer to generate a watchdog pretimeout
>>>>>> event for hardware watchdogs that do not natively support watchdog
>>>>>> pretimeouts.
>>>>>>
>>>>>> With this enabled, all watchdogs will appear to have pretimeout support
>>>>>> in userspace. If no pretimeout value is set, there will be no change in
>>>>>> the watchdog's behavior.
>>>>>
>>>>> Hi,
>>>>>
>>>>> on my Dell Latitude 7280, CONFIG_WATCHDOG_HRTIMER_PRETIMEOUT=y causes
>>>>> all reboot, kexec, suspend to panic. Disabling that option makes it
>>>>> all work again. Provided it happens very late in the process, I don't
>>>>> know how to grab some logs...
>>>>>
>>>>> Any ideas?
>>>>>
>>>>
>>>> AFAICS the timer does not stop on reboot. I think we'll need to
>>>> augment the code
>>>> to do that.
>>>
>>> No, it is stopped via device unregister -> watchdog_dev_unregister ->
>>> watchdog_cdev_unregister -> watchdog_hrtimer_pretimeout_stop.
>>>
>>> But look:
>>> watchdog_cdev_unregister
>>>     -> wdd->wd_data = NULL;
>>>     -> watchdog_hrtimer_pretimeout_stop
>>>       -> hrtimer_cancel(&wdd->wd_data->pretimeout_timer);
>>>
>>> The diff below obviously fixes the issue,
>>
>> Which is exactly a -next commit:
>> commit c7b178dae139f8857edc50888cfbf251cd974a38
>> Author: Curtis Klein <curtis.klein@hpe.com>
>> Date:   Tue Jun 22 23:26:23 2021 -0700
>>
>>       watchdog: Fix NULL pointer dereference when releasing cdev
>>
>>> --- a/drivers/watchdog/watchdog_dev.c
>>> +++ b/drivers/watchdog/watchdog_dev.c
>>> @@ -1096,6 +1096,8 @@ static void watchdog_cdev_unregister(struct
>>> watchdog_device *wdd)
>>>                   watchdog_stop(wdd);
>>>           }
>>>
>>> +       watchdog_hrtimer_pretimeout_stop(wdd);
>>> +
>>>           mutex_lock(&wd_data->lock);
>>>           wd_data->wdd = NULL;
>>>           wdd->wd_data = NULL;
>>> @@ -1103,7 +1105,6 @@ static void watchdog_cdev_unregister(struct
>>> watchdog_device *wdd)
>>>
>>>           hrtimer_cancel(&wd_data->timer);
>>>           kthread_cancel_work_sync(&wd_data->work);
>>> -       watchdog_hrtimer_pretimeout_stop(wdd);
>>>
>>>           put_device(&wd_data->dev);
>>>    }
>>>
>>> thanks,
>>
>>
>> --
>> js
>> suse labs
> 
> Does it still make sense to stop the timer on reboot or suspend?
> 
> I haven't had any problems with rebooting but I haven't been able to test
> suspending.
> 
Only if it is really a problem.

Guenter


      reply	other threads:[~2021-09-05 22:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-03 20:11 [PATCH v3] watchdog: Add hrtimer-based pretimeout feature Curtis Klein
2021-02-04  1:35 ` Guenter Roeck
2021-09-02  6:55 ` Jiri Slaby
2021-09-02 14:05   ` Guenter Roeck
2021-09-04  8:16     ` was [Re: [PATCH v3] watchdog: Add hrtimer-based pretimeout feature] Jiri Slaby
     [not found]       ` <54d77fb1-2531-c6ed-738e-9f661443b097@kernel.org>
2021-09-05 22:22         ` Klein, Curtis
2021-09-05 22:56           ` Guenter Roeck [this message]

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=ab0b4ca3-28f4-227b-faf8-984ca1d8fbe5@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=curtis.klein@hpe.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=wim@linux-watchdog.org \
    --subject='Re: was [Re: [PATCH v3] watchdog: Add hrtimer-based pretimeout feature]' \
    /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

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