From: "Dixit, Ashutosh" <ashutosh.dixit@intel.com>
To: Harish Chegondi <harish.chegondi@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Subject: Re: [PATCH 1/1] drm/xe: Fix conversion from clock ticks to milliseconds
Date: Fri, 21 Nov 2025 14:25:10 -0800 [thread overview]
Message-ID: <87cy5buipl.wl-ashutosh.dixit@intel.com> (raw)
In-Reply-To: <1562f1b62d5be3fbaee100f09107f3cc49e40dd1.1763408584.git.harish.chegondi@intel.com>
On Mon, 17 Nov 2025 11:48:43 -0800, Harish Chegondi wrote:
>
> When tick counts are large and multiplication by MSEC_PER_SEC is larger
> than 64 bits, the conversion from clock ticks to milliseconds can go bad.
>
> Use mul_u64_u32_div() instead.
>
> Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
> Suggested-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
With:
Fixes: 49cc215aad7f ("drm/xe: Add xe_gt_clock_interval_to_ms helper"
Reviewed-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_clock.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_clock.c b/drivers/gpu/drm/xe/xe_gt_clock.c
> index 00f5972c14dc..bfc25c46f798 100644
> --- a/drivers/gpu/drm/xe/xe_gt_clock.c
> +++ b/drivers/gpu/drm/xe/xe_gt_clock.c
> @@ -74,11 +74,6 @@ int xe_gt_clock_init(struct xe_gt *gt)
> return 0;
> }
>
> -static u64 div_u64_roundup(u64 n, u32 d)
> -{
> - return div_u64(n + d - 1, d);
> -}
> -
> /**
> * xe_gt_clock_interval_to_ms - Convert sampled GT clock ticks to msec
> *
> @@ -89,5 +84,5 @@ static u64 div_u64_roundup(u64 n, u32 d)
> */
> u64 xe_gt_clock_interval_to_ms(struct xe_gt *gt, u64 count)
> {
> - return div_u64_roundup(count * MSEC_PER_SEC, gt->info.reference_clock);
> + return mul_u64_u32_div(count, MSEC_PER_SEC, gt->info.reference_clock);
> }
> --
> 2.43.0
>
prev parent reply other threads:[~2025-11-21 22:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 19:48 [PATCH 1/1] drm/xe: Fix conversion from clock ticks to milliseconds Harish Chegondi
2025-11-17 19:55 ` ✓ CI.KUnit: success for series starting with [1/1] " Patchwork
2025-11-17 20:33 ` ✓ Xe.CI.BAT: " Patchwork
2025-11-17 21:53 ` ✗ Xe.CI.Full: failure " Patchwork
2025-11-21 22:25 ` Dixit, Ashutosh [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=87cy5buipl.wl-ashutosh.dixit@intel.com \
--to=ashutosh.dixit@intel.com \
--cc=harish.chegondi@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=umesh.nerlige.ramappa@intel.com \
/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 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.