[PATCH] drm/ttm: fix error handling if no BO can be swapped out v4

Zack Rusin zackr at vmware.com
Thu Apr 22 17:19:44 UTC 2021


On 4/22/21 7:57 AM, Christian König wrote:
> From: Shiwu Zhang <shiwu.zhang at amd.com>
> 
> In case that all pre-allocated BOs are busy, just continue to populate
> BOs since likely half of system memory in total is still free.
> 
> v4 (chk): fix code moved to VMWGFX as well
> 
> Signed-off-by: Shiwu Zhang <shiwu.zhang at amd.com>
> Reviewed-by: Christian König <christian.koenig at amd.com>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_device.c    | 2 +-
>   drivers/gpu/drm/ttm/ttm_tt.c        | 2 ++
>   drivers/gpu/drm/vmwgfx/ttm_memory.c | 2 +-
>   3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ttm/ttm_device.c b/drivers/gpu/drm/ttm/ttm_device.c
> index 1f2024164d72..5dc92b056f0a 100644
> --- a/drivers/gpu/drm/ttm/ttm_device.c
> +++ b/drivers/gpu/drm/ttm/ttm_device.c
> @@ -112,7 +112,7 @@ int ttm_global_swapout(struct ttm_operation_ctx *ctx, gfp_t gfp_flags)
>   {
>   	struct ttm_global *glob = &ttm_glob;
>   	struct ttm_device *bdev;
> -	int ret = -EBUSY;
> +	int ret = 0;

Looks good to me. Updating the comment above that function to note it returns either tge number of pages swapped out or an error might be a good idea because it's not obvious from the name.

Reviewed-by: Zack Rusin <zackr at vmware.com>


More information about the dri-devel mailing list