powerpc/pseries: make max polling consistent for longer H_CALLs
PATCH v4 1/1 powerpc/pseries: make max polling consistent for longer H_CALLs
Currently, plpks_confirm_object_flushed() function polls for 5msec in total instead of 5sec.
Keep max polling time consistent for all the H_CALLs, which take longer than expected, to be 5sec. Also, make use of fsleep() everywhere to insert delay.
---
v4:
* As per Andrew's feedback, squashed Patch 2 with Patch 1.
Now it is single patch.
v3:
* Addition to Patch 1 timeout patch based on Andrew's feedback.
v2:
* Updated based on feedback from Michael Ellerman Replaced usleep_range with fsleep.
Since there is no more need to specify range, sleep time is
reverted back to 10 msec.
arch/powerpc/include/asm/plpks.h | 5 ++--- arch/powerpc/platforms/pseries/plpks.c | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/plpks.h +2 -3
@@ -44,9 +44,8 @@#define PLPKS_MAX_DATA_SIZE 4000// Timeouts for PLPKS operations -#define PLPKS_MAX_TIMEOUT 5000 // msec -#define PLPKS_FLUSH_SLEEP 10 // msec -#define PLPKS_FLUSH_SLEEP_RANGE 400 +#define PLPKS_MAX_TIMEOUT (5 * USEC_PER_SEC) +#define PLPKS_FLUSH_SLEEP 10000 // usecstruct plpks_var {char *component;
arch/powerpc/platforms/pseries/plpks.c +5 -5
@@ -415,8 +415,7 @@ static int plpks_confirm_object_flushed(struct label *label,break ; } -usleep_range (PLPKS_FLUSH_SLEEP , -PLPKS_FLUSH_SLEEP +PLPKS_FLUSH_SLEEP_RANGE ); +fsleep (PLPKS_FLUSH_SLEEP ); timeout = timeout +PLPKS_FLUSH_SLEEP ; }while (timeout <PLPKS_MAX_TIMEOUT );
@@ -464,9 +463,10 @@ int plpks_signed_update_var(struct plpks_var *var, u64 flags) continuetoken = retbuf[0 ];if (pseries_status_to_err (rc) == -EBUSY ) { -int delay_ms =get_longbusy_msecs (rc); -mdelay (delay_ms); - timeout += delay_ms; +int delay_us =get_longbusy_msecs (rc) *1000 ; + +fsleep (delay_us); + timeout += delay_us; } rc =pseries_status_to_err (rc); }while (rc == -EBUSY && timeout <PLPKS_MAX_TIMEOUT );
Signature · 1 line
2.31.1
Quoted 8 lines · Nayna Jain
Currently,
plpks_confirm_object_flushed()function polls for 5msec in total instead of 5sec.Keep max polling time consistent for all the
H_CALLs, which take longer
than expected, to be 5sec. Also, make use offsleep()everywhere to insert delay.
Quoted 5 lines
Reported-by Nageswara R Sastry <[email protected]>Fixes 2454a7af0f2a ("powerpc/pseries: define driver for PlatformKeyStore")
Signed-off-by Nayna Jain <[email protected]>Tested-by Nageswara R Sastry <[email protected]>
Quoted 68 lines
---
v4:
* As per Andrew's feedback, squashed Patch 2 with Patch 1. Now it is single patch.v3:
* Addition to Patch 1 timeout patch based on Andrew's feedback.v2:
* Updated based on feedback from Michael Ellerman Replacedusleep_rangewith fsleep.
Since there is no more need to specify range, sleep time is reverted back to 10 msec.arch/powerpc/include/asm/plpks.h | 5 ++---
arch/powerpc/platforms/pseries/plpks.c| 10 +++++-----2 files changed, 7 insertions(+), 8 deletions(-)arch/powerpc/include/asm/plpks.h +0
-0@@ -44,9 +44,8 @@ #define PLPKS_MAX_DATA_SIZE 4000
// Timeouts for PLPKS operationsarch/powerpc/include/asm/plpks.h +2
-3-#define PLPKS_MAX_TIMEOUT 5000 // msec -#define PLPKS_FLUSH_SLEEP 10 // msec -#define PLPKS_FLUSH_SLEEP_RANGE 400 +#define PLPKS_MAX_TIMEOUT (5 * USEC_PER_SEC) +#define PLPKS_FLUSH_SLEEP 10000 // usec
structplpks_var{
char *component;arch/powerpc/platforms/pseries/plpks.c +0
-0@@ -415,8 +415,7 @@ static int plpks_confirm_object_flushed(struct label *label, break; }arch/powerpc/platforms/pseries/plpks.c +0
-2- usleep_range(PLPKS_FLUSH_SLEEP, - PLPKS_FLUSH_SLEEP +
PLPKS_FLUSH_SLEEP_RANGE);arch/powerpc/platforms/pseries/plpks.c +1
-0+fsleep (PLPKS_FLUSH_SLEEP );timeout = timeout +
PLPKS_FLUSH_SLEEP; } while (timeout <PLPKS_MAX_TIMEOUT);arch/powerpc/platforms/pseries/plpks.c +0
-0@@ -464,9 +463,10 @@ int plpks_signed_update_var(struct plpks_var *var, u64 flags)
continuetoken = retbuf[0];
if (pseries_status_to_err(rc)==-EBUSY) {arch/powerpc/platforms/pseries/plpks.c +1
-3-int delay_ms =get_longbusy_msecs (rc); -mdelay (delay_ms); - timeout += delay_ms; + int delay_us = get_longbusy_msecs(rc) *1000;
arch/powerpc/platforms/pseries/plpks.c +3
-0+ +fsleep (delay_us); + timeout += delay_us;}
rc =pseries_status_to_err(rc);
} while (rc ==-EBUSY&& timeout <PLPKS_MAX_TIMEOUT);
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Michael Ellerman
AppliedQuoted 8 lines · Nayna Jain
Currently,
plpks_confirm_object_flushed()function polls for 5msec in total instead of 5sec.Keep max polling time consistent for all the
H_CALLs, which take longer than expected, to be 5sec. Also, make use offsleep()everywhere to insert delay.[...]
Applied to powerpc/fixes.
[1/1] powerpc/pseries: make max polling consistent for longer H_CALLs
https://git.kernel.org/powerpc/c/784354349d2c988590c63a5a001ca37b2a6d4da1
cheers