From: Yukimasa Sugizaki <ysugi@idein.jp>
To: dri-devel@lists.freedesktop.org
Cc: "Emily Deng" <Emily.Deng@amd.com>,
"David Airlie" <airlied@linux.ie>,
"Christian König" <christian.koenig@amd.com>,
"Yukimasa Sugizaki" <ysugi@idein.jp>
Subject: [PATCH 2/3] drm/v3d: Correctly restart the timer when progress is made
Date: Fri, 4 Sep 2020 01:48:20 +0900 [thread overview]
Message-ID: <20200903164821.2879-3-i.can.speak.c.and.basic@gmail.com> (raw)
In-Reply-To: <20200903164821.2879-1-i.can.speak.c.and.basic@gmail.com>
From: Yukimasa Sugizaki <ysugi@idein.jp>
The V3D scheduler wants a timed-out job to continue running if it made
progress. However, the current DRM scheduler removes the timed-out job
from ring_mirror_list and thus the timer is not restarted automatically,
resulting in an infinite timeout. We need stop and restart the DRM
scheduler to rearm the timer.
Fixes: 135517d3565b ("drm/scheduler: Avoid accessing freed bad job.")
Signed-off-by: Yukimasa Sugizaki <ysugi@idein.jp>
---
drivers/gpu/drm/v3d/v3d_sched.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/gpu/drm/v3d/v3d_sched.c b/drivers/gpu/drm/v3d/v3d_sched.c
index 001216f22017..feef0c749e68 100644
--- a/drivers/gpu/drm/v3d/v3d_sched.c
+++ b/drivers/gpu/drm/v3d/v3d_sched.c
@@ -312,9 +312,24 @@ v3d_cl_job_timedout(struct drm_sched_job *sched_job, enum v3d_queue q,
u32 ctca = V3D_CORE_READ(0, V3D_CLE_CTNCA(q));
u32 ctra = V3D_CORE_READ(0, V3D_CLE_CTNRA(q));
+ /* If we've made progress, skip reset and let the timer get
+ * rearmed.
+ */
if (*timedout_ctca != ctca || *timedout_ctra != ctra) {
*timedout_ctca = ctca;
*timedout_ctra = ctra;
+
+ /* Because the timed-out job has been removed from
+ * ring_mirror_list in drm_sched_job_timedout(), we need to
+ * stop and restart the scheduler to rearm the timer.
+ * Holding the reset_lock is necessary for concurrent
+ * v3d_gpu_reset_for_timeout().
+ */
+ mutex_lock(&v3d->reset_lock);
+ drm_sched_stop(sched_job->sched, sched_job);
+ drm_sched_start(sched_job->sched, sched_job);
+ mutex_unlock(&v3d->reset_lock);
+
return;
}
@@ -359,6 +374,18 @@ v3d_csd_job_timedout(struct drm_sched_job *sched_job)
*/
if (job->timedout_batches != batches) {
job->timedout_batches = batches;
+
+ /* Because the timed-out job has been removed from
+ * ring_mirror_list in drm_sched_job_timedout(), we need to
+ * stop and restart the scheduler to rearm the timer.
+ * Holding the reset_lock is necessary for concurrent
+ * v3d_gpu_reset_for_timeout().
+ */
+ mutex_lock(&v3d->reset_lock);
+ drm_sched_stop(sched_job->sched, sched_job);
+ drm_sched_start(sched_job->sched, sched_job);
+ mutex_unlock(&v3d->reset_lock);
+
return;
}
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2020-09-04 7:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-03 16:48 [PATCH 0/3] drm/v3d: CL/CSD job timeout fixes Yukimasa Sugizaki
2020-09-03 16:48 ` [PATCH 1/3] drm/v3d: Don't resubmit guilty CSD jobs Yukimasa Sugizaki
2021-02-04 13:54 ` Chema Casanova
2020-09-03 16:48 ` Yukimasa Sugizaki [this message]
2020-09-03 16:48 ` [PATCH 3/3] drm/v3d: Add job timeout module param Yukimasa Sugizaki
2021-02-04 18:09 ` Chema Casanova
2021-02-04 19:34 ` Eric Anholt
2021-02-05 12:28 ` Yukimasa Sugizaki
2021-02-10 17:59 ` Chema Casanova
2021-02-11 6:31 ` Yukimasa Sugizaki
-- strict thread matches above, loose matches on Subject: below --
2020-09-04 8:15 [PATCH 0/3] drm/v3d: CL/CSD job timeout fixes Yukimasa Sugizaki
2020-09-04 8:15 ` [PATCH 2/3] drm/v3d: Correctly restart the timer when progress is made Yukimasa Sugizaki
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=20200903164821.2879-3-i.can.speak.c.and.basic@gmail.com \
--to=ysugi@idein.jp \
--cc=Emily.Deng@amd.com \
--cc=airlied@linux.ie \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
/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