* [PATCH v4] powerpc/pseries: make max polling consistent for longer H_CALLs
@ 2024-04-18 3:12 Nayna Jain
2024-04-22 8:18 ` Andrew Donnellan
2024-05-03 10:44 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Nayna Jain @ 2024-04-18 3:12 UTC (permalink / raw)
To: linuxppc-dev
Cc: Andrew Donnellan, Greg Joyce, Nageswara R Sastry, Nayna Jain, npiggin
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.
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>
---
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(-)
diff --git a/arch/powerpc/include/asm/plpks.h b/arch/powerpc/include/asm/plpks.h
index 23b77027c916..7a84069759b0 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..4a595493d28a 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);
@@ -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);
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v4] powerpc/pseries: make max polling consistent for longer H_CALLs
2024-04-18 3:12 [PATCH v4] powerpc/pseries: make max polling consistent for longer H_CALLs Nayna Jain
@ 2024-04-22 8:18 ` Andrew Donnellan
2024-05-03 10:44 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Donnellan @ 2024-04-22 8:18 UTC (permalink / raw)
To: Nayna Jain, linuxppc-dev; +Cc: Greg Joyce, npiggin, Nageswara R Sastry
On Wed, 2024-04-17 at 23:12 -0400, Nayna Jain wrote:
> 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.
>
> 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>
Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>
> ---
> 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(-)
>
> diff --git a/arch/powerpc/include/asm/plpks.h
> b/arch/powerpc/include/asm/plpks.h
> index 23b77027c916..7a84069759b0 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..4a595493d28a 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);
>
> @@ -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);
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v4] powerpc/pseries: make max polling consistent for longer H_CALLs
2024-04-18 3:12 [PATCH v4] powerpc/pseries: make max polling consistent for longer H_CALLs Nayna Jain
2024-04-22 8:18 ` Andrew Donnellan
@ 2024-05-03 10:44 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2024-05-03 10:44 UTC (permalink / raw)
To: linuxppc-dev, Nayna Jain
Cc: npiggin, Andrew Donnellan, Greg Joyce, Nageswara R Sastry
On Wed, 17 Apr 2024 23:12:30 -0400, Nayna Jain wrote:
> 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.
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/pseries: make max polling consistent for longer H_CALLs
https://git.kernel.org/powerpc/c/784354349d2c988590c63a5a001ca37b2a6d4da1
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-05-03 10:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-18 3:12 [PATCH v4] powerpc/pseries: make max polling consistent for longer H_CALLs Nayna Jain
2024-04-22 8:18 ` Andrew Donnellan
2024-05-03 10:44 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.