From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: Rob Herring <robh@kernel.org>,
Steven Price <steven.price@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 2/2] drm/panfrost: Fix race when restoring reset state in perfcnt
Date: Fri, 16 Oct 2026 09:24:57 +0200 [thread overview]
Message-ID: <20261016092457.610adb7c@fedora-21.home> (raw)
In-Reply-To: <20261015-panfrost-reset-races-fixes-v1-2-bb74c1786a0b@collabora.com>
On Thu, 15 Oct 2026 19:22:32 +0100
Adrián Larumbe <adrian.larumbe@collabora.com> wrote:
> struct panfrost_perfcnt::state should always be updated atomically, both
> in the dump ioctl and the reset sequence.
>
> Fixes: 9944dd07f3cf ("drm/panfrost: Fix races between perfcnt and reset sequence")
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 15 +++++++--------
> 1 file changed, 7 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> index b26da057a1a0..d50b6cc2ecfa 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
> @@ -148,18 +148,17 @@ static int panfrost_perfcnt_dump_locked(struct panfrost_device *pfdev, u32 *stat
> */
> ret = wait_for_completion_interruptible_timeout(&pfdev->perfcnt->dump_comp,
> msecs_to_jiffies(1000));
> -
> if (!ret)
> ret = -ETIMEDOUT;
>
> - /* We need to restore perfcnt state so the next successful dump can relay it to UM */
> - if (ret < 0) {
> - perfcnt->state |= *state;
> - *state = 0;
> - return ret;
> - }
> -
> scoped_guard(rwsem_read, &pfdev->reset.lock) {
> + /* Restore perfcnt state so the next successful dump can relay it to UM */
> + if (ret < 0) {
> + perfcnt->state |= *state;
> + *state = 0;
> + return ret;
> + }
> +
> *state |= perfcnt->state;
>
> /* UM must re-enable their session before requesting new dumps. */
>
prev parent reply other threads:[~2026-10-16 7:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 18:22 [PATCH 0/2] Two small perfcnt fixes for Panfrost Adrián Larumbe
2026-10-15 18:22 ` [PATCH 1/2] drm/panfrost: Enable cycle counting when perfcnt is enabled Adrián Larumbe
2026-10-16 7:23 ` Boris Brezillon
2026-10-16 7:24 ` Boris Brezillon
2026-10-15 18:22 ` [PATCH 2/2] drm/panfrost: Fix race when restoring reset state in perfcnt Adrián Larumbe
2026-10-16 7:24 ` Boris Brezillon [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=20261016092457.610adb7c@fedora-21.home \
--to=boris.brezillon@collabora.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.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=steven.price@arm.com \
--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®