[PATCH] drm/xe: Grab pending job list lock before resubmit

Matthew Auld matthew.auld at intel.com
Tue Jun 17 15:14:05 UTC 2025


On 17/06/2025 15:47, Tejas Upadhyay wrote:
> Pending job list is protected by pending job lock to
> avoid any racing thus grab pending job list lock before
> resubmitting jobs.
> 
> Fixes: 38fafa9f392f ("drm/xe/sched: stop re-submitting signalled jobs")
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_gpu_scheduler.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.h b/drivers/gpu/drm/xe/xe_gpu_scheduler.h
> index 308061f0cf37..dfdb409da6ba 100644
> --- a/drivers/gpu/drm/xe/xe_gpu_scheduler.h
> +++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.h
> @@ -53,6 +53,7 @@ static inline void xe_sched_resubmit_jobs(struct xe_gpu_scheduler *sched)
>   {
>   	struct drm_sched_job *s_job;
>   
> +	spin_lock(&sched->base.job_list_lock);
>   	list_for_each_entry(s_job, &sched->base.pending_list, list) {
>   		struct drm_sched_fence *s_fence = s_job->s_fence;
>   		struct dma_fence *hw_fence = s_fence->parent;
> @@ -60,6 +61,7 @@ static inline void xe_sched_resubmit_jobs(struct xe_gpu_scheduler *sched)
>   		if (hw_fence && !dma_fence_is_signaled(hw_fence))
>   			sched->base.ops->run_job(s_job);

Is this fixing a real issue? There is a sleeping lock and maybe other 
nasties in run_job() AFAICT, so I don't think this will work as-is, but 
I don't believe we need this, since sched should be stopped at this 
point, so nothing else should be modifying pending_list until we start 
it back up, which is only later?

>   	}
> +	spin_unlock(&sched->base.job_list_lock);
>   }
>   
>   static inline bool



More information about the Intel-xe mailing list