[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4f0ca15e-770e-4192-b390-a3039c68e4b4@quicinc.com>
Date: Thu, 16 Jan 2025 00:44:48 +0530
From: Akhil P Oommen <quic_akhilpo@...cinc.com>
To: Rob Clark <robdclark@...il.com>, <dri-devel@...ts.freedesktop.org>
CC: <freedreno@...ts.freedesktop.org>, <linux-arm-msm@...r.kernel.org>,
"Rob
Clark" <robdclark@...omium.org>,
Abhinav Kumar <quic_abhinavk@...cinc.com>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Sean Paul <sean@...rly.run>,
Marijn Suijten <marijn.suijten@...ainline.org>,
David Airlie
<airlied@...il.com>, Simona Vetter <simona@...ll.ch>,
open list
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] drm/msm: Avoid rounding up to one jiffy
On 1/13/2025 9:18 PM, Rob Clark wrote:
> From: Rob Clark <robdclark@...omium.org>
>
> If userspace is trying to achieve a timeout of zero, let 'em have it.
> Only round up if the timeout is greater than zero.
>
> Fixes: 4969bccd5f4e ("drm/msm: Avoid rounding down to zero jiffies")
> Signed-off-by: Rob Clark <robdclark@...omium.org>
Reviewed-by: Akhil P Oommen <quic_akhilpo@...cinc.com>
-Akhil
> ---
> drivers/gpu/drm/msm/msm_drv.h | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
> index fee31680a6d5..a65077855201 100644
> --- a/drivers/gpu/drm/msm/msm_drv.h
> +++ b/drivers/gpu/drm/msm/msm_drv.h
> @@ -537,15 +537,12 @@ static inline int align_pitch(int width, int bpp)
> static inline unsigned long timeout_to_jiffies(const ktime_t *timeout)
> {
> ktime_t now = ktime_get();
> - s64 remaining_jiffies;
>
> - if (ktime_compare(*timeout, now) < 0) {
> - remaining_jiffies = 0;
> - } else {
> - ktime_t rem = ktime_sub(*timeout, now);
> - remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
> - }
> + if (ktime_compare(*timeout, now) <= 0)
> + return 0;
>
> + ktime_t rem = ktime_sub(*timeout, now);
> + s64 remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
> return clamp(remaining_jiffies, 1LL, (s64)INT_MAX);
> }
>
Powered by blists - more mailing lists