diff options
Diffstat (limited to 'drivers/char/ipmi/ipmi_watchdog.c')
-rw-r--r-- | drivers/char/ipmi/ipmi_watchdog.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c index 34767a6d7f42..7ed356e52035 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c | |||
@@ -153,7 +153,7 @@ | |||
153 | #endif | 153 | #endif |
154 | 154 | ||
155 | static DEFINE_MUTEX(ipmi_watchdog_mutex); | 155 | static DEFINE_MUTEX(ipmi_watchdog_mutex); |
156 | static int nowayout = WATCHDOG_NOWAYOUT; | 156 | static bool nowayout = WATCHDOG_NOWAYOUT; |
157 | 157 | ||
158 | static ipmi_user_t watchdog_user; | 158 | static ipmi_user_t watchdog_user; |
159 | static int watchdog_ifnum; | 159 | static int watchdog_ifnum; |
@@ -320,7 +320,7 @@ module_param(start_now, int, 0444); | |||
320 | MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as" | 320 | MODULE_PARM_DESC(start_now, "Set to 1 to start the watchdog as" |
321 | "soon as the driver is loaded."); | 321 | "soon as the driver is loaded."); |
322 | 322 | ||
323 | module_param(nowayout, int, 0644); | 323 | module_param(nowayout, bool, 0644); |
324 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | 324 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " |
325 | "(default=CONFIG_WATCHDOG_NOWAYOUT)"); | 325 | "(default=CONFIG_WATCHDOG_NOWAYOUT)"); |
326 | 326 | ||
@@ -520,6 +520,7 @@ static void panic_halt_ipmi_heartbeat(void) | |||
520 | msg.cmd = IPMI_WDOG_RESET_TIMER; | 520 | msg.cmd = IPMI_WDOG_RESET_TIMER; |
521 | msg.data = NULL; | 521 | msg.data = NULL; |
522 | msg.data_len = 0; | 522 | msg.data_len = 0; |
523 | atomic_add(2, &panic_done_count); | ||
523 | rv = ipmi_request_supply_msgs(watchdog_user, | 524 | rv = ipmi_request_supply_msgs(watchdog_user, |
524 | (struct ipmi_addr *) &addr, | 525 | (struct ipmi_addr *) &addr, |
525 | 0, | 526 | 0, |
@@ -528,8 +529,8 @@ static void panic_halt_ipmi_heartbeat(void) | |||
528 | &panic_halt_heartbeat_smi_msg, | 529 | &panic_halt_heartbeat_smi_msg, |
529 | &panic_halt_heartbeat_recv_msg, | 530 | &panic_halt_heartbeat_recv_msg, |
530 | 1); | 531 | 1); |
531 | if (!rv) | 532 | if (rv) |
532 | atomic_add(2, &panic_done_count); | 533 | atomic_sub(2, &panic_done_count); |
533 | } | 534 | } |
534 | 535 | ||
535 | static struct ipmi_smi_msg panic_halt_smi_msg = { | 536 | static struct ipmi_smi_msg panic_halt_smi_msg = { |
@@ -553,16 +554,18 @@ static void panic_halt_ipmi_set_timeout(void) | |||
553 | /* Wait for the messages to be free. */ | 554 | /* Wait for the messages to be free. */ |
554 | while (atomic_read(&panic_done_count) != 0) | 555 | while (atomic_read(&panic_done_count) != 0) |
555 | ipmi_poll_interface(watchdog_user); | 556 | ipmi_poll_interface(watchdog_user); |
557 | atomic_add(2, &panic_done_count); | ||
556 | rv = i_ipmi_set_timeout(&panic_halt_smi_msg, | 558 | rv = i_ipmi_set_timeout(&panic_halt_smi_msg, |
557 | &panic_halt_recv_msg, | 559 | &panic_halt_recv_msg, |
558 | &send_heartbeat_now); | 560 | &send_heartbeat_now); |
559 | if (!rv) { | 561 | if (rv) { |
560 | atomic_add(2, &panic_done_count); | 562 | atomic_sub(2, &panic_done_count); |
561 | if (send_heartbeat_now) | ||
562 | panic_halt_ipmi_heartbeat(); | ||
563 | } else | ||
564 | printk(KERN_WARNING PFX | 563 | printk(KERN_WARNING PFX |
565 | "Unable to extend the watchdog timeout."); | 564 | "Unable to extend the watchdog timeout."); |
565 | } else { | ||
566 | if (send_heartbeat_now) | ||
567 | panic_halt_ipmi_heartbeat(); | ||
568 | } | ||
566 | while (atomic_read(&panic_done_count) != 0) | 569 | while (atomic_read(&panic_done_count) != 0) |
567 | ipmi_poll_interface(watchdog_user); | 570 | ipmi_poll_interface(watchdog_user); |
568 | } | 571 | } |
@@ -1164,7 +1167,7 @@ static int wdog_reboot_handler(struct notifier_block *this, | |||
1164 | if (code == SYS_POWER_OFF || code == SYS_HALT) { | 1167 | if (code == SYS_POWER_OFF || code == SYS_HALT) { |
1165 | /* Disable the WDT if we are shutting down. */ | 1168 | /* Disable the WDT if we are shutting down. */ |
1166 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; | 1169 | ipmi_watchdog_state = WDOG_TIMEOUT_NONE; |
1167 | panic_halt_ipmi_set_timeout(); | 1170 | ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); |
1168 | } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { | 1171 | } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { |
1169 | /* Set a long timer to let the reboot happens, but | 1172 | /* Set a long timer to let the reboot happens, but |
1170 | reboot if it hangs, but only if the watchdog | 1173 | reboot if it hangs, but only if the watchdog |
@@ -1172,7 +1175,7 @@ static int wdog_reboot_handler(struct notifier_block *this, | |||
1172 | timeout = 120; | 1175 | timeout = 120; |
1173 | pretimeout = 0; | 1176 | pretimeout = 0; |
1174 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; | 1177 | ipmi_watchdog_state = WDOG_TIMEOUT_RESET; |
1175 | panic_halt_ipmi_set_timeout(); | 1178 | ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); |
1176 | } | 1179 | } |
1177 | } | 1180 | } |
1178 | return NOTIFY_OK; | 1181 | return NOTIFY_OK; |