diff mbox series

[2/2] powerpc/pseries/vas: Call rtas_busy_sleep() to support HCALL delay

Message ID 20231127084753.3827119-2-haren@linux.ibm.com (mailing list archive)
State Changes Requested
Headers show
Series [1/2] powerpc/rtas: Create rtas_busy_sleep function | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Haren Myneni Nov. 27, 2023, 8:47 a.m. UTC
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 <haren@linux.ibm.com>
Suggested-by: Nathan Lynch <nathanl@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/vas.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

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();