Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Take job list lock in xe_sched_first_pending_job

Access to the pending_list should always happens under job_list_lock.

Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241105160327.2970277-1-nirmoy.das@intel.com
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>

+8 -2
+8 -2
drivers/gpu/drm/xe/xe_gpu_scheduler.h
··· 71 71 static inline 72 72 struct xe_sched_job *xe_sched_first_pending_job(struct xe_gpu_scheduler *sched) 73 73 { 74 - return list_first_entry_or_null(&sched->base.pending_list, 75 - struct xe_sched_job, drm.list); 74 + struct xe_sched_job *job; 75 + 76 + spin_lock(&sched->base.job_list_lock); 77 + job = list_first_entry_or_null(&sched->base.pending_list, 78 + struct xe_sched_job, drm.list); 79 + spin_unlock(&sched->base.job_list_lock); 80 + 81 + return job; 76 82 } 77 83 78 84 static inline int