From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0039EC54E49 for ; Tue, 5 Mar 2024 00:21:55 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=BVjHMaxv; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4Tpbpp0bNlz3dTl for ; Tue, 5 Mar 2024 11:21:54 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=ellerman.id.au header.i=@ellerman.id.au header.a=rsa-sha256 header.s=201909 header.b=BVjHMaxv; dkim-atps=neutral Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Tpbnz5d04z30NP for ; Tue, 5 Mar 2024 11:21:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1709598069; bh=KzZciJi7O7W57jus900aVIrlFHf+alGTZHweec28dLk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=BVjHMaxvPaNoqGMtWDEj1/UZdE/dzgDpPGRr9pdQc7gzGzu5kuVcP23S0vjIW1hEF 1sUquGXaye0k9mQ4kuZC+Z8KyBHXo2Cm18hCaJw99V08nOpDdqGPXqOPW2L/fnsV+D HlDO0mdalo8ITd+8aMGj3LHNLd0J67BAYgb4OGEdGPISMOLFSg6mj5aHZP4D7SLVeZ jWibFrQQGD27EYMGXHxlUAYzzVYyFz6ALW6anfzXVqeLg7t8zE1XHtyzgjLDbReYZ6 TjSVUAn9dQURKkPQHad/JLVLLfY3t65skoOcBMDe60iQAO3UxkwHTOG2ucKp2tm9jN 0Axwdn177LeRQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4Tpbnx56kQz4wcF; Tue, 5 Mar 2024 11:21:09 +1100 (AEDT) From: Michael Ellerman To: Nayna Jain , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] powerpc/pseries: fix max polling time in plpks_confirm_object_flushed() function In-Reply-To: <20240304065326.787453-1-nayna@linux.ibm.com> References: <20240304065326.787453-1-nayna@linux.ibm.com> Date: Tue, 05 Mar 2024 11:21:08 +1100 Message-ID: <87il21plzf.fsf@mail.lhotse> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nayna Jain , Andrew Donnellan , npiggin@gmail.com, Nageswara R Sastry Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Nayna Jain 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 > Fixes: 2454a7af0f2a ("powerpc/pseries: define driver for Platform KeyStore") > Signed-off-by: Nayna Jain > Tested-by: Nageswara R Sastry > --- > 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