aboutsummaryrefslogtreecommitdiff
path: root/libflash
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2018-03-23 10:56:52 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-03-27 14:51:38 +1100
commit8c0224322650b69b5560828119feeb06fb487de6 (patch)
treeb21442409247666048d97299c2b167b56bbf1164 /libflash
parent70166b34238ebab4eb32ddac28b1b597fae0f1b9 (diff)
downloadskiboot-8c0224322650b69b5560828119feeb06fb487de6.zip
skiboot-8c0224322650b69b5560828119feeb06fb487de6.tar.gz
skiboot-8c0224322650b69b5560828119feeb06fb487de6.tar.bz2
mbox: Reduce default BMC timeouts
Rebooting a BMC can take 70 seconds. Skiboot cannot possibly spin for 70 seconds waiting for a BMC to come back. This also makes the current default of 30 seconds a bit pointless, is it far too short to be a worse case wait time but too long to avoid hitting hardlockup detectors and wrecking havoc inside host linux. Just change it to three seconds so that host linux will survive and that, reads and writes will fail but at least the host stays up. Also refactored the waiting loop just a bit so that it's easier to read. Reported-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Tested-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash')
-rw-r--r--libflash/mbox-flash.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index 7bff34c..dd1f11c 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -42,7 +42,7 @@
/* Same technique as BUILD_BUG_ON from linux */
#define CHECK_HANDLER_SIZE(handlers) ((void)sizeof(char[1 - 2*!!(ARRAY_SIZE(handlers) != (MBOX_COMMAND_COUNT + 1))]))
-#define MBOX_DEFAULT_TIMEOUT 30
+#define MBOX_DEFAULT_TIMEOUT 3 /* seconds */
#define MSG_CREATE(init_command) { .command = init_command }
@@ -334,15 +334,14 @@ static int wait_for_bmc(struct mbox_flash_data *mbox_flash, unsigned int timeout
{
unsigned long last = 1, start = tb_to_secs(mftb());
prlog(PR_TRACE, "Waiting for BMC\n");
- while (mbox_flash->busy && timeout_sec) {
+ while (mbox_flash->busy && timeout_sec > last) {
long now = tb_to_secs(mftb());
if (now - start > last) {
- timeout_sec--;
- last = now - start;
if (last < timeout_sec / 2)
prlog(PR_TRACE, "Been waiting for the BMC for %lu secs\n", last);
else
prlog(PR_ERR, "BMC NOT RESPONDING %lu second wait\n", last);
+ last++;
}
/*
* Both functions are important.