Commit 78435434 authored by Nayna Jain's avatar Nayna Jain Committed by Michael Ellerman

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.
Reported-by: default avatarNageswara R Sastry <rnsastry@linux.ibm.com>
Fixes: 2454a7af ("powerpc/pseries: define driver for Platform KeyStore")
Signed-off-by: default avatarNayna Jain <nayna@linux.ibm.com>
Tested-by: default avatarNageswara R Sastry <rnsastry@linux.ibm.com>
Reviewed-by: default avatarAndrew Donnellan <ajd@linux.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20240418031230.170954-1-nayna@linux.ibm.com
parent 210cfef5
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment