Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Akhil P Oommen <quic_akhilpo@quicinc.com>
To: Rob Clark <robdclark@gmail.com>, <dri-devel@lists.freedesktop.org>
Cc: <freedreno@lists.freedesktop.org>,
	<linux-arm-msm@vger.kernel.org>,
	"Rob Clark" <robdclark@chromium.org>,
	Abhinav Kumar <quic_abhinavk@quicinc.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] drm/msm: Avoid rounding up to one jiffy
Date: Thu, 16 Jan 2025 00:44:48 +0530	[thread overview]
Message-ID: <4f0ca15e-770e-4192-b390-a3039c68e4b4@quicinc.com> (raw)
In-Reply-To: <20250113154841.129521-1-robdclark@gmail.com>

On 1/13/2025 9:18 PM, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.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@chromium.org>

Reviewed-by: Akhil P Oommen <quic_akhilpo@quicinc.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);
>  }
>  


      reply	other threads:[~2025-01-15 19:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-13 15:48 [PATCH v2] drm/msm: Avoid rounding up to one jiffy Rob Clark
2025-01-15 19:14 ` Akhil P Oommen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4f0ca15e-770e-4192-b390-a3039c68e4b4@quicinc.com \
    --to=quic_akhilpo@quicinc.com \
    --cc=airlied@gmail.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marijn.suijten@somainline.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@chromium.org \
    --cc=robdclark@gmail.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox