powerpc/rtas: Create rtas_busy_sleep function
PATCH 1/2 powerpc/rtas: Create rtas_busy_sleep function
Move the RTAS delay sleep code to new rtas_busy_sleep(). It can be called from HCALL delay code that needs to support both usleep() or msleep() depends on delay value.
--- arch/powerpc/include/asm/rtas.h | 1 + arch/powerpc/kernel/rtas.c | 56 ++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 25 deletions(-)
arch/powerpc/include/asm/rtas.h +1 -0
@@ -435,6 +435,7 @@ extern void rtas_get_rtc_time(struct rtc_time *rtc_time);extern int rtas_set_rtc_time (struct rtc_time *rtc_time);extern unsigned int rtas_busy_delay_time (int status); +extern void rtas_busy_sleep (int value);bool rtas_busy_delay (int status); extern int early_init_dt_scan_rtas(unsigned long node,
arch/powerpc/kernel/rtas.c +31 -25
74 lines not on this page · raw message
Signature · 1 line
2.26.3
PATCH 2/2 powerpc/pseries/vas: Call rtas_busy_sleep() to support HCALL delay
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.
--- arch/powerpc/platforms/pseries/vas.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/vas.c +8 -1
@@ -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 ();
Signature · 1 line
2.26.3
Quoted 3 lines · Haren Myneni
Move the RTAS delay sleep code to new
rtas_busy_sleep(). It can be called from HCALL delay code that needs to support bothusleep()ormsleep()depends on delay value.
While there may be some future utility in factoring out the code that handles extended delay statuses, your patch 2/2 isn't an appropriate use
case: VAS makes hcalls and does not interact with RTAS.
Create a separate helper function in the vas code or in the generic hcall support code please. I think it's OK if it somewhat duplicates logic from rtas_busy_delay().