[PATCH 2/2] drm/xe/guc: Initialize GuC ID manager sooner

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


On Sat, Apr 06, 2024 at 04:39:46PM +0200, Michal Wajdeczko wrote:
> The GuC submission cleanup code may depend on the GuC ID manager,
> thus we can't initialize it after registering a submission cleanup
> action, as reverse cleanup sequence will destroy GuC ID manager
> prior to a call to guc_submit_fini().
> 
> Move GuC ID manager initialization up, right after managed mutex
> initialization, to have it available during guc_submit_fini().
> 
> 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 | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
> index 4c444fddfba6..61e7a8fbd18c 100644
> --- a/drivers/gpu/drm/xe/xe_guc_submit.c
> +++ b/drivers/gpu/drm/xe/xe_guc_submit.c
> @@ -266,6 +266,10 @@ int xe_guc_submit_init(struct xe_guc *guc)
>  	if (err)
>  		return err;
>  
> +	err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
> +	if (err)
> +		return err;
> +
>  	err = alloc_submit_wq(guc);
>  	if (err)
>  		return err;
> @@ -279,15 +283,7 @@ int xe_guc_submit_init(struct xe_guc *guc)
>  
>  	primelockdep(guc);
>  
> -	err = drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);
> -	if (err)
> -		return err;
> -
> -	err = xe_guc_id_mgr_init(&guc->submission_state.idm, ~0);
> -	if (err)
> -		return err;
> -
> -	return 0;
> +	return drmm_add_action_or_reset(&xe->drm, guc_submit_fini, guc);
>  }
>  
>  static void __release_guc_id(struct xe_guc *guc, struct xe_exec_queue *q, u32 xa_count)
> -- 
> 2.43.0
> 


More information about the Intel-xe mailing list