From: sashiko-bot@kernel.org
To: ThePedroo <pedro@performanc.org>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/panfrost: fix stuck reset.pending on JOB_BUS_FAULT
Date: Thu, 19 Nov 2026 19:28:12 +0000 [thread overview]
Message-ID: <sashiko-outbox-223883@kernel.org> (raw)
In-Reply-To: <a3b7a3f3-4da6-4a41-b842-cf9778dd7ba1@performanc.org>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/panfrost: use-after-free in panfrost_jm_fini() [1]
--
commit 425df48a8a39ab3673476c8b751250446dcc35c8
Author: Pedro Olímpio <pedro@performanc.org>
drm/panfrost: fix stuck reset.pending on JOB_BUS_FAULT
This commit replaces the drm_sched_fault() call in panfrost_job_handle_err()
with panfrost_device_schedule_reset() so that a GPU reset runs even after
job->done_fence has been signaled.
> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 3a46dd61cf87f..3c3107d706795 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -499,10 +499,8 @@ static void panfrost_job_handle_err(struct panfrost_device *pfdev,
>
> pm_runtime_put_autosuspend(pfdev->base.dev);
>
> - if (panfrost_exception_needs_reset(pfdev, js_status)) {
> - atomic_set(&pfdev->reset.pending, 1);
> - drm_sched_fault(&pfdev->js->queue[js].sched);
> - }
> + if (panfrost_exception_needs_reset(pfdev, js_status))
> + panfrost_device_schedule_reset(pfdev);
> }
>
> static void panfrost_jm_handle_done(struct panfrost_device *pfdev,
[Severity: Critical]
This problem wasn't introduced by this patch, but can a pending
pfdev->reset.work item race with panfrost_jm_fini() [1] and access
js->queue[j].sched after drm_sched_fini()?
drivers/gpu/drm/panfrost/panfrost_job.c:panfrost_jm_fini() {
...
for (j = 0; j < NUM_JOB_SLOTS; j++) {
drm_sched_fini(&js->queue[j].sched);
}
disable_work_sync(&pfdev->reset.work);
...
}
CPU0 CPU1 (pfdev->reset.wq)
panfrost_jm_fini()
drm_sched_fini(&js->queue[j].sched)
panfrost_reset()
drm_sched_stop() <-- use-after-free
disable_work_sync(&pfdev->reset.work)
If a reset queued via panfrost_device_schedule_reset() runs during driver
teardown before disable_work_sync() cancels it, panfrost_reset() calls
drm_sched_stop() on the already finalized scheduler.
[1] https://sashiko.dev/#/bug/linux-3c56dd27-0f33-4f82-a144-72279b21c756
--
Sashiko AI review · https://sashiko.dev/#/patchset/a3b7a3f3-4da6-4a41-b842-cf9778dd7ba1@performanc.org?part=1
parent reply other threads:[~2026-11-19 19:28 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <a3b7a3f3-4da6-4a41-b842-cf9778dd7ba1@performanc.org>]
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=sashiko-outbox-223883@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=pedro@performanc.org \
--cc=sashiko-reviews@lists.linux.dev \
/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