From: Steven Price <steven.price@arm.com>
To: Haoming Gao <Naixumogu@whut.edu.cn>, boris.brezillon@collabora.com
Cc: adrian.larumbe@collabora.com, Liviu Dudau <liviu.dudau@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/panthor: Fix overflow in fdinfo engine time conversion
Date: Fri, 4 Dec 2026 11:35:49 +0000 [thread overview]
Message-ID: <5aec1d47-affd-4540-94f5-1b9c19257c1d@arm.com> (raw)
In-Reply-To: <20261121152728.210765-1-Naixumogu@whut.edu.cn>
On 21/11/2026 15:27, Haoming Gao wrote:
> The timestamp counter accumulates GPU ticks per DRM client. Multiplying
> that counter by NSEC_PER_SEC in u64 can overflow before the division by
> the timer frequency, even when the result in nanoseconds fits in u64.
>
> On an RK3588 with a 24 MHz timer, drm-engine-panthor dropped from
> 768569012750 ns to 422647638 ns between two reads of the same client's
> fdinfo. The GPU cycle counter continued to advance.
>
> Use mul_u64_u64_div_u64_roundup() to preserve the full product and keep
> the existing rounding. The helper was checked against a 128-bit
> reference on the board, including at the first wrap boundary.
>
> Fixes: e16635d88fa0 ("drm/panthor: add DRM fdinfo support")
> Signed-off-by: Haoming Gao <Naixumogu@whut.edu.cn>
Reviewed-by: Steven Price <steven.price@arm.com>
> ---
> drivers/gpu/drm/panthor/panthor_drv.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_drv.c b/drivers/gpu/drm/panthor/panthor_drv.c
> index dc8d0191aef4..39b827a9b9cc 100644
> --- a/drivers/gpu/drm/panthor/panthor_drv.c
> +++ b/drivers/gpu/drm/panthor/panthor_drv.c
> @@ -8,6 +8,7 @@
> #endif
>
> #include <linux/list.h>
> +#include <linux/math64.h>
> #include <linux/module.h>
> #include <linux/of_platform.h>
> #include <linux/pagemap.h>
> @@ -1708,8 +1709,8 @@ static void panthor_gpu_show_fdinfo(struct panthor_device *ptdev,
> if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_TIMESTAMP) {
> #ifdef CONFIG_ARM_ARCH_TIMER
> drm_printf(p, "drm-engine-panthor:\t%llu ns\n",
> - DIV_ROUND_UP_ULL((pfile->stats.time * NSEC_PER_SEC),
> - arch_timer_get_cntfrq()));
> + mul_u64_u64_div_u64_roundup(pfile->stats.time, NSEC_PER_SEC,
> + arch_timer_get_cntfrq()));
> #endif
> }
> if (ptdev->profile_mask & PANTHOR_DEVICE_PROFILING_CYCLES)
>
> base-commit: 878c885830ef004a32e8974c4d1ae14e2ea30c5a
prev parent reply other threads:[~2026-12-04 11:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 15:27 Haoming Gao
2026-11-24 8:32 ` Boris Brezillon
2026-11-24 12:19 ` Liviu Dudau
2026-12-04 11:35 ` Steven Price [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=5aec1d47-affd-4540-94f5-1b9c19257c1d@arm.com \
--to=steven.price@arm.com \
--cc=Naixumogu@whut.edu.cn \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®