All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier
@ 2015-11-09  9:55 Alexander Stein
  2015-11-09  9:55 ` [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier Alexander Stein
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Alexander Stein @ 2015-11-09  9:55 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: Alexander Stein, linux-watchdog

This is a preparation before adding a panic notifier.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 drivers/watchdog/gpio_wdt.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index 90d59d3f..c7b8a06 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -36,7 +36,7 @@ struct gpio_wdt_priv {
 	unsigned int		hw_algo;
 	unsigned int		hw_margin;
 	unsigned long		last_jiffies;
-	struct notifier_block	notifier;
+	struct notifier_block	reboot_notifier;
 	struct timer_list	timer;
 	struct watchdog_device	wdd;
 };
@@ -130,7 +130,7 @@ static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code,
 			       void *unused)
 {
 	struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv,
-						  notifier);
+						  reboot_notifier);
 
 	mod_timer(&priv->timer, 0);
 
@@ -228,8 +228,8 @@ static int gpio_wdt_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
-	priv->notifier.notifier_call = gpio_wdt_notify_sys;
-	ret = register_reboot_notifier(&priv->notifier);
+	priv->reboot_notifier.notifier_call = gpio_wdt_notify_sys;
+	ret = register_reboot_notifier(&priv->reboot_notifier);
 	if (ret)
 		goto error_unregister;
 
@@ -248,7 +248,7 @@ static int gpio_wdt_remove(struct platform_device *pdev)
 	struct gpio_wdt_priv *priv = platform_get_drvdata(pdev);
 
 	del_timer_sync(&priv->timer);
-	unregister_reboot_notifier(&priv->notifier);
+	unregister_reboot_notifier(&priv->reboot_notifier);
 	watchdog_unregister_device(&priv->wdd);
 
 	return 0;
-- 
2.4.10


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

* [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-09  9:55 [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Alexander Stein
@ 2015-11-09  9:55 ` Alexander Stein
  2015-11-09 15:19   ` Guenter Roeck
  2015-11-09 15:12 ` [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Guenter Roeck
  2015-11-23  5:33 ` Guenter Roeck
  2 siblings, 1 reply; 12+ messages in thread
From: Alexander Stein @ 2015-11-09  9:55 UTC (permalink / raw)
  To: Wim Van Sebroeck; +Cc: Alexander Stein, linux-watchdog

This notifier is required when the watchdog is configured as always running
because in this case the watchdog will be triggered when the kernel panics
at boot before any application could open the device, e.g. because the
rootfs is broken. This should result in a resetting system. Thus we
register a panic notifier which stops triggering the watchdog.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 drivers/watchdog/gpio_wdt.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
index c7b8a06..aaa0815 100644
--- a/drivers/watchdog/gpio_wdt.c
+++ b/drivers/watchdog/gpio_wdt.c
@@ -37,6 +37,7 @@ struct gpio_wdt_priv {
 	unsigned int		hw_margin;
 	unsigned long		last_jiffies;
 	struct notifier_block	reboot_notifier;
+	struct notifier_block	panic_notifier;
 	struct timer_list	timer;
 	struct watchdog_device	wdd;
 };
@@ -146,6 +147,17 @@ static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code,
 	return NOTIFY_DONE;
 }
 
+static int gpio_wdt_notify_panic(struct notifier_block *nb, unsigned long code,
+			       void *unused)
+{
+	struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv,
+						  panic_notifier);
+
+	gpio_wdt_disable(priv);
+
+	return NOTIFY_DONE;
+}
+
 static const struct watchdog_info gpio_wdt_ident = {
 	.options	= WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING |
 			  WDIOF_SETTIMEOUT,
@@ -233,11 +245,19 @@ static int gpio_wdt_probe(struct platform_device *pdev)
 	if (ret)
 		goto error_unregister;
 
+	priv->panic_notifier.notifier_call = gpio_wdt_notify_panic;
+	ret = atomic_notifier_chain_register(&panic_notifier_list,
+					     &priv->panic_notifier);
+	if (ret)
+		goto error_unregister_notify;
+
 	if (priv->always_running)
 		gpio_wdt_start_impl(priv);
 
 	return 0;
 
+error_unregister_notify:
+	unregister_reboot_notifier(&priv->reboot_notifier);
 error_unregister:
 	watchdog_unregister_device(&priv->wdd);
 	return ret;
-- 
2.4.10


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

* Re: [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier
  2015-11-09  9:55 [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Alexander Stein
  2015-11-09  9:55 ` [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier Alexander Stein
@ 2015-11-09 15:12 ` Guenter Roeck
  2015-11-23  5:33 ` Guenter Roeck
  2 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2015-11-09 15:12 UTC (permalink / raw)
  To: Alexander Stein, Wim Van Sebroeck; +Cc: linux-watchdog

On 11/09/2015 01:55 AM, Alexander Stein wrote:
> This is a preparation before adding a panic notifier.
>
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/watchdog/gpio_wdt.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
> index 90d59d3f..c7b8a06 100644
> --- a/drivers/watchdog/gpio_wdt.c
> +++ b/drivers/watchdog/gpio_wdt.c
> @@ -36,7 +36,7 @@ struct gpio_wdt_priv {
>   	unsigned int		hw_algo;
>   	unsigned int		hw_margin;
>   	unsigned long		last_jiffies;
> -	struct notifier_block	notifier;
> +	struct notifier_block	reboot_notifier;
>   	struct timer_list	timer;
>   	struct watchdog_device	wdd;
>   };
> @@ -130,7 +130,7 @@ static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code,
>   			       void *unused)
>   {
>   	struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv,
> -						  notifier);
> +						  reboot_notifier);
>
>   	mod_timer(&priv->timer, 0);
>
> @@ -228,8 +228,8 @@ static int gpio_wdt_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>
> -	priv->notifier.notifier_call = gpio_wdt_notify_sys;
> -	ret = register_reboot_notifier(&priv->notifier);
> +	priv->reboot_notifier.notifier_call = gpio_wdt_notify_sys;
> +	ret = register_reboot_notifier(&priv->reboot_notifier);
>   	if (ret)
>   		goto error_unregister;
>
> @@ -248,7 +248,7 @@ static int gpio_wdt_remove(struct platform_device *pdev)
>   	struct gpio_wdt_priv *priv = platform_get_drvdata(pdev);
>
>   	del_timer_sync(&priv->timer);
> -	unregister_reboot_notifier(&priv->notifier);
> +	unregister_reboot_notifier(&priv->reboot_notifier);
>   	watchdog_unregister_device(&priv->wdd);
>
>   	return 0;
>


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

* Re: [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-09  9:55 ` [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier Alexander Stein
@ 2015-11-09 15:19   ` Guenter Roeck
  2015-11-09 15:46     ` Alexander Stein
  2015-11-09 19:02     ` Uwe Kleine-König
  0 siblings, 2 replies; 12+ messages in thread
From: Guenter Roeck @ 2015-11-09 15:19 UTC (permalink / raw)
  To: Alexander Stein, Wim Van Sebroeck; +Cc: linux-watchdog, Uwe Kleine-König

On 11/09/2015 01:55 AM, Alexander Stein wrote:
> This notifier is required when the watchdog is configured as always running
> because in this case the watchdog will be triggered when the kernel panics
> at boot before any application could open the device, e.g. because the
> rootfs is broken. This should result in a resetting system. Thus we
> register a panic notifier which stops triggering the watchdog.
>

Shouldn't the timer be stopped instead ?

Copying Uwe for additional input.

Thanks,
Guenter

> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
>   drivers/watchdog/gpio_wdt.c | 20 ++++++++++++++++++++
>   1 file changed, 20 insertions(+)
>
> diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
> index c7b8a06..aaa0815 100644
> --- a/drivers/watchdog/gpio_wdt.c
> +++ b/drivers/watchdog/gpio_wdt.c
> @@ -37,6 +37,7 @@ struct gpio_wdt_priv {
>   	unsigned int		hw_margin;
>   	unsigned long		last_jiffies;
>   	struct notifier_block	reboot_notifier;
> +	struct notifier_block	panic_notifier;
>   	struct timer_list	timer;
>   	struct watchdog_device	wdd;
>   };
> @@ -146,6 +147,17 @@ static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code,
>   	return NOTIFY_DONE;
>   }
>
> +static int gpio_wdt_notify_panic(struct notifier_block *nb, unsigned long code,
> +			       void *unused)
> +{
> +	struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv,
> +						  panic_notifier);
> +
> +	gpio_wdt_disable(priv);
> +
> +	return NOTIFY_DONE;
> +}
> +
>   static const struct watchdog_info gpio_wdt_ident = {
>   	.options	= WDIOF_MAGICCLOSE | WDIOF_KEEPALIVEPING |
>   			  WDIOF_SETTIMEOUT,
> @@ -233,11 +245,19 @@ static int gpio_wdt_probe(struct platform_device *pdev)
>   	if (ret)
>   		goto error_unregister;
>
> +	priv->panic_notifier.notifier_call = gpio_wdt_notify_panic;
> +	ret = atomic_notifier_chain_register(&panic_notifier_list,
> +					     &priv->panic_notifier);
> +	if (ret)
> +		goto error_unregister_notify;
> +
>   	if (priv->always_running)
>   		gpio_wdt_start_impl(priv);
>
>   	return 0;
>
> +error_unregister_notify:
> +	unregister_reboot_notifier(&priv->reboot_notifier);
>   error_unregister:
>   	watchdog_unregister_device(&priv->wdd);
>   	return ret;
>


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

* Re: [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-09 15:19   ` Guenter Roeck
@ 2015-11-09 15:46     ` Alexander Stein
  2015-11-09 19:02     ` Uwe Kleine-König
  1 sibling, 0 replies; 12+ messages in thread
From: Alexander Stein @ 2015-11-09 15:46 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, Uwe Kleine-König

Hello Guenter,

On Monday 09 November 2015 07:19:09, Guenter Roeck wrote:
> On 11/09/2015 01:55 AM, Alexander Stein wrote:
> > This notifier is required when the watchdog is configured as always 
running
> > because in this case the watchdog will be triggered when the kernel panics
> > at boot before any application could open the device, e.g. because the
> > rootfs is broken. This should result in a resetting system. Thus we
> > register a panic notifier which stops triggering the watchdog.
> 
> Shouldn't the timer be stopped instead ?

I think it may be stopped additionally, it would make it alsomore similar to 
gpio_wdt_notify_sys. AFAICS gpio_wdt_disable ensures that a HW_ALGO_LEVEL type 
is set to inactive state otherwise it would stay triggered.

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
alexander.stein@systec-electronic.com

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:    +49 (0) 3765 38600-4100
 
Managing Directors:
	Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
	Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
	Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010

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

* Re: [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-09 15:19   ` Guenter Roeck
  2015-11-09 15:46     ` Alexander Stein
@ 2015-11-09 19:02     ` Uwe Kleine-König
  2015-11-09 23:19       ` Guenter Roeck
  1 sibling, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2015-11-09 19:02 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Alexander Stein, Wim Van Sebroeck, linux-watchdog

Hello,

On Mon, Nov 09, 2015 at 07:19:09AM -0800, Guenter Roeck wrote:
> On 11/09/2015 01:55 AM, Alexander Stein wrote:
> >This notifier is required when the watchdog is configured as always running
> >because in this case the watchdog will be triggered when the kernel panics
> >at boot before any application could open the device, e.g. because the
> >rootfs is broken. This should result in a resetting system. Thus we
> >register a panic notifier which stops triggering the watchdog.
> >
> 
> Shouldn't the timer be stopped instead ?

What do you mean saying "timer"? The hardware? This might or might not
be possible.

I think this depends on policy what you want. There are people that just
want to calm the watchdog such that it doesn't interfere with the
system. For these it might be right to stop the timer. If however the
watchdog is responsible to bring a non-responding system back into
operation it sounds right to stop petting the watchdog and let it reset
the machine. (There are a few things that might complicate the logic,
i.e. with panic=5 on the kernel command line it might make sense to keep
the timer until the 5 seconds after panic are over.)

> >diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
> >index c7b8a06..aaa0815 100644
> >--- a/drivers/watchdog/gpio_wdt.c
> >+++ b/drivers/watchdog/gpio_wdt.c
> >@@ -233,11 +245,19 @@ static int gpio_wdt_probe(struct platform_device *pdev)
> >  	if (ret)
> >  		goto error_unregister;
> >
> >+	priv->panic_notifier.notifier_call = gpio_wdt_notify_panic;
> >+	ret = atomic_notifier_chain_register(&panic_notifier_list,
> >+					     &priv->panic_notifier);
> >+	if (ret)
> >+		goto error_unregister_notify;
> >+
> >  	if (priv->always_running)
> >  		gpio_wdt_start_impl(priv);
> >
> >  	return 0;
> >
> >+error_unregister_notify:
> >+	unregister_reboot_notifier(&priv->reboot_notifier);

The logic is wrong here. If atomic_notifier_chain_register failed you
shouldn't call unregister_reboot_notifier.

Best regards
Uwe

> >  error_unregister:
> >  	watchdog_unregister_device(&priv->wdd);
> >  	return ret;

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-09 19:02     ` Uwe Kleine-König
@ 2015-11-09 23:19       ` Guenter Roeck
  2015-11-10  7:20         ` Uwe Kleine-König
  0 siblings, 1 reply; 12+ messages in thread
From: Guenter Roeck @ 2015-11-09 23:19 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Alexander Stein, Wim Van Sebroeck, linux-watchdog

Hi Uwe,

On 11/09/2015 11:02 AM, Uwe Kleine-König wrote:
> Hello,
>
> On Mon, Nov 09, 2015 at 07:19:09AM -0800, Guenter Roeck wrote:
>> On 11/09/2015 01:55 AM, Alexander Stein wrote:
>>> This notifier is required when the watchdog is configured as always running
>>> because in this case the watchdog will be triggered when the kernel panics
>>> at boot before any application could open the device, e.g. because the
>>> rootfs is broken. This should result in a resetting system. Thus we
>>> register a panic notifier which stops triggering the watchdog.
>>>
>>
>> Shouldn't the timer be stopped instead ?
>
> What do you mean saying "timer"? The hardware? This might or might not
> be possible.
>
I meant the timer referenced with the variable 'timer' in struct gpio_wdt_priv,
and "stop timer' would translate to somoething like 'mod_timer(&priv->timer, 0);'.
Sorry for not being more specific.

> I think this depends on policy what you want. There are people that just
> want to calm the watchdog such that it doesn't interfere with the
> system. For these it might be right to stop the timer. If however the
> watchdog is responsible to bring a non-responding system back into
> operation it sounds right to stop petting the watchdog and let it reset
> the machine. (There are a few things that might complicate the logic,
> i.e. with panic=5 on the kernel command line it might make sense to keep
> the timer until the 5 seconds after panic are over.)
>
For my part I don't really want or suggest anything. I copied you on the patch
since you were involved in improving the driver, and I thought you might have
valuable input.

Having said that, I agree - since this is dealing with a panic, it may well
be that manipulating it may not be possible. So maybe it is best left alone
at this point.

Overall this might be a generic problem, not specifically related to the gpio
watchdog - what should be done with a watchdog if the system panics ?
Should the watchdog be disabled, or should it time out and force-reboot the
system ?

Up to now, the watchdog is left running, and will cause a hard reset after
it times out. This will be the first exception to this rule. As a result,
if the soft reboot caused by the panic() fails to reboot the system, the
system may be left in an unusable state. Is this ok / acceptable ?

>>> diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
>>> index c7b8a06..aaa0815 100644
>>> --- a/drivers/watchdog/gpio_wdt.c
>>> +++ b/drivers/watchdog/gpio_wdt.c
>>> @@ -233,11 +245,19 @@ static int gpio_wdt_probe(struct platform_device *pdev)
>>>   	if (ret)
>>>   		goto error_unregister;
>>>
>>> +	priv->panic_notifier.notifier_call = gpio_wdt_notify_panic;
>>> +	ret = atomic_notifier_chain_register(&panic_notifier_list,
>>> +					     &priv->panic_notifier);
>>> +	if (ret)
>>> +		goto error_unregister_notify;
>>> +
>>>   	if (priv->always_running)
>>>   		gpio_wdt_start_impl(priv);
>>>
>>>   	return 0;
>>>
>>> +error_unregister_notify:
>>> +	unregister_reboot_notifier(&priv->reboot_notifier);
>
> The logic is wrong here. If atomic_notifier_chain_register failed you
> shouldn't call unregister_reboot_notifier.
>

I tend to agree - all but to calls to register a panic notifier don't
check the return value from atomic_notifier_chain_register().

Thanks,
Guenter


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

* Re: [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-09 23:19       ` Guenter Roeck
@ 2015-11-10  7:20         ` Uwe Kleine-König
  2015-11-13 18:44           ` Guenter Roeck
  0 siblings, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2015-11-10  7:20 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Alexander Stein, Wim Van Sebroeck, linux-watchdog

Hello Guenter,

On Mon, Nov 09, 2015 at 03:19:48PM -0800, Guenter Roeck wrote:
> On 11/09/2015 11:02 AM, Uwe Kleine-König wrote:
> >On Mon, Nov 09, 2015 at 07:19:09AM -0800, Guenter Roeck wrote:
> >>On 11/09/2015 01:55 AM, Alexander Stein wrote:
> >>>This notifier is required when the watchdog is configured as always running
> >>>because in this case the watchdog will be triggered when the kernel panics
> >>>at boot before any application could open the device, e.g. because the
> >>>rootfs is broken. This should result in a resetting system. Thus we
> >>>register a panic notifier which stops triggering the watchdog.
> >>>
> >>
> >>Shouldn't the timer be stopped instead ?
> >
> >What do you mean saying "timer"? The hardware? This might or might not
> >be possible.
> >
> I meant the timer referenced with the variable 'timer' in struct
> gpio_wdt_priv, and "stop timer' would translate to somoething like
> 'mod_timer(&priv->timer, 0);'.
> Sorry for not being more specific.

My feeling is that improving the gpio-wdt driver is the wrong way. I
admit I lost track of the patch series that moves that handling into the
watchdog core, what is the status here? There thinking more accurately
which handlers to register and how to react to certain events makes
more sense.

Adding code now to gpio-wdt that later needs migration to the core stuff
might be more annoying than to do it right in the core now.

> >>>diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
> >>>index c7b8a06..aaa0815 100644
> >>>--- a/drivers/watchdog/gpio_wdt.c
> >>>+++ b/drivers/watchdog/gpio_wdt.c
> >>>@@ -233,11 +245,19 @@ static int gpio_wdt_probe(struct platform_device *pdev)
> >>>  	if (ret)
> >>>  		goto error_unregister;
> >>>
> >>>+	priv->panic_notifier.notifier_call = gpio_wdt_notify_panic;
> >>>+	ret = atomic_notifier_chain_register(&panic_notifier_list,
> >>>+					     &priv->panic_notifier);
> >>>+	if (ret)
> >>>+		goto error_unregister_notify;
> >>>+
> >>>  	if (priv->always_running)
> >>>  		gpio_wdt_start_impl(priv);
> >>>
> >>>  	return 0;
> >>>
> >>>+error_unregister_notify:
> >>>+	unregister_reboot_notifier(&priv->reboot_notifier);
> >
> >The logic is wrong here. If atomic_notifier_chain_register failed you
> >shouldn't call unregister_reboot_notifier.

I meant the wrong thing here, I thought the call to
atomic_notifier_chain_register is undone when it fails, but the patch
presented by Alexander is right. 

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier
  2015-11-10  7:20         ` Uwe Kleine-König
@ 2015-11-13 18:44           ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2015-11-13 18:44 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Alexander Stein, Wim Van Sebroeck, linux-watchdog

On 11/09/2015 11:20 PM, Uwe Kleine-König wrote:
> Hello Guenter,
>
> On Mon, Nov 09, 2015 at 03:19:48PM -0800, Guenter Roeck wrote:
>> On 11/09/2015 11:02 AM, Uwe Kleine-König wrote:
>>> On Mon, Nov 09, 2015 at 07:19:09AM -0800, Guenter Roeck wrote:
>>>> On 11/09/2015 01:55 AM, Alexander Stein wrote:
>>>>> This notifier is required when the watchdog is configured as always running
>>>>> because in this case the watchdog will be triggered when the kernel panics
>>>>> at boot before any application could open the device, e.g. because the
>>>>> rootfs is broken. This should result in a resetting system. Thus we
>>>>> register a panic notifier which stops triggering the watchdog.
>>>>>
>>>>
>>>> Shouldn't the timer be stopped instead ?
>>>
>>> What do you mean saying "timer"? The hardware? This might or might not
>>> be possible.
>>>
>> I meant the timer referenced with the variable 'timer' in struct
>> gpio_wdt_priv, and "stop timer' would translate to somoething like
>> 'mod_timer(&priv->timer, 0);'.
>> Sorry for not being more specific.
>
> My feeling is that improving the gpio-wdt driver is the wrong way. I
> admit I lost track of the patch series that moves that handling into the
> watchdog core, what is the status here? There thinking more accurately

I got no further review comments, so it is stalled.

I think I may resubmit after -rc1 is out and then just ask Wim to accept
the series. I think it is in good enough shape that we can fix any left-over
problems (if any) separately.

Guenter


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

* Re: [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier
  2015-11-09  9:55 [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Alexander Stein
  2015-11-09  9:55 ` [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier Alexander Stein
  2015-11-09 15:12 ` [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Guenter Roeck
@ 2015-11-23  5:33 ` Guenter Roeck
  2015-11-23 13:29   ` Alexander Stein
  2 siblings, 1 reply; 12+ messages in thread
From: Guenter Roeck @ 2015-11-23  5:33 UTC (permalink / raw)
  To: Alexander Stein, Wim Van Sebroeck; +Cc: linux-watchdog

On 11/09/2015 01:55 AM, Alexander Stein wrote:
> This is a preparation before adding a panic notifier.
>
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>

Fyi, we are going to have an infrastructure change which will make this patch unnecessary.

See http://patchwork.roeck-us.net/patch/451/ and http://patchwork.roeck-us.net/patch/452/
for details.

Thanks,
Guenter

> ---
>   drivers/watchdog/gpio_wdt.c | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/watchdog/gpio_wdt.c b/drivers/watchdog/gpio_wdt.c
> index 90d59d3f..c7b8a06 100644
> --- a/drivers/watchdog/gpio_wdt.c
> +++ b/drivers/watchdog/gpio_wdt.c
> @@ -36,7 +36,7 @@ struct gpio_wdt_priv {
>   	unsigned int		hw_algo;
>   	unsigned int		hw_margin;
>   	unsigned long		last_jiffies;
> -	struct notifier_block	notifier;
> +	struct notifier_block	reboot_notifier;
>   	struct timer_list	timer;
>   	struct watchdog_device	wdd;
>   };
> @@ -130,7 +130,7 @@ static int gpio_wdt_notify_sys(struct notifier_block *nb, unsigned long code,
>   			       void *unused)
>   {
>   	struct gpio_wdt_priv *priv = container_of(nb, struct gpio_wdt_priv,
> -						  notifier);
> +						  reboot_notifier);
>
>   	mod_timer(&priv->timer, 0);
>
> @@ -228,8 +228,8 @@ static int gpio_wdt_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>
> -	priv->notifier.notifier_call = gpio_wdt_notify_sys;
> -	ret = register_reboot_notifier(&priv->notifier);
> +	priv->reboot_notifier.notifier_call = gpio_wdt_notify_sys;
> +	ret = register_reboot_notifier(&priv->reboot_notifier);
>   	if (ret)
>   		goto error_unregister;
>
> @@ -248,7 +248,7 @@ static int gpio_wdt_remove(struct platform_device *pdev)
>   	struct gpio_wdt_priv *priv = platform_get_drvdata(pdev);
>
>   	del_timer_sync(&priv->timer);
> -	unregister_reboot_notifier(&priv->notifier);
> +	unregister_reboot_notifier(&priv->reboot_notifier);
>   	watchdog_unregister_device(&priv->wdd);
>
>   	return 0;
>


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

* Re: [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier
  2015-11-23  5:33 ` Guenter Roeck
@ 2015-11-23 13:29   ` Alexander Stein
  2015-11-23 16:02     ` Guenter Roeck
  0 siblings, 1 reply; 12+ messages in thread
From: Alexander Stein @ 2015-11-23 13:29 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog

On Sunday 22 November 2015 21:33:16, Guenter Roeck wrote:
> On 11/09/2015 01:55 AM, Alexander Stein wrote:
> > This is a preparation before adding a panic notifier.
> >
> > Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> 
> Fyi, we are going to have an infrastructure change which will make this patch unnecessary.
> 
> See http://patchwork.roeck-us.net/patch/451/ and http://patchwork.roeck-us.net/patch/452/
> for details.

Both links are not working for me. Give me a 404 error.

Best regards,
Alexander
-- 
Dipl.-Inf. Alexander Stein
SYS TEC electronic GmbH
alexander.stein@systec-electronic.com

Legal and Commercial Address:
Am Windrad 2
08468 Heinsdorfergrund
Germany

Office: +49 (0) 3765 38600-0
Fax:    +49 (0) 3765 38600-4100
 
Managing Directors:
	Director Technology/CEO: Dipl.-Phys. Siegmar Schmidt;
	Director Commercial Affairs/COO: Dipl. Ing. (FH) Armin von Collrepp
Commercial Registry:
	Amtsgericht Chemnitz, HRB 28082; USt.-Id Nr. DE150534010


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

* Re: [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier
  2015-11-23 13:29   ` Alexander Stein
@ 2015-11-23 16:02     ` Guenter Roeck
  0 siblings, 0 replies; 12+ messages in thread
From: Guenter Roeck @ 2015-11-23 16:02 UTC (permalink / raw)
  To: Alexander Stein; +Cc: Wim Van Sebroeck, linux-watchdog

On 11/23/2015 05:29 AM, Alexander Stein wrote:
> On Sunday 22 November 2015 21:33:16, Guenter Roeck wrote:
>> On 11/09/2015 01:55 AM, Alexander Stein wrote:
>>> This is a preparation before adding a panic notifier.
>>>
>>> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
>>
>> Fyi, we are going to have an infrastructure change which will make this patch unnecessary.
>>
>> See http://patchwork.roeck-us.net/patch/451/ and http://patchwork.roeck-us.net/patch/452/
>> for details.
>
> Both links are not working for me. Give me a 404 error.
>

Hmm - interesting. Try

https://www.mail-archive.com/linux-watchdog@vger.kernel.org/msg02136.html
https://www.mail-archive.com/linux-watchdog@vger.kernel.org/msg02139.html

Guenter


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

end of thread, other threads:[~2015-11-23 16:02 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09  9:55 [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Alexander Stein
2015-11-09  9:55 ` [PATCH 2/2] watchdog: gpio-wdt: Add panic notifier Alexander Stein
2015-11-09 15:19   ` Guenter Roeck
2015-11-09 15:46     ` Alexander Stein
2015-11-09 19:02     ` Uwe Kleine-König
2015-11-09 23:19       ` Guenter Roeck
2015-11-10  7:20         ` Uwe Kleine-König
2015-11-13 18:44           ` Guenter Roeck
2015-11-09 15:12 ` [PATCH 1/2] watchdog: gpio-wdt: Rename notifier to reboot_notifier Guenter Roeck
2015-11-23  5:33 ` Guenter Roeck
2015-11-23 13:29   ` Alexander Stein
2015-11-23 16:02     ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.