[PATCH 01/13] drm/xe/sa: Always call drm_suballoc_manager_fini()

Matthew Brost matthew.brost at intel.com
Thu Dec 12 03:03:29 UTC 2024


On Thu, Dec 12, 2024 at 02:01:29AM +0100, Michal Wajdeczko wrote:
> After successful call to drm_suballoc_manager_init() we should
> make sure to call drm_suballoc_manager_fini() as it may include
> some cleanup code even if we didn't start using it for real.
> 
> As we can abort init() early due to kvzalloc() failure, we should
> either explicitly call drm_suballoc_manager_fini() or, even better,
> postpone drm_suballoc_manager_init() once we finish all other
> preparation steps, so we can rely on fini() that will do cleanup.
> 
> 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_sa.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
> index e055bed7ae55..4e7aba445ebc 100644
> --- a/drivers/gpu/drm/xe/xe_sa.c
> +++ b/drivers/gpu/drm/xe/xe_sa.c
> @@ -57,8 +57,6 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
>  	}
>  	sa_manager->bo = bo;
>  	sa_manager->is_iomem = bo->vmap.is_iomem;
> -
> -	drm_suballoc_manager_init(&sa_manager->base, managed_size, align);
>  	sa_manager->gpu_addr = xe_bo_ggtt_addr(bo);
>  
>  	if (bo->vmap.is_iomem) {
> @@ -72,6 +70,7 @@ struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32
>  		memset(sa_manager->cpu_ptr, 0, bo->ttm.base.size);
>  	}
>  
> +	drm_suballoc_manager_init(&sa_manager->base, managed_size, align);
>  	ret = drmm_add_action_or_reset(&xe->drm, xe_sa_bo_manager_fini,
>  				       sa_manager);
>  	if (ret)
> -- 
> 2.47.1
> 


More information about the Intel-xe mailing list