Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: <intel-xe@lists.freedesktop.org>
Subject: [Intel-xe] [PATCH 1/2] fixup! drm/sched: Submit job before starting TDR
Date: Mon, 31 Jul 2023 20:27:47 -0700	[thread overview]
Message-ID: <20230801032748.434509-2-matthew.brost@intel.com> (raw)
In-Reply-To: <20230801032748.434509-1-matthew.brost@intel.com>

---
 drivers/gpu/drm/scheduler/sched_main.c | 27 ++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
index 0626aa6f7b70..fd265efc75d4 100644
--- a/drivers/gpu/drm/scheduler/sched_main.c
+++ b/drivers/gpu/drm/scheduler/sched_main.c
@@ -369,11 +369,20 @@ static void drm_sched_job_done_cb(struct dma_fence *f, struct dma_fence_cb *cb)
  */
 static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched)
 {
+	lockdep_assert_held(&sched->job_list_lock);
+
 	if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
 	    !list_empty(&sched->pending_list))
 		queue_delayed_work(sched->timeout_wq, &sched->work_tdr, sched->timeout);
 }
 
+static void drm_sched_start_timeout_unlocked(struct drm_gpu_scheduler *sched)
+{
+	spin_lock(&sched->job_list_lock);
+	drm_sched_start_timeout(sched);
+	spin_unlock(&sched->job_list_lock);
+}
+
 /**
  * drm_sched_set_timeout - set timeout for reset worker
  *
@@ -464,7 +473,6 @@ static void drm_sched_job_begin(struct drm_sched_job *s_job)
 
 	spin_lock(&sched->job_list_lock);
 	list_add_tail(&s_job->list, &sched->pending_list);
-	drm_sched_start_timeout(sched);
 	spin_unlock(&sched->job_list_lock);
 }
 
@@ -504,11 +512,8 @@ static void drm_sched_job_timedout(struct work_struct *work)
 		spin_unlock(&sched->job_list_lock);
 	}
 
-	if (status != DRM_GPU_SCHED_STAT_ENODEV) {
-		spin_lock(&sched->job_list_lock);
-		drm_sched_start_timeout(sched);
-		spin_unlock(&sched->job_list_lock);
-	}
+	if (status != DRM_GPU_SCHED_STAT_ENODEV)
+		drm_sched_start_timeout_unlocked(sched);
 }
 
 /**
@@ -636,11 +641,8 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery)
 
 	drm_sched_run_wq_start(sched);
 
-	if (full_recovery) {
-		spin_lock(&sched->job_list_lock);
-		drm_sched_start_timeout(sched);
-		spin_unlock(&sched->job_list_lock);
-	}
+	if (full_recovery)
+		drm_sched_start_timeout_unlocked(sched);
 }
 EXPORT_SYMBOL(drm_sched_start);
 
@@ -1178,10 +1180,11 @@ static void drm_sched_main(struct work_struct *w)
 		s_fence = sched_job->s_fence;
 
 		atomic_inc(&sched->hw_rq_count);
+		drm_sched_job_begin(sched_job);
 
 		trace_drm_run_job(sched_job, entity);
 		fence = sched->ops->run_job(sched_job);
-		drm_sched_job_begin(sched_job);
+		drm_sched_start_timeout_unlocked(sched);
 		complete_all(&entity->entity_idle);
 		drm_sched_fence_scheduled(s_fence, fence);
 
-- 
2.34.1


  reply	other threads:[~2023-08-01  3:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-01  3:27 [Intel-xe] [PATCH 0/2] DRM scheduler changes for upstream Matthew Brost
2023-08-01  3:27 ` Matthew Brost [this message]
2023-08-01  3:27 ` [Intel-xe] [PATCH 2/2] fixup! drm/sched: Convert drm scheduler to use a work queue rather than kthread Matthew Brost
2023-08-01  3:30 ` [Intel-xe] ✓ CI.Patch_applied: success for DRM scheduler changes for upstream Patchwork
2023-08-01  3:30 ` [Intel-xe] ✗ CI.checkpatch: warning " Patchwork
2023-08-01  3:31 ` [Intel-xe] ✓ CI.KUnit: success " Patchwork
2023-08-01  3:35 ` [Intel-xe] ✓ CI.Build: " Patchwork
2023-08-01  3:35 ` [Intel-xe] ✓ CI.Hooks: " Patchwork
2023-08-01  3:37 ` [Intel-xe] ✓ CI.checksparse: " Patchwork
2023-08-01  4:11 ` [Intel-xe] ○ CI.BAT: info " Patchwork
2023-08-08 21:38 ` [Intel-xe] [PATCH 0/2] " Rodrigo Vivi

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=20230801032748.434509-2-matthew.brost@intel.com \
    --to=matthew.brost@intel.com \
    --cc=intel-xe@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