powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function
PATCH 1/1 powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function
usleep_range() function takes input time and range in usec. However, currently it is assumed in msec in the function plpks_confirm_object_flushed().
Fix the total polling time for the object flushing from 5msec to 5sec.
--- arch/powerpc/include/asm/plpks.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/include/asm/plpks.h +3 -3
@@ -44,9 +44,9 @@#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 5000000 // usec +#define PLPKS_FLUSH_SLEEP 5000 // usec +#define PLPKS_FLUSH_SLEEP_RANGE 5000struct plpks_var {char *component;
Signature · 1 line
2.31.1
Le 04/03/2024 à 07:53, Nayna Jain a écrit :
Quoted 7 lines
[Vous ne recevez pas souvent de courriers de [email protected]. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
usleep_range()function takes input time and range in usec. However, currently it is assumed in msec in the functionplpks_confirm_object_flushed().Fix the total polling time for the object flushing from 5msec to 5sec.
I understand when 5000 msec becomes 5000000 usec.
But why does 10 msec becomes 5000 usec ?
Why does 400 becomes 5000 ?
Christophe
Quoted 29 lines
Reported-by Nageswara R Sastry <[email protected]>Fixes 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")Signed-off-by Nayna Jain <[email protected]>Tested-by Nageswara R Sastry <[email protected]>--- arch/powerpc/include/asm/plpks.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/powerpc/include/asm/plpks.h +3
-4@@ -44,9 +44,9 @@#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 5000000 // usec +#define PLPKS_FLUSH_SLEEP 5000 // usec +#define PLPKS_FLUSH_SLEEP_RANGE 5000struct plpks_var {char *component; --2.31.1
Michael Ellerman
reviewerQuoted 19 lines · Nayna Jain
usleep_range()function takes input time and range in usec. However, currently it is assumed in msec in the functionplpks_confirm_object_flushed().Fix the total polling time for the object flushing from 5msec to 5sec.
Reported-by Nageswara R Sastry <[email protected]>Fixes 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")Signed-off-by Nayna Jain <[email protected]>Tested-by Nageswara R Sastry <[email protected]>--- arch/powerpc/include/asm/plpks.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/powerpc/include/asm/plpks.h +0
-0
arch/powerpc/include/asm/plpks.h line 49
Quoted 9 lines
arch/powerpc/include/asm/plpks.h +3
-3@@ -44,9 +44,9 @@#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 5000000 // usec +#define PLPKS_FLUSH_SLEEP 5000 // usec +#define PLPKS_FLUSH_SLEEP_RANGE 5000
It would be simpler if you used fsleep, eg:
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 +1 -2
@@ -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 );
cheers