diff mbox

wait_for_resource_loaded: don't needlessly sleep for 5ms

Message ID 1479861959-22355-1-git-send-email-stewart@linux.vnet.ibm.com
State Accepted
Headers show

Commit Message

Stewart Smith Nov. 23, 2016, 12:45 a.m. UTC
We would needlessly time_wait_ms_nopoll(5) if opal_run_pollers()
managed to crank things enough to load the requested resource.

Instead of needlessly sleeping, check the result of resource_loaded()
*before* going to sleep for a bit.

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

Comments

Stewart Smith Nov. 24, 2016, 6:11 a.m. UTC | #1
Stewart Smith <stewart@linux.vnet.ibm.com> writes:

> We would needlessly time_wait_ms_nopoll(5) if opal_run_pollers()
> managed to crank things enough to load the requested resource.
>
> Instead of needlessly sleeping, check the result of resource_loaded()
> *before* going to sleep for a bit.
>
> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>

Merged to master as of 2981a7bfc9dc3b1b642a868b09a75d011c49063a
diff mbox

Patch

diff --git a/core/platform.c b/core/platform.c
index 5878164..ba0636d 100644
--- a/core/platform.c
+++ b/core/platform.c
@@ -205,9 +205,11 @@  int wait_for_resource_loaded(enum resource_id id, uint32_t idx)
 
 	while(r == OPAL_BUSY) {
 		opal_run_pollers();
+		r = resource_loaded(id, idx);
+		if (r != OPAL_BUSY)
+			break;
 		time_wait_ms_nopoll(5);
 		waited+=5;
-		r = resource_loaded(id, idx);
 	}
 
 	prlog(PR_TRACE, "PLATFORM: wait_for_resource_loaded %x/%x %u ms\n",