diff mbox series

libflash/mbox-flash: only wait for MBOX_DEFAULT_POLL_MS if busy

Message ID 20171218053126.15308-1-stewart@linux.vnet.ibm.com
State Accepted
Headers show
Series libflash/mbox-flash: only wait for MBOX_DEFAULT_POLL_MS if busy | expand

Commit Message

Stewart Smith Dec. 18, 2017, 5:31 a.m. UTC
This makes the mbox unit test run 300x quicker and seems to
shave about 6 seconds from boot time on Witherspoon.

Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
---
 libflash/mbox-flash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Stewart Smith Dec. 19, 2017, 12:24 a.m. UTC | #1
Stewart Smith <stewart@linux.vnet.ibm.com> writes:
> This makes the mbox unit test run 300x quicker and seems to
> shave about 6 seconds from boot time on Witherspoon.
>
> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
> ---
>  libflash/mbox-flash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

even though we need to fix this to not call check_timers() directly,
I've merged this for the time being, as it means the mbox tests can go
in without driving me insane.

Merged to master as of b7b7b84ef565380a22dd636cd22d0622e360c440
diff mbox series

Patch

diff --git a/libflash/mbox-flash.c b/libflash/mbox-flash.c
index e15fecf033fb..d33a52c0ebf0 100644
--- a/libflash/mbox-flash.c
+++ b/libflash/mbox-flash.c
@@ -348,8 +348,9 @@  static int wait_for_bmc(struct mbox_flash_data *mbox_flash, unsigned int timeout
 		 * Both functions are important.
 		 * Well time_wait_ms() relaxes the spin... so... its nice
 		 */
-		time_wait_ms(MBOX_DEFAULT_POLL_MS);
 		check_timers(false);
+		if (mbox_flash->busy)
+			time_wait_ms(MBOX_DEFAULT_POLL_MS);
 		asm volatile ("" ::: "memory");
 	}