[PATCH 1/2] drm/xe/guc: Use drm_device-managed version of mutex_init()

Matthew Brost matthew.brost at intel.com
Sat Apr 6 18:23:31 UTC 2024


On Sat, Apr 06, 2024 at 04:39:45PM +0200, Michal Wajdeczko wrote:
> This is safer approach and will help resolve a cleanup ordering
> conflict related to the GuC ID manager.
> 
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Matthew Brost <matthew.brost at intel.com>

Reviewed-by: Matthew Brost <matthew.brost at intel.com>

> ---
>  drivers/gpu/drm/xe/xe_guc_submit.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 9c30bd9ac8c0..4c444fddfba6 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -238,7 +238,6 @@ static void guc_submit_fini(struct drm_device *drm, void *arg)
>  
>  	xa_destroy(&guc->submission_state.exec_queue_lookup);
>  	free_submit_wq(guc);
> -	mutex_destroy(&guc->submission_state.lock);
>  }
>  
>  static const struct xe_exec_queue_ops guc_exec_queue_ops;
> @@ -263,13 +262,16 @@ int xe_guc_submit_init(struct xe_guc *guc)
>  	struct xe_gt *gt = guc_to_gt(guc);
>  	int err;
>  
> +	err = drmm_mutex_init(&xe->drm, &guc->submission_state.lock);
> +	if (err)
> +		return err;
> +
>  	err = alloc_submit_wq(guc);
>  	if (err)
>  		return err;
>  
>  	gt->exec_queue_ops = &guc_exec_queue_ops;
>  
> -	mutex_init(&guc->submission_state.lock);
>  	xa_init(&guc->submission_state.exec_queue_lookup);
>  
>  	spin_lock_init(&guc->submission_state.suspend.lock);
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list