[PATCH] drm/ttm: never consider pinned BOs for eviction&swap

Alex Deucher alexdeucher at gmail.com
Fri Jul 7 13:55:26 UTC 2023


On Fri, Jul 7, 2023 at 8:08 AM Christian König
<ckoenig.leichtzumerken at gmail.com> wrote:
>
> There is a small window where we have already incremented the pin count
> but not yet moved the bo from the lru to the pinned list.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>

Acked-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/ttm/ttm_bo.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 1a1cfd675cc4..7139a522b2f3 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -517,6 +517,12 @@ static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo,
>  {
>         bool ret = false;
>
> +       if (bo->pin_count) {
> +               *locked = false;
> +               *busy = false;
> +               return false;
> +       }
> +
>         if (bo->base.resv == ctx->resv) {
>                 dma_resv_assert_held(bo->base.resv);
>                 if (ctx->allow_res_evict)
> --
> 2.34.1
>


More information about the dri-devel mailing list