Commit e70f43c2 authored by Matthew Brost's avatar Matthew Brost
Browse files

drm/xe: Add dedicated message lock



Stop abusing DRM scheduler job list lock for messages, add dedicated
message lock.

Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
Acked-by: default avatarPhilipp Stanner <phasta@kernel.org>
Link: https://patch.msgid.link/20260110012739.2888434-2-matthew.brost@intel.com
parent 98466abe
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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);
+2 −2
Original line number Diff line number Diff line
@@ -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)
+2 −0
Original line number Diff line number Diff line
@@ -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;
};