From: Steven Price <steven.price@arm.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>,
"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>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] drm/panfrost: Enable cycle counting when perfcnt is enabled
Date: Wed, 4 Nov 2026 16:51:19 +0000 [thread overview]
Message-ID: <2b3da819-79c4-4471-baee-19abb56bb30d@arm.com> (raw)
In-Reply-To: <20261103-panfrost-reset-races-fixes-v2-1-454207b1d4e3@collabora.com>
On 03/11/2026 20:36, Adrián Larumbe wrote:
> From: Boris Brezillon <boris.brezillon@collabora.com>
>
> If we don't do that, we end up with invalid timestamps in the block
> headers.
>
> We also need to avoid the warning on the cycle counter reference being
> other than 0 during device reset, because of perfcnt's lingering ref.
>
> Ideally this would be dealt with by splitting the reset sequence into
> pre and post stages, so that a hypothetical panfrost_perfcnt_pre_reset()
> would release the cycle counter reference. In the absence thereof, we
> just make do.
>
> Fixes: 7786fd108777 ("drm/panfrost: Expose performance counters through unstable ioctls")
> Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_gpu.c | 6 +++---
> drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 3 +++
> 2 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> index 6081b27829e1..7d66b1b50968 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
> @@ -94,10 +94,10 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)
> GPU_IRQ_CLEAN_CACHES_COMPLETED);
>
> /*
> - * All in-flight jobs should have released their cycle
> - * counter references upon reset, but let us make sure
> + * Even though all in-flight jobs should have released their cycle counter
> + * references upon reset, perfcnt's might still hang about.
> */
> - if (drm_WARN_ON(&pfdev->base, atomic_read(&pfdev->cycle_counter.use_count) != 0))
> + if (atomic_read(&pfdev->cycle_counter.use_count) != 0)
> atomic_set(&pfdev->cycle_counter.use_count, 0);
There's no point in doing the read - we might as well just
unconditionally do the atomic_set().
With that fixed:
Reviewed-by: Steven Price <steven.price@arm.com>
>
> return 0;
> diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> index a9def452d5ef..b26da057a1a0 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> @@ -17,6 +17,7 @@
> #include "panfrost_device.h"
> #include "panfrost_features.h"
> #include "panfrost_gem.h"
> +#include "panfrost_gpu.h"
> #include "panfrost_issues.h"
> #include "panfrost_job.h"
> #include "panfrost_mmu.h"
> @@ -52,6 +53,7 @@ static void panfrost_perfcnt_hw_disable(struct panfrost_device *pfdev)
> gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
>
> if (perfcnt->owns_as_ref) {
> + panfrost_cycle_counter_put(pfdev);
> panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu);
> perfcnt->owns_as_ref = false;
> }
> @@ -84,6 +86,7 @@ static int panfrost_perfcnt_hw_enable(struct panfrost_device *pfdev)
> return ret;
>
> perfcnt->owns_as_ref = true;
> + panfrost_cycle_counter_get(pfdev);
>
> as = ret;
> cfg = GPU_PERFCNT_CFG_AS(as) |
>
next prev parent reply other threads:[~2026-11-04 16:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 20:36 [PATCH v2 0/2] Two small perfcnt fixes for Panfrost Adrián Larumbe
2026-11-03 20:36 ` [PATCH v2 1/2] drm/panfrost: Enable cycle counting when perfcnt is enabled Adrián Larumbe
2026-11-04 16:51 ` Steven Price [this message]
2026-11-03 20:36 ` [PATCH v2 2/2] drm/panfrost: Fix race when restoring reset state in perfcnt Adrián Larumbe
2026-11-04 16:51 ` Steven Price
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=2b3da819-79c4-4471-baee-19abb56bb30d@arm.com \
--to=steven.price@arm.com \
--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=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robh@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®