[Intel-xe] [PATCH v4 06/10] drm/sched: Add drm_sched_start_timeout_unlocked helper
Luben Tuikov
luben.tuikov at amd.com
Fri Sep 29 21:23:23 UTC 2023
Hi,
On 2023-09-19 01:01, Matthew Brost wrote:
> Also add a lockdep assert to drm_sched_start_timeout.
>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
Reviewed-by: Luben Tuikov <luben.tuikov at amd.com>
Thanks for this patch!
> ---
> drivers/gpu/drm/scheduler/sched_main.c | 23 +++++++++++++----------
> 1 file changed, 13 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c
> index 1e21d234fb5c..09ef07b9e9d5 100644
> --- a/drivers/gpu/drm/scheduler/sched_main.c
> +++ b/drivers/gpu/drm/scheduler/sched_main.c
> @@ -431,11 +431,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_fault - immediately start timeout handler
> *
> @@ -548,11 +557,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);
> }
>
> /**
> @@ -678,11 +684,8 @@ void drm_sched_start(struct drm_gpu_scheduler *sched, bool full_recovery)
> drm_sched_job_done(s_job, -ECANCELED);
> }
>
> - 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);
>
> drm_sched_submit_start(sched);
> }
--
Regards,
Luben
More information about the Intel-xe
mailing list