Skip to content

Commit 7a36dcf

Browse files
mbrost05Luben Tuikov
authored andcommitted
drm/sched: Add drm_sched_start_timeout_unlocked helper
Also add a lockdep assert to drm_sched_start_timeout. Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Luben Tuikov <luben.tuikov@amd.com> Link: https://lore.kernel.org/r/20231031032439.1558703-5-matthew.brost@intel.com Signed-off-by: Luben Tuikov <ltuikov89@gmail.com>
1 parent f7fe64a commit 7a36dcf

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,20 @@ static void drm_sched_job_done_cb(struct dma_fence *f, struct dma_fence_cb *cb)
334334
*/
335335
static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched)
336336
{
337+
lockdep_assert_held(&sched->job_list_lock);
338+
337339
if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
338340
!list_empty(&sched->pending_list))
339341
queue_delayed_work(sched->timeout_wq, &sched->work_tdr, sched->timeout);
340342
}
341343

344+
static void drm_sched_start_timeout_unlocked(struct drm_gpu_scheduler *sched)
345+
{
346+
spin_lock(&sched->job_list_lock);
347+
drm_sched_start_timeout(sched);
348+
spin_unlock(&sched->job_list_lock);
349+
}
350+
342351
/**
343352
* drm_sched_fault - immediately start timeout handler
344353
*
@@ -451,11 +460,8 @@ static void drm_sched_job_timedout(struct work_struct *work)
451460
spin_unlock(&sched->job_list_lock);
452461
}
453462

454-
if (status != DRM_GPU_SCHED_STAT_ENODEV) {
455-
spin_lock(&sched->job_list_lock);
456-
drm_sched_start_timeout(sched);
457-
spin_unlock(&sched->job_list_lock);
458-
}
463+
if (status != DRM_GPU_SCHED_STAT_ENODEV)
464+
drm_sched_start_timeout_unlocked(sched);
459465
}
460466

461467
/**
@@ -581,11 +587,8 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery)
581587
drm_sched_job_done(s_job, -ECANCELED);
582588
}
583589

584-
if (full_recovery) {
585-
spin_lock(&sched->job_list_lock);
586-
drm_sched_start_timeout(sched);
587-
spin_unlock(&sched->job_list_lock);
588-
}
590+
if (full_recovery)
591+
drm_sched_start_timeout_unlocked(sched);
589592

590593
drm_sched_wqueue_start(sched);
591594
}

0 commit comments

Comments
 (0)