linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Watchdog start during boot
@ 2014-09-09 10:29 Lisovy Rostislav
  2014-09-09 10:45 ` Janusz Użycki
  2014-09-09 11:00 ` Markus Pargmann
  0 siblings, 2 replies; 4+ messages in thread
From: Lisovy Rostislav @ 2014-09-09 10:29 UTC (permalink / raw)
  To: linux-watchdog, linux-kernel, devicetree; +Cc: Michal Vokac

Hello;
If my understanding is correct, the purpose of the "watchdog subsystem"
is to provide an unified interface from user-space to watchdog devices
(via /dev). The issue I am trying to solve is how to start the watchdog
during boot (it would be sufficient just not to disable it since the
bootloader enables it) to be controlled later on with the user-space
tool -- i.e. when the user-space will not boot properly, I would like
the device to be rebooted.

My "quick and dirty" device-specific solution is:

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 3691b15..1e44b03f 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -53,6 +53,10 @@ static unsigned timer_margin;
 module_param(timer_margin, uint, 0);
 MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
 
+static bool start_on_boot = false;
+module_param(start_on_boot, bool, 0);
+MODULE_PARM_DESC(start_on_boot, "Start the watchdog during boot");
+
 struct omap_wdt_dev {
        void __iomem    *base;          /* physical */
        struct device   *dev;
@@ -269,6 +273,9 @@ static int omap_wdt_probe(struct platform_device *pdev)
 
        pm_runtime_put_sync(wdev->dev);
 
+       if (start_on_boot)
+               omap_wdt_start(omap_wdt);
+
        return 0;
 }

however I think it would be much beneficial to do this in a generic way.
Maybe to create a device tree property, that would store some flag to
start the watchdog during boot?

Your opinion is appreciated.
 
Best regards;
Rostislav Lisovy



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Watchdog start during boot
  2014-09-09 10:29 Watchdog start during boot Lisovy Rostislav
@ 2014-09-09 10:45 ` Janusz Użycki
  2014-09-09 11:00 ` Markus Pargmann
  1 sibling, 0 replies; 4+ messages in thread
From: Janusz Użycki @ 2014-09-09 10:45 UTC (permalink / raw)
  To: Lisovy Rostislav, linux-watchdog, linux-kernel, devicetree; +Cc: Michal Vokac

Hello.

Please join to the watchdog_dev thread: 
http://www.spinics.net/lists/linux-watchdog/msg05004.html.

best regards
Janusz

W dniu 2014-09-09 12:29, Lisovy Rostislav pisze:
> Hello;
> If my understanding is correct, the purpose of the "watchdog subsystem"
> is to provide an unified interface from user-space to watchdog devices
> (via /dev). The issue I am trying to solve is how to start the watchdog
> during boot (it would be sufficient just not to disable it since the
> bootloader enables it) to be controlled later on with the user-space
> tool -- i.e. when the user-space will not boot properly, I would like
> the device to be rebooted.
>
> My "quick and dirty" device-specific solution is:
>
> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
> index 3691b15..1e44b03f 100644
> --- a/drivers/watchdog/omap_wdt.c
> +++ b/drivers/watchdog/omap_wdt.c
> @@ -53,6 +53,10 @@ static unsigned timer_margin;
>   module_param(timer_margin, uint, 0);
>   MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
>   
> +static bool start_on_boot = false;
> +module_param(start_on_boot, bool, 0);
> +MODULE_PARM_DESC(start_on_boot, "Start the watchdog during boot");
> +
>   struct omap_wdt_dev {
>          void __iomem    *base;          /* physical */
>          struct device   *dev;
> @@ -269,6 +273,9 @@ static int omap_wdt_probe(struct platform_device *pdev)
>   
>          pm_runtime_put_sync(wdev->dev);
>   
> +       if (start_on_boot)
> +               omap_wdt_start(omap_wdt);
> +
>          return 0;
>   }
>
> however I think it would be much beneficial to do this in a generic way.
> Maybe to create a device tree property, that would store some flag to
> start the watchdog during boot?
>
> Your opinion is appreciated.
>   
> Best regards;
> Rostislav Lisovy
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Watchdog start during boot
  2014-09-09 10:29 Watchdog start during boot Lisovy Rostislav
  2014-09-09 10:45 ` Janusz Użycki
@ 2014-09-09 11:00 ` Markus Pargmann
  2014-09-09 11:48   ` Janusz Użycki
  1 sibling, 1 reply; 4+ messages in thread
From: Markus Pargmann @ 2014-09-09 11:00 UTC (permalink / raw)
  To: Lisovy Rostislav; +Cc: linux-watchdog, linux-kernel, devicetree, Michal Vokac

[-- Attachment #1: Type: text/plain, Size: 2436 bytes --]

Hi,

On Tue, Sep 09, 2014 at 12:29:29PM +0200, Lisovy Rostislav wrote:
> Hello;
> If my understanding is correct, the purpose of the "watchdog subsystem"
> is to provide an unified interface from user-space to watchdog devices
> (via /dev). The issue I am trying to solve is how to start the watchdog
> during boot (it would be sufficient just not to disable it since the
> bootloader enables it) to be controlled later on with the user-space
> tool -- i.e. when the user-space will not boot properly, I would like
> the device to be rebooted.
> 
> My "quick and dirty" device-specific solution is:
> 
> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
> index 3691b15..1e44b03f 100644
> --- a/drivers/watchdog/omap_wdt.c
> +++ b/drivers/watchdog/omap_wdt.c
> @@ -53,6 +53,10 @@ static unsigned timer_margin;
>  module_param(timer_margin, uint, 0);
>  MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
>  
> +static bool start_on_boot = false;
> +module_param(start_on_boot, bool, 0);
> +MODULE_PARM_DESC(start_on_boot, "Start the watchdog during boot");
> +
>  struct omap_wdt_dev {
>         void __iomem    *base;          /* physical */
>         struct device   *dev;
> @@ -269,6 +273,9 @@ static int omap_wdt_probe(struct platform_device *pdev)
>  
>         pm_runtime_put_sync(wdev->dev);
>  
> +       if (start_on_boot)
> +               omap_wdt_start(omap_wdt);
> +
>         return 0;
>  }
> 
> however I think it would be much beneficial to do this in a generic way.
> Maybe to create a device tree property, that would store some flag to
> start the watchdog during boot?

The devicetree should be a hardware description, so it may not be the
right way to pass such information.

Some time ago I proposed something similar where the first watchdog
driver that is registered can be activated by a kernel commandline
parameter. Here is some discussion about the topic:
	Mail-id 1393604183-8755-1-git-send-email-mpa@pengutronix.de
	http://www.spinics.net/lists/linux-watchdog/msg04055.html

Best regards,

Markus

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Watchdog start during boot
  2014-09-09 11:00 ` Markus Pargmann
@ 2014-09-09 11:48   ` Janusz Użycki
  0 siblings, 0 replies; 4+ messages in thread
From: Janusz Użycki @ 2014-09-09 11:48 UTC (permalink / raw)
  To: Markus Pargmann, Lisovy Rostislav, Guenter Roeck
  Cc: linux-watchdog, linux-kernel, devicetree, Michal Vokac, Wim Van Sebroeck

Hi.

http://www.spinics.net/lists/linux-watchdog/msg04055.html
The patch is little similar to mine.

I see the proposal http://www.spinics.net/lists/linux-watchdog/msg05004.html
need our common forward evaluation. We all have similar needs.

I propose to add to my initial patch rootfs's warm-up time
or similar name of parameter.
If this time is not zero after the time timer stops pinging.
The param is time when userland is ready to maintain
a watchdog alone if it supports wachdog at all.
Some userlands open /dev/watchdog only in critical moments
and after they use magic close. Therefore my patch continue
watchdog's pinging in kernel space.

Information that watchdog is not stopable could be added to DT.
However it seems to direct depends on the watchdog, ie. its driver
or if bootloader enabled/disabled the watchdog.

As Guenter Roeck wrote
watchdog_dev could be extended to support not only
always active watchdogs but also longer timeout values
to not implement it in each watchdog driver separately like now.

Also suspend could be unified in my opinion by some helper functions.

best regards
Janusz

W dniu 2014-09-09 13:00, Markus Pargmann pisze:
> Hi,
>
> On Tue, Sep 09, 2014 at 12:29:29PM +0200, Lisovy Rostislav wrote:
>> Hello;
>> If my understanding is correct, the purpose of the "watchdog subsystem"
>> is to provide an unified interface from user-space to watchdog devices
>> (via /dev). The issue I am trying to solve is how to start the watchdog
>> during boot (it would be sufficient just not to disable it since the
>> bootloader enables it) to be controlled later on with the user-space
>> tool -- i.e. when the user-space will not boot properly, I would like
>> the device to be rebooted.
>>
>> My "quick and dirty" device-specific solution is:
>>
>> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
>> index 3691b15..1e44b03f 100644
>> --- a/drivers/watchdog/omap_wdt.c
>> +++ b/drivers/watchdog/omap_wdt.c
>> @@ -53,6 +53,10 @@ static unsigned timer_margin;
>>   module_param(timer_margin, uint, 0);
>>   MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
>>   
>> +static bool start_on_boot = false;
>> +module_param(start_on_boot, bool, 0);
>> +MODULE_PARM_DESC(start_on_boot, "Start the watchdog during boot");
>> +
>>   struct omap_wdt_dev {
>>          void __iomem    *base;          /* physical */
>>          struct device   *dev;
>> @@ -269,6 +273,9 @@ static int omap_wdt_probe(struct platform_device *pdev)
>>   
>>          pm_runtime_put_sync(wdev->dev);
>>   
>> +       if (start_on_boot)
>> +               omap_wdt_start(omap_wdt);
>> +
>>          return 0;
>>   }
>>
>> however I think it would be much beneficial to do this in a generic way.
>> Maybe to create a device tree property, that would store some flag to
>> start the watchdog during boot?
> The devicetree should be a hardware description, so it may not be the
> right way to pass such information.
>
> Some time ago I proposed something similar where the first watchdog
> driver that is registered can be activated by a kernel commandline
> parameter. Here is some discussion about the topic:
> 	Mail-id 1393604183-8755-1-git-send-email-mpa@pengutronix.de
> 	http://www.spinics.net/lists/linux-watchdog/msg04055.html
>
> Best regards,
>
> Markus
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-09 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 10:29 Watchdog start during boot Lisovy Rostislav
2014-09-09 10:45 ` Janusz Użycki
2014-09-09 11:00 ` Markus Pargmann
2014-09-09 11:48   ` Janusz Użycki

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