VAS allocate, modify and deallocate HCALLs returns
H_LONG_BUSY_ORDER_1_MSEC or H_LONG_BUSY_ORDER_10_MSEC for busy
delay and expects OS to reissue HCALL after that delay. But using
msleep() will often sleep at least 20 msecs even though the
hypervisor expects to reissue these HCALLs after 1 or 10msecs.
It might cause these HCALLs takes longer when multiple threads
issue open or close VAS windows simultaneously.

So instead of using msleep(), call rtas_busy_sleep() which uses
usleep_range() if the delay is <= 20msecs.

Signed-off-by: Haren Myneni <ha...@linux.ibm.com>
Suggested-by: Nathan Lynch <nath...@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/vas.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/vas.c 
b/arch/powerpc/platforms/pseries/vas.c
index 71d52a670d95..c0ffdfc51f96 100644
--- a/arch/powerpc/platforms/pseries/vas.c
+++ b/arch/powerpc/platforms/pseries/vas.c
@@ -18,6 +18,7 @@
 #include <asm/plpar_wrappers.h>
 #include <asm/firmware.h>
 #include <asm/vphn.h>
+#include <asm/rtas.h>
 #include <asm/vas.h>
 #include "vas.h"
 
@@ -38,7 +39,13 @@ static long hcall_return_busy_check(long rc)
 {
        /* Check if we are stalled for some time */
        if (H_IS_LONG_BUSY(rc)) {
-               msleep(get_longbusy_msecs(rc));
+               /*
+                * Allocate, Modify and Deallocate HCALLs can return
+                * H_LONG_BUSY_ORDER_1_MSEC or H_LONG_BUSY_ORDER_10_MSEC
+                * and expects OS to reissue HCALL after 1msec or
+                * 10msecs.
+                */
+               rtas_busy_sleep(rc);
                rc = H_BUSY;
        } else if (rc == H_BUSY) {
                cond_resched();
-- 
2.26.3

Reply via email to