The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Adrián Larumbe" <adrian.larumbe@collabora.com>
To: Steven Price <steven.price@arm.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>,
	 Rob Herring <robh@kernel.org>,
	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>,
	 Faith Ekstrand <faith.ekstrand@collabora.com>,
	"Marty E. Plummer" <hanetzer@startmail.com>,
	 Tomeu Vizoso <tomeu@tomeuvizoso.net>,
	Eric Anholt <eric@anholt.net>,
	 Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
	Robin Murphy <robin.murphy@arm.com>,
	 dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 Collabora Kernel Team <kernel@collabora.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	 Claude <noreply@anthropic.com>
Subject: Re: [PATCH v2 2/7] drm/panfrost: Prevent division by 0
Date: Tue, 16 Jun 2026 19:43:24 +0100	[thread overview]
Message-ID: <ajGZN-2TTn7YICsn@sobremesa> (raw)
In-Reply-To: <19d76abb-baff-4249-9f17-d0460b418d56@arm.com>

On 05.06.2026 11:29, Steven Price wrote:
> On 04/06/2026 19:02, Boris Brezillon wrote:
> > On Thu, 04 Jun 2026 18:35:21 +0100
> > Adrián Larumbe <adrian.larumbe@collabora.com> wrote:
> > 
> >> When updating and debug-printing devfreq stats, in the very unlikely
> >> offchance that total device time is less than 100 ns, clamp it to 0 to
> >> avoid division by 0.
> >>
> >> Reported-by: Claude <noreply@anthropic.com>
> >> Closes: https://gitlab.freedesktop.org/panfrost/linux/-/work_items/88
> >> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> >> Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver")
> >> ---
> >>  drivers/gpu/drm/panfrost/panfrost_devfreq.c | 3 ++-
> >>  1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> >> index b51c30778811..e34de47bf43b 100644
> >> --- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> >> +++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
> >> @@ -78,7 +78,8 @@ static int panfrost_devfreq_get_dev_status(struct device *dev,
> >>  
> >>  	dev_dbg(pfdev->base.dev, "busy %lu total %lu %lu %% freq %lu MHz\n",
> >>  		status->busy_time, status->total_time,
> >> -		status->busy_time / (status->total_time / 100),
> >> +		status->total_time >= 100 ?
> >> +			status->busy_time / (status->total_time / 100) : 0,
> > 
> > or:
> > 
> > 		status->busy_time * 100 / MAX(status->total_time, 1),
> > 
> 
> I have to admit I prefer Boris' version ;)
> 
> But either way:

Me too, I'm picking it for the next revision.

> Reviewed-by: Steven Price <steven.price@arm.com>
> 
> >>  		status->current_frequency / 1000 / 1000);
> >>  
> >>  	return 0;
> >>
> > 

Adrian Larumbe

  reply	other threads:[~2026-06-16 18:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 17:35 [PATCH v2 0/7] RPM, perfcnt and other minor fixes for Panfrost Adrián Larumbe
2026-06-04 17:35 ` [PATCH v2 1/7] drm/panfrost: Check another bo field for cache option query Adrián Larumbe
2026-06-04 17:57   ` Boris Brezillon
2026-06-05 10:29   ` Steven Price
2026-06-04 17:35 ` [PATCH v2 2/7] drm/panfrost: Prevent division by 0 Adrián Larumbe
2026-06-04 18:02   ` Boris Brezillon
2026-06-05 10:29     ` Steven Price
2026-06-16 18:43       ` Adrián Larumbe [this message]
2026-06-04 17:35 ` [PATCH v2 3/7] drm/panfrost: Move shrinker initialization and unplug one level down Adrián Larumbe
2026-06-04 18:04   ` Boris Brezillon
2026-06-16 18:53     ` Adrián Larumbe
2026-06-04 17:35 ` [PATCH v2 4/7] drm/panfrost: Move perfcnt GPU disable sequence into a helper Adrián Larumbe
2026-06-04 18:05   ` Boris Brezillon
2026-06-05 10:34   ` Steven Price
2026-06-04 17:35 ` [PATCH v2 5/7] drm/panfrost: Make reset sequence deal with an active HWPerf session Adrián Larumbe
2026-06-04 18:26   ` Boris Brezillon
2026-06-05 10:41     ` Steven Price
2026-06-16 19:15       ` Adrián Larumbe
2026-06-16 22:39     ` Adrián Larumbe
2026-06-17 14:43       ` Boris Brezillon
2026-06-04 17:35 ` [PATCH v2 6/7] drm/panfrost: Fix PM usage_count mishandling Adrián Larumbe
2026-06-04 18:36   ` Boris Brezillon
2026-06-16 20:17     ` Adrián Larumbe
2026-06-17 14:55       ` Boris Brezillon
2026-06-05 10:48   ` Steven Price
2026-06-16 19:48     ` Adrián Larumbe
2026-06-04 17:35 ` [PATCH v2 7/7] drm/panfrost: Explicitly enable MMU interrupts at device init Adrián Larumbe
2026-06-05  6:56   ` Boris Brezillon
2026-06-16 19:15     ` Adrián Larumbe

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=ajGZN-2TTn7YICsn@sobremesa \
    --to=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eric@anholt.net \
    --cc=faith.ekstrand@collabora.com \
    --cc=hanetzer@startmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=noreply@anthropic.com \
    --cc=robh@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tomeu@tomeuvizoso.net \
    --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