]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/xe: Add dedicated message lock
authorMatthew Brost <matthew.brost@intel.com>
Sat, 10 Jan 2026 01:27:33 +0000 (17:27 -0800)
committerMatthew Brost <matthew.brost@intel.com>
Sat, 10 Jan 2026 21:38:47 +0000 (13:38 -0800)
Stop abusing DRM scheduler job list lock for messages, add dedicated
message lock.

Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Acked-by: Philipp Stanner <phasta@kernel.org>
Link: https://patch.msgid.link/20260110012739.2888434-2-matthew.brost@intel.com
drivers/gpu/drm/xe/xe_gpu_scheduler.c
drivers/gpu/drm/xe/xe_gpu_scheduler.h
drivers/gpu/drm/xe/xe_gpu_scheduler_types.h

index f91e06d0351140ab3917e6111408c8be061b0bd7..f4f23317191ff1811b9e4525aedfcd266fa50f63 100644 (file)
@@ -77,6 +77,7 @@ int xe_sched_init(struct xe_gpu_scheduler *sched,
        };
 
        sched->ops = xe_ops;
+       spin_lock_init(&sched->msg_lock);
        INIT_LIST_HEAD(&sched->msgs);
        INIT_WORK(&sched->work_process_msg, xe_sched_process_msg_work);
 
@@ -117,7 +118,7 @@ void xe_sched_add_msg(struct xe_gpu_scheduler *sched,
 void xe_sched_add_msg_locked(struct xe_gpu_scheduler *sched,
                             struct xe_sched_msg *msg)
 {
-       lockdep_assert_held(&sched->base.job_list_lock);
+       lockdep_assert_held(&sched->msg_lock);
 
        list_add_tail(&msg->link, &sched->msgs);
        xe_sched_process_msg_queue(sched);
@@ -131,7 +132,7 @@ void xe_sched_add_msg_locked(struct xe_gpu_scheduler *sched,
 void xe_sched_add_msg_head(struct xe_gpu_scheduler *sched,
                           struct xe_sched_msg *msg)
 {
-       lockdep_assert_held(&sched->base.job_list_lock);
+       lockdep_assert_held(&sched->msg_lock);
 
        list_add(&msg->link, &sched->msgs);
        xe_sched_process_msg_queue(sched);
index c7a77a3a968193b32835e16923556387036b69ac..dceb2cd0ee5bde6727f744e461db284ddef86fa7 100644 (file)
@@ -33,12 +33,12 @@ void xe_sched_add_msg_head(struct xe_gpu_scheduler *sched,
 
 static inline void xe_sched_msg_lock(struct xe_gpu_scheduler *sched)
 {
-       spin_lock(&sched->base.job_list_lock);
+       spin_lock(&sched->msg_lock);
 }
 
 static inline void xe_sched_msg_unlock(struct xe_gpu_scheduler *sched)
 {
-       spin_unlock(&sched->base.job_list_lock);
+       spin_unlock(&sched->msg_lock);
 }
 
 static inline void xe_sched_stop(struct xe_gpu_scheduler *sched)
index 6731b13da8bbb9dbd1be935caa428d5da2969058..63d9bf92583c5500c8c9b4b9fa1fcfef1fbf9c3a 100644 (file)
@@ -47,6 +47,8 @@ struct xe_gpu_scheduler {
        const struct xe_sched_backend_ops       *ops;
        /** @msgs: list of messages to be processed in @work_process_msg */
        struct list_head                        msgs;
+       /** @msg_lock: Message lock */
+       spinlock_t                              msg_lock;
        /** @work_process_msg: processes messages */
        struct work_struct              work_process_msg;
 };