diff mbox series

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

Message ID 20230707120826.3701-1-christian.koenig@amd.com (mailing list archive)
State New, archived
Headers show
Series drm/ttm: never consider pinned BOs for eviction&swap | expand

Commit Message

Christian König July 7, 2023, 12:08 p.m. UTC
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@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Alex Deucher July 7, 2023, 1:55 p.m. UTC | #1
On Fri, Jul 7, 2023 at 8:08 AM Christian König
<ckoenig.leichtzumerken@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@amd.com>

Acked-by: Alex Deucher <alexander.deucher@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
>
diff mbox series

Patch

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)