[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DU2PR01MB8144D4958B14C0D7D19F5EE0F9B69@DU2PR01MB8144.eurprd01.prod.exchangelabs.com>
Date: Tue, 12 Oct 2021 11:45:09 +0000
From: Flavio Suligoi <f.suligoi@...m.it>
To: Guenter Roeck <linux@...ck-us.net>
CC: Wim Van Sebroeck <wim@...ux-watchdog.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
"linux-watchdog@...r.kernel.org" <linux-watchdog@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v4] watchdog: add new parameter to start the watchdog on
module insertion
Hi Guenter,
> -----Original Message-----
> From: Guenter Roeck <groeck7@...il.com> On Behalf Of Guenter Roeck
> Sent: lunedì 11 ottobre 2021 03:26
> To: Flavio Suligoi <f.suligoi@...m.it>
> Cc: Wim Van Sebroeck <wim@...ux-watchdog.org>; Mika Westerberg
> <mika.westerberg@...ux.intel.com>; linux-watchdog@...r.kernel.org; linux-
> kernel@...r.kernel.org
> Subject: Re: [PATCH v4] watchdog: add new parameter to start the watchdog
> on module insertion
>
> On Fri, Sep 24, 2021 at 03:35:09PM +0200, Flavio Suligoi wrote:
> > The new parameter "start_enabled" starts the watchdog at the same time
> > of the module insertion.
...
> > diff --git a/drivers/watchdog/watchdog_core.c
> b/drivers/watchdog/watchdog_core.c
> > index 3fe8a7edc252..d9211fea45d7 100644
> > --- a/drivers/watchdog/watchdog_core.c
> > +++ b/drivers/watchdog/watchdog_core.c
> > @@ -44,6 +44,11 @@ static int stop_on_reboot = -1;
> > module_param(stop_on_reboot, int, 0444);
> > MODULE_PARM_DESC(stop_on_reboot, "Stop watchdogs on reboot (0=keep
> watching, 1=stop)");
> >
> > +static bool start_enabled =
> IS_ENABLED(CONFIG_WATCHDOG_START_ENABLED);
> > +module_param(start_enabled, bool, 0444);
> > +MODULE_PARM_DESC(start_enabled, "Start watchdog on module insertion
> (default="
> > +
> __MODULE_STRING(IS_ENABLED(CONFIG_WATCHDOG_START_ENABL
> ED)) ")");
> > +
> > /*
> > * Deferred Registration infrastructure.
> > *
> > @@ -252,6 +257,15 @@ static int __watchdog_register_device(struct
> watchdog_device *wdd)
> > * corrupted in a later stage then we expect a kernel panic!
> > */
> >
> > + /* If required, start the watchdog immediately */
> > + if (start_enabled && !watchdog_hw_running(wdd)) {
> > + set_bit(WDOG_HW_RUNNING, &wdd->status);
> > + ret = wdd->ops->start(wdd);
> > + if (ret)
> > + return ret;
> > + pr_info("Watchdog enabled\n");
> > + }
> > +
> I am not convinced that this is the best location to start the watchdog.
> Maybe that should be done in watchdog_cdev_register().
Ok, thanks, I'll also explore this way
>
> > /* Use alias for watchdog id if possible */
> > if (wdd->parent) {
> > ret = of_alias_get_id(wdd->parent->of_node, "watchdog");
> > @@ -356,6 +370,9 @@ int watchdog_register_device(struct
> watchdog_device *wdd)
> > mutex_unlock(&wtd_deferred_reg_mutex);
> >
> > if (ret) {
> > + if (start_enabled && watchdog_hw_running(wdd) &&
> > + wdd->ops->stop)
> > + wdd->ops->stop(wdd);
>
> This code stops the watchdog if watchdog registration failed even and
> especially if it was already running when the module was inserted.
> This changes semantics and is thus not aceptable.
Ok, right, I'll found a different solution.
>
> > dev_str = wdd->parent ? dev_name(wdd->parent) :
> > (const char *)wdd->info->identity;
> > pr_err("%s: failed to register watchdog device (err = %d)\n",
Thanks Guenter,
Flavio
Powered by blists - more mailing lists