Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Stefan Eichenberger <eichest@gmail.com>
Cc: linux-watchdog@vger.kernel.org,
	Wim Van Sebroeck <wim@linux-watchdog.org>
Subject: Re: [RFC] watchdog: pretimeout: add a notifier call chain governor
Date: Wed, 14 Apr 2021 04:50:38 -0700	[thread overview]
Message-ID: <6000fb30-6feb-cf4a-a379-8ee5b3acb0de@roeck-us.net> (raw)
In-Reply-To: <20210413165615.GA2942421@eichest-laptop>

On 4/13/21 9:56 AM, Stefan Eichenberger wrote:
> Hi Guenter,
> 
> Thanks a lot for the fast feedback!
> 
> On Tue, Apr 13, 2021 at 09:15:35AM -0700, Guenter Roeck wrote:
>> On 4/13/21 8:45 AM, Stefan Eichenberger wrote:
>>> Add a governor which calls a notifier call chain. This allows the
>>> registration of custom functions to the watchdog pretimeout. This is
>>> useful when writing out-of-tree kernel modules and it is more similar to
>>> the register_reboot_notifier or register_oom_notifier API.
>>>
>>> Signed-off-by: Stefan Eichenberger <eichest@gmail.com>
>>
>> It seems questionable to implement such a notification as governor.
>> A governor is configurable, and letting userspace override notifications
>> seems very odd and unusual. Please provide a use case.
> 
> What I would like to do is to have an out-of-tree module which will
> write a pattern into a reserved memory region when a watchdog occurs.
> After a reboot the module then read this reserved memory region and can
> differentiate between different reset reasons. Here the example kernel
> module:
> https://github.com/embear-engineering/sample-kernel-modules/blob/use-watchdog-register/reset-reason/reset-reason.c
> 
> Registering to the watchdog happens on line 180.
> 
> I think I could just implement a governor in the module but it is not
> really flexible because then I would have to compile the kernel with
> e.g. the noop governor and then switch to my governor after the module
> loaded. Then I thought why not using a notifier chain similar to reboot,
> panic, or oom.
> 

I have two problems with this: First, we do not support in-kernel code purely
for out-of-tree drivers. Second, the idea of using a configurable notifier
(ie one that can be disabled by userspace action) seems odd. If anything,
that would have to be an unconditional notifier. However, again, that would
require a use case in the upstream kernel.

Guenter

  reply	other threads:[~2021-04-14 11:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 15:45 [RFC] watchdog: pretimeout: add a notifier call chain governor Stefan Eichenberger
2021-04-13 16:15 ` Guenter Roeck
2021-04-13 16:56   ` Stefan Eichenberger
2021-04-14 11:50     ` Guenter Roeck [this message]
2021-04-14 12:42       ` Stefan Eichenberger

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=6000fb30-6feb-cf4a-a379-8ee5b3acb0de@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=eichest@gmail.com \
    --cc=linux-watchdog@vger.kernel.org \
    --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