[PATCH] drm/ttm: fix bulk move handling during resource init
Christian König
ckoenig.leichtzumerken at gmail.com
Thu Jun 2 15:47:34 UTC 2022
The resource must be on the LRU before ttm_lru_bulk_move_add() is called.
Signed-off-by: Christian König <christian.koenig at amd.com>
---
drivers/gpu/drm/ttm/ttm_resource.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/ttm/ttm_resource.c b/drivers/gpu/drm/ttm/ttm_resource.c
index 65889b3caf50..928b9140f3c5 100644
--- a/drivers/gpu/drm/ttm/ttm_resource.c
+++ b/drivers/gpu/drm/ttm/ttm_resource.c
@@ -169,15 +169,17 @@ void ttm_resource_init(struct ttm_buffer_object *bo,
res->bus.is_iomem = false;
res->bus.caching = ttm_cached;
res->bo = bo;
- INIT_LIST_HEAD(&res->lru);
man = ttm_manager_type(bo->bdev, place->mem_type);
spin_lock(&bo->bdev->lru_lock);
man->usage += res->num_pages << PAGE_SHIFT;
- if (bo->bulk_move)
+ if (bo->bulk_move) {
+ list_add_tail(&res->lru, &man->lru[bo->priority]);
ttm_lru_bulk_move_add(bo->bulk_move, res);
- else
+ } else {
+ INIT_LIST_HEAD(&res->lru);
ttm_resource_move_to_lru_tail(res);
+ }
spin_unlock(&bo->bdev->lru_lock);
}
EXPORT_SYMBOL(ttm_resource_init);
--
2.25.1
More information about the amd-gfx
mailing list