From: "Adrián Larumbe" <adrian.larumbe@collabora.com>
To: "Boris Brezillon" <boris.brezillon@collabora.com>,
"Rob Herring" <robh@kernel.org>,
"Steven Price" <steven.price@arm.com>,
"Adrián Larumbe" <adrian.larumbe@collabora.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>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/2] drm/panfrost: Fix race when restoring reset state in perfcnt
Date: Tue, 03 Nov 2026 20:36:09 +0000 [thread overview]
Message-ID: <20261103-panfrost-reset-races-fixes-v2-2-454207b1d4e3@collabora.com> (raw)
In-Reply-To: <20261103-panfrost-reset-races-fixes-v2-0-454207b1d4e3@collabora.com>
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")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Adrián Larumbe <adrian.larumbe@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. */
--
2.56.0
next prev parent reply other threads:[~2026-11-03 20:36 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
2026-11-03 20:36 ` Adrián Larumbe [this message]
2026-11-04 16:51 ` [PATCH v2 2/2] drm/panfrost: Fix race when restoring reset state in perfcnt 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=20261103-panfrost-reset-races-fixes-v2-2-454207b1d4e3@collabora.com \
--to=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=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®