diff options
| author | Nirmoy Das <nirmoy.das@intel.com> | 2024-11-05 19:03:27 +0300 |
|---|---|---|
| committer | Nirmoy Das <nirmoy.das@intel.com> | 2024-11-12 12:33:30 +0300 |
| commit | cd8e9956552dd2155f6e5ae55eb9c268233c104a (patch) | |
| tree | b14940797c3814d56c02febf35bb07684d856ebb | |
| parent | f7278da76da2589af13bc8a487d0e8f8abdecc99 (diff) | |
| download | linux-cd8e9956552dd2155f6e5ae55eb9c268233c104a.tar.xz | |
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>
| -rw-r--r-- | drivers/gpu/drm/xe/xe_gpu_scheduler.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.h b/drivers/gpu/drm/xe/xe_gpu_scheduler.h index 64b2ae6839db..c250ea773491 100644 --- a/drivers/gpu/drm/xe/xe_gpu_scheduler.h +++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.h @@ -71,8 +71,14 @@ static inline void xe_sched_add_pending_job(struct xe_gpu_scheduler *sched, static inline struct xe_sched_job *xe_sched_first_pending_job(struct xe_gpu_scheduler *sched) { - return list_first_entry_or_null(&sched->base.pending_list, - struct xe_sched_job, drm.list); + struct xe_sched_job *job; + + spin_lock(&sched->base.job_list_lock); + job = list_first_entry_or_null(&sched->base.pending_list, + struct xe_sched_job, drm.list); + spin_unlock(&sched->base.job_list_lock); + + return job; } static inline int |
