Linux Watchdog driver development
 help / color / mirror / Atom feed
From: Stefan Eichenberger <eichest@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>
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: Tue, 13 Apr 2021 18:56:15 +0200	[thread overview]
Message-ID: <20210413165615.GA2942421@eichest-laptop> (raw)
In-Reply-To: <41ec7802-e637-1177-9d16-d8fb3ff6bc3a@roeck-us.net>

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.

Regards,
Stefan


  reply	other threads:[~2021-04-13 16:57 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 [this message]
2021-04-14 11:50     ` Guenter Roeck
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=20210413165615.GA2942421@eichest-laptop \
    --to=eichest@gmail.com \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.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