]> Git Repo - linux.git/commitdiff
drm/xe: Add xe_sched_msg_lock/unlock helper
authorMatthew Brost <[email protected]>
Fri, 9 Aug 2024 19:19:25 +0000 (12:19 -0700)
committerMatthew Brost <[email protected]>
Sat, 10 Aug 2024 02:07:28 +0000 (19:07 -0700)
Will help callers to own locking when adding messages to scheduler.

Signed-off-by: Matthew Brost <[email protected]>
Reviewed-by: Jonathan Cavitt <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/xe/xe_gpu_scheduler.c
drivers/gpu/drm/xe/xe_gpu_scheduler.h

index e4ad1d6ce1d5ff8bb37906d0f7b587bd70bb2f3b..eea71c67cf2add135be3863de6a966288877f682 100644 (file)
@@ -15,11 +15,11 @@ static void xe_sched_process_msg_queue_if_ready(struct xe_gpu_scheduler *sched)
 {
        struct xe_sched_msg *msg;
 
-       spin_lock(&sched->base.job_list_lock);
+       xe_sched_msg_lock(sched);
        msg = list_first_entry_or_null(&sched->msgs, struct xe_sched_msg, link);
        if (msg)
                xe_sched_process_msg_queue(sched);
-       spin_unlock(&sched->base.job_list_lock);
+       xe_sched_msg_unlock(sched);
 }
 
 static struct xe_sched_msg *
@@ -27,12 +27,12 @@ xe_sched_get_msg(struct xe_gpu_scheduler *sched)
 {
        struct xe_sched_msg *msg;
 
-       spin_lock(&sched->base.job_list_lock);
+       xe_sched_msg_lock(sched);
        msg = list_first_entry_or_null(&sched->msgs,
                                       struct xe_sched_msg, link);
        if (msg)
                list_del(&msg->link);
-       spin_unlock(&sched->base.job_list_lock);
+       xe_sched_msg_unlock(sched);
 
        return msg;
 }
@@ -93,9 +93,9 @@ void xe_sched_submission_stop(struct xe_gpu_scheduler *sched)
 void xe_sched_add_msg(struct xe_gpu_scheduler *sched,
                      struct xe_sched_msg *msg)
 {
-       spin_lock(&sched->base.job_list_lock);
+       xe_sched_msg_lock(sched);
        list_add_tail(&msg->link, &sched->msgs);
-       spin_unlock(&sched->base.job_list_lock);
+       xe_sched_msg_unlock(sched);
 
        xe_sched_process_msg_queue(sched);
 }
index 10c6bb9c938681f1e1113501ffeec4b35bfdb4d0..a54038fb3094ec7b0e501be5db537f77701bb0e5 100644 (file)
@@ -25,6 +25,16 @@ void xe_sched_submission_stop(struct xe_gpu_scheduler *sched);
 void xe_sched_add_msg(struct xe_gpu_scheduler *sched,
                      struct xe_sched_msg *msg);
 
+static inline void xe_sched_msg_lock(struct xe_gpu_scheduler *sched)
+{
+       spin_lock(&sched->base.job_list_lock);
+}
+
+static inline void xe_sched_msg_unlock(struct xe_gpu_scheduler *sched)
+{
+       spin_unlock(&sched->base.job_list_lock);
+}
+
 static inline void xe_sched_stop(struct xe_gpu_scheduler *sched)
 {
        drm_sched_stop(&sched->base, NULL);
This page took 0.059381 seconds and 4 git commands to generate.