linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipmi/watchdog: fix watchdog timeout set on reboot
@ 2017-05-05 19:07 Valentin Vidic
  2017-05-05 19:41 ` Corey Minyard
  0 siblings, 1 reply; 2+ messages in thread
From: Valentin Vidic @ 2017-05-05 19:07 UTC (permalink / raw)
  To: Corey Minyard, openipmi-developer, linux-kernel; +Cc: Valentin Vidic

systemd by default starts watchdog on reboot and sets the timer to
ShutdownWatchdogSec=10min.  Reboot handler in ipmi_watchdog than reduces
the timer to 120s which is not enough time to boot a Xen machine with
a lot of RAM.  As a result the machine is rebooted the second time
during the long run of (XEN) Scrubbing Free RAM.....

Fix this by setting the timer to 120s only if it was previously
set to a low value.

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
---
 drivers/char/ipmi/ipmi_watchdog.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index d165af8abe36..4161d9961a24 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -1163,10 +1163,11 @@ static int wdog_reboot_handler(struct notifier_block *this,
 			ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
 			ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
 		} else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
-			/* Set a long timer to let the reboot happens, but
-			   reboot if it hangs, but only if the watchdog
+			/* Set a long timer to let the reboot happen or
+			   reset if it hangs, but only if the watchdog
 			   timer was already running. */
-			timeout = 120;
+			if (timeout < 120)
+				timeout = 120;
 			pretimeout = 0;
 			ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
 			ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
-- 
2.11.0

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

* Re: [PATCH] ipmi/watchdog: fix watchdog timeout set on reboot
  2017-05-05 19:07 [PATCH] ipmi/watchdog: fix watchdog timeout set on reboot Valentin Vidic
@ 2017-05-05 19:41 ` Corey Minyard
  0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2017-05-05 19:41 UTC (permalink / raw)
  To: Valentin Vidic, openipmi-developer, linux-kernel

On 05/05/2017 02:07 PM, Valentin Vidic wrote:
> systemd by default starts watchdog on reboot and sets the timer to
> ShutdownWatchdogSec=10min.  Reboot handler in ipmi_watchdog than reduces
> the timer to 120s which is not enough time to boot a Xen machine with
> a lot of RAM.  As a result the machine is rebooted the second time
> during the long run of (XEN) Scrubbing Free RAM.....
>
> Fix this by setting the timer to 120s only if it was previously
> set to a low value.

Yeah, you are probably right.  In queue for 4.13.

-corey

> Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
> ---
>   drivers/char/ipmi/ipmi_watchdog.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
> index d165af8abe36..4161d9961a24 100644
> --- a/drivers/char/ipmi/ipmi_watchdog.c
> +++ b/drivers/char/ipmi/ipmi_watchdog.c
> @@ -1163,10 +1163,11 @@ static int wdog_reboot_handler(struct notifier_block *this,
>   			ipmi_watchdog_state = WDOG_TIMEOUT_NONE;
>   			ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
>   		} else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) {
> -			/* Set a long timer to let the reboot happens, but
> -			   reboot if it hangs, but only if the watchdog
> +			/* Set a long timer to let the reboot happen or
> +			   reset if it hangs, but only if the watchdog
>   			   timer was already running. */
> -			timeout = 120;
> +			if (timeout < 120)
> +				timeout = 120;
>   			pretimeout = 0;
>   			ipmi_watchdog_state = WDOG_TIMEOUT_RESET;
>   			ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);

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

end of thread, other threads:[~2017-05-05 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 19:07 [PATCH] ipmi/watchdog: fix watchdog timeout set on reboot Valentin Vidic
2017-05-05 19:41 ` Corey Minyard

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