[PATCH] drm/ttm: fix pipelined gutting

Thomas Hellström thomas.hellstrom at linux.intel.com
Tue Jun 8 08:12:31 UTC 2021


On 6/8/21 9:50 AM, Christian König wrote:
> We need to make sure to allocate the sys_mem resource before the point
> of no return.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo_util.c | 22 ++++++++++++++++------
>   1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
> index 9be6a10a5873..eccf2ad8f335 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo_util.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
> @@ -582,6 +582,7 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
>   {
>   	static const struct ttm_place sys_mem = { .mem_type = TTM_PL_SYSTEM };
>   	struct ttm_buffer_object *ghost;
> +	struct ttm_resource *sys_res;
>   	struct ttm_tt *ttm;
>   	int ret;
>   
> @@ -602,6 +603,9 @@ int ttm_bo_pipeline_gutting(struct ttm_buffer_object *bo)
>   		return ttm_resource_alloc(bo, &sys_mem, &bo->resource);
>   	}
>   
> +
> +	ret = ttm_resource_alloc(bo, &sys_mem, &sys_res);

This needs to be moved higher up to also cover the idle optimization path.
Also the return value doesn't seem to be checked?

/Thomas




More information about the dri-devel mailing list