From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
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,
Arun Iyengar <aiyengar1990@gmail.com>
Subject: [PATCH v5 12/17] drm/panfrost: Don't take a job that was never started for done
Date: Sat, 28 Nov 2026 17:26:43 +0000 [thread overview]
Message-ID: <20261128-panfrost-long-jobs-v5-12-e7d62045a676@gmail.com> (raw)
In-Reply-To: <20261128-panfrost-long-jobs-v5-0-e7d62045a676@gmail.com>
From: Arun Iyengar <aiyengar1990@gmail.com>
reset.pending is set before panfrost_reset() masks the job interrupt.
A job queued but not started in that window, behind a running job that
completes, is taken for done: its fence is signalled and it never runs.
Mark a job started when JS_COMMAND_START is written, and leave the
others to the reset. Found by Sashiko. Not reproduced.
Fixes: 030761e097b4 ("drm/panfrost: Queue jobs on the hardware")
Cc: stable@vger.kernel.org
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-210891@kernel.org/
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/gpu/drm/panfrost/panfrost_job.c | 8 ++++++--
drivers/gpu/drm/panfrost/panfrost_job.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
index fcddc13bf..0946da3af 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.c
+++ b/drivers/gpu/drm/panfrost/panfrost_job.c
@@ -261,6 +261,7 @@ static int panfrost_job_hw_submit(struct panfrost_job *job, int js)
spin_lock(&pfdev->js->job_lock);
subslot = panfrost_enqueue_job(pfdev, js, job);
+ job->started = false;
/* Don't queue the job if a reset is in progress */
if (!atomic_read(&pfdev->reset.pending)) {
job->is_profiled = pfdev->profile_mode;
@@ -276,6 +277,7 @@ static int panfrost_job_hw_submit(struct panfrost_job *job, int js)
job->start_cycles = panfrost_cycle_counter_read(pfdev);
}
+ job->started = true;
job_write(pfdev, JS_COMMAND_NEXT(js), JS_COMMAND_START);
dev_dbg(pfdev->base.dev,
"JS: Submitting atom %p to js[%d][%d] with head=0x%llx AS %d",
@@ -584,7 +586,8 @@ static void panfrost_jm_handle_irq(struct panfrost_device *pfdev, u32 status)
if (failed[j]) {
panfrost_job_handle_err(pfdev, failed[j], j);
- } else if (pfdev->jobs[j][0] && !(js_state & MK_JS_MASK(j))) {
+ } else if (pfdev->jobs[j][0] && pfdev->jobs[j][0]->started &&
+ !(js_state & MK_JS_MASK(j))) {
/* When the current job doesn't fail, the JM dequeues
* the next job without waiting for an ACK, this means
* we can have 2 jobs dequeued and only catch the
@@ -592,7 +595,8 @@ static void panfrost_jm_handle_irq(struct panfrost_device *pfdev, u32 status)
* are inactive, but one job remains in pfdev->jobs[j],
* consider it done. Of course that doesn't apply if a
* failure happened since we cancelled execution of the
- * job in _NEXT (see above).
+ * job in _NEXT (see above), or if the job was queued
+ * while a reset was pending and never started.
*/
if (WARN_ON(!done[j][0]))
done[j][0] = panfrost_dequeue_job(pfdev, j);
diff --git a/drivers/gpu/drm/panfrost/panfrost_job.h b/drivers/gpu/drm/panfrost/panfrost_job.h
index 7f71e4c38..0ed45e28b 100644
--- a/drivers/gpu/drm/panfrost/panfrost_job.h
+++ b/drivers/gpu/drm/panfrost/panfrost_job.h
@@ -37,6 +37,8 @@ struct panfrost_job {
struct panfrost_engine_usage *engine_usage;
bool is_profiled;
bool cycle_counter_ref;
+ /* JS_COMMAND_START written */
+ bool started;
ktime_t start_time;
u64 start_cycles;
};
--
2.55.0
next prev parent reply other threads:[~2026-11-28 17:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 17:26 [PATCH v5 00/17] drm/panfrost: Resume long jobs instead of resetting, and mapping error path fixes Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 01/17] drm/panfrost: Freeze the reset workqueue during system sleep Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 02/17] drm/panfrost: Power the GPU up for a reset queued from the MMU code Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 03/17] drm/panfrost: Refuse to sync the CPU caches of a heap BO Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 04/17] drm/panfrost: Don't take a reference on a mapping that is being freed Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 05/17] drm/panfrost: Don't WARN when a GEM mapping cannot get its pages Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 06/17] drm/panfrost: Unwind a failed GPU mapping without dropping " Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 07/17] drm/panfrost: Give back the pages of a heap chunk that failed to map Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 08/17] drm/panfrost: Don't WARN for a heap folio a neighbouring chunk filled Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 09/17] drm/panfrost: Don't signal a job cancelled from _NEXT at a reset as done Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 10/17] drm/panfrost: Don't cancel a job that completed during a reset Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 11/17] drm/panfrost: Drop the cycle counter only for a job that holds it Arun Iyengar via B4 Relay
2026-11-28 17:26 ` Arun Iyengar via B4 Relay [this message]
2026-11-28 17:26 ` [PATCH v5 13/17] drm/panfrost: Wait for the soft-stopped slots with the live slot status Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 14/17] drm/panfrost: Keep the GPU powered in the job timeout handler Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 15/17] drm/panfrost: Keep the job interrupts masked during a reset Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 16/17] drm/panfrost: Soft-stop and resume a job that outlives the timeout Arun Iyengar via B4 Relay
2026-11-28 17:26 ` [PATCH v5 17/17] drm/panfrost: Name the BOs around an unhandled page fault Arun Iyengar via B4 Relay
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=20261128-panfrost-long-jobs-v5-12-e7d62045a676@gmail.com \
--to=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=aiyengar1990@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®