[PATCH 3/5] drm/xe: Add xe_sched_add_msg_locked helper
Cavitt, Jonathan
jonathan.cavitt at intel.com
Fri Aug 9 20:47:14 UTC 2024
-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Matthew Brost
Sent: Friday, August 9, 2024 12:19 PM
To: intel-xe at lists.freedesktop.org
Cc: Dugast, Francois <francois.dugast at intel.com>
Subject: [PATCH 3/5] drm/xe: Add xe_sched_add_msg_locked helper
>
> Will help by allowing callers to own message locking.
>
> Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> ---
> drivers/gpu/drm/xe/xe_gpu_scheduler.c | 9 ++++++++-
> drivers/gpu/drm/xe/xe_gpu_scheduler.h | 2 ++
> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.c b/drivers/gpu/drm/xe/xe_gpu_scheduler.c
> index 1c703e8423de..c518d1d16d82 100644
> --- a/drivers/gpu/drm/xe/xe_gpu_scheduler.c
> +++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.c
> @@ -94,8 +94,15 @@ void xe_sched_add_msg(struct xe_gpu_scheduler *sched,
> struct xe_sched_msg *msg)
> {
> xe_sched_msg_lock(sched);
> - list_add_tail(&msg->link, &sched->msgs);
> + xe_sched_add_msg_locked(sched, msg);
> xe_sched_msg_unlock(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);
> +
> + list_add_tail(&msg->link, &sched->msgs);
> xe_sched_process_msg_queue(sched);
> }
IMO it might make sense to move this function above
xe_sched_add_msg for style reasons, as xe_sched_add_msg
now uses xe_sched_add_msg_locked. But I won't block on
such a change.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt
> diff --git a/drivers/gpu/drm/xe/xe_gpu_scheduler.h b/drivers/gpu/drm/xe/xe_gpu_scheduler.h
> index a54038fb3094..cee9c6809fc0 100644
> --- a/drivers/gpu/drm/xe/xe_gpu_scheduler.h
> +++ b/drivers/gpu/drm/xe/xe_gpu_scheduler.h
> @@ -24,6 +24,8 @@ 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);
> +void xe_sched_add_msg_locked(struct xe_gpu_scheduler *sched,
> + struct xe_sched_msg *msg);
>
> static inline void xe_sched_msg_lock(struct xe_gpu_scheduler *sched)
> {
> --
> 2.34.1
>
>
More information about the Intel-xe
mailing list