Skip to contentSkip to conversation

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

PATCH In review Christian König 2 participants 2 messages Jul 7, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/gpu/drm/ttm/ttm_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +6 -0
index 1a1cfd675cc4..7139a522b2f3 100644
@@ -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)
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Christian König

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.

Quoted 24 lines
---
 drivers/gpu/drm/ttm/ttm_bo.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/ttm/ttm_bo.c +6 -1
index 1a1cfd675cc4..7139a522b2f3 100644
@@ -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