[Intel-xe] [PATCH v2 4/6] drm/xe/bo: Gracefully handle errors from ttm_bo_move_accel_cleanup().

Matthew Brost matthew.brost at intel.com
Wed Jun 21 22:22:56 UTC 2023


On Mon, Jun 19, 2023 at 05:22:20PM +0200, Thomas Hellström wrote:
> The function ttm_bo_move_accel_cleanup() attempts to help pipeline a
> move, and in doing so, needs memory allocations which may fail.
> 
> Rather than failing in a state where the new resource may freed while
> accessed by the copy engine, sync uninterruptible and do a failsafe
> cleanup.
> 
> v2:
> - Don't try to attach the signaled fence on ttm_bo_move_accel_cleanup()
>   error.
> 
> Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>

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

> ---
>  drivers/gpu/drm/xe/xe_bo.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c
> index cfbcc071f2ef..c95fedc22fdf 100644
> --- a/drivers/gpu/drm/xe/xe_bo.c
> +++ b/drivers/gpu/drm/xe/xe_bo.c
> @@ -700,6 +700,11 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict,
>  		if (!move_lacks_source) {
>  			ret = ttm_bo_move_accel_cleanup(ttm_bo, fence, evict,
>  							true, new_mem);
> +			if (ret) {
> +				dma_fence_wait(fence, false);
> +				ttm_bo_move_null(ttm_bo, new_mem);
> +				ret = 0;
> +			}
>  		} else {
>  			/*
>  			 * ttm_bo_move_accel_cleanup() may blow up if
> -- 
> 2.40.1
> 


More information about the Intel-xe mailing list