linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function
@ 2024-03-04  6:53 Nayna Jain
  2024-03-04 18:16 ` Christophe Leroy
  2024-03-05  0:21 ` Michael Ellerman
  0 siblings, 2 replies; 3+ messages in thread
From: Nayna Jain @ 2024-03-04  6:53 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Nayna Jain, Andrew Donnellan, npiggin, Nageswara R Sastry

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.

Reported-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
---
 arch/powerpc/include/asm/plpks.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/plpks.h b/arch/powerpc/include/asm/plpks.h
index 23b77027c916..8721d97f32c1 100644
--- a/arch/powerpc/include/asm/plpks.h
+++ b/arch/powerpc/include/asm/plpks.h
@@ -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
 
 struct plpks_var {
 	char *component;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function
  2024-03-04  6:53 [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function Nayna Jain
@ 2024-03-04 18:16 ` Christophe Leroy
  2024-03-05  0:21 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Leroy @ 2024-03-04 18:16 UTC (permalink / raw)
  To: Nayna Jain, linuxppc-dev@lists.ozlabs.org
  Cc: Andrew Donnellan, npiggin@gmail.com, Nageswara R Sastry



Le 04/03/2024 à 07:53, Nayna Jain a écrit :
> [Vous ne recevez pas souvent de courriers de nayna@linux.ibm.com. 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 function
> plpks_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

> 
> Reported-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
> Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
> Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
> Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
> ---
>   arch/powerpc/include/asm/plpks.h | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/plpks.h b/arch/powerpc/include/asm/plpks.h
> index 23b77027c916..8721d97f32c1 100644
> --- a/arch/powerpc/include/asm/plpks.h
> +++ b/arch/powerpc/include/asm/plpks.h
> @@ -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
> 
>   struct plpks_var {
>          char *component;
> --
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function
  2024-03-04  6:53 [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function Nayna Jain
  2024-03-04 18:16 ` Christophe Leroy
@ 2024-03-05  0:21 ` Michael Ellerman
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2024-03-05  0:21 UTC (permalink / raw)
  To: Nayna Jain, linuxppc-dev
  Cc: Nayna Jain, Andrew Donnellan, npiggin, Nageswara R Sastry

Nayna Jain <nayna@linux.ibm.com> writes:
> 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.
>
> Reported-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
> Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore")
> Signed-off-by: Nayna Jain <nayna@linux.ibm.com>
> Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
> ---
>  arch/powerpc/include/asm/plpks.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/plpks.h b/arch/powerpc/include/asm/plpks.h
> index 23b77027c916..8721d97f32c1 100644
> --- a/arch/powerpc/include/asm/plpks.h
> +++ b/arch/powerpc/include/asm/plpks.h
> @@ -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:

diff --git a/arch/powerpc/include/asm/plpks.h b/arch/powerpc/include/asm/plpks.h
index 23b77027c916..b2d419eff9cd 100644
--- a/arch/powerpc/include/asm/plpks.h
+++ b/arch/powerpc/include/asm/plpks.h
@@ -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 // usec
 
 struct plpks_var {
 	char *component;
diff --git a/arch/powerpc/platforms/pseries/plpks.c b/arch/powerpc/platforms/pseries/plpks.c
index febe18f251d0..bcfcd5acc5c2 100644
--- a/arch/powerpc/platforms/pseries/plpks.c
+++ b/arch/powerpc/platforms/pseries/plpks.c
@@ -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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-03-05  0:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-04  6:53 [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function Nayna Jain
2024-03-04 18:16 ` Christophe Leroy
2024-03-05  0:21 ` Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).