diff mbox series

[6/9] ipmi-watchdog: The stop action should disable reset

Message ID 20180524001335.15457-7-wak@google.com
State Accepted
Headers show
Series ipmi-watchdog: Fixes for error handling and general cleanups | expand

Commit Message

William Kennington May 24, 2018, 12:13 a.m. UTC
Otherwise it is possible for the reset timer to elapse and trigger the
watchdog to wake back up. This doesn't affect the behavior of the
system since we are providing a NONE action to the BMC. However we would
like to avoid the action from taking place if possible.

Signed-off-by: William A. Kennington III <wak@google.com>
---
 hw/ipmi/ipmi-watchdog.c | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/hw/ipmi/ipmi-watchdog.c b/hw/ipmi/ipmi-watchdog.c
index fc559c6da..6f2ac4abf 100644
--- a/hw/ipmi/ipmi-watchdog.c
+++ b/hw/ipmi/ipmi-watchdog.c
@@ -115,6 +115,15 @@  static void reset_wdt(struct timer *t __unused, void *data __unused,
 void ipmi_wdt_stop(void)
 {
 	if (!wdt_stopped) {
+		/* Make sure the background reset timer is disabled before
+		 * stopping the watchdog. If we issue a reset after disabling
+		 * the timer, it will be re-enabled. */
+		wdt_ticking = false;
+		cancel_timer(&wdt_timer);
+
+		/* Configure the watchdog to be disabled and do no action
+		 * in case the underlying implementation is buggy and times
+		 * out anyway. */
 		wdt_stopped = true;
 		set_wdt(WDT_NO_ACTION, 100, 0, false);
 	}