All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: fix bulk move handling during resource init
@ 2022-06-02 15:47 Christian König
  2022-06-02 16:15 ` Luben Tuikov
  2022-06-02 16:54 ` Alex Deucher
  0 siblings, 2 replies; 7+ messages in thread
From: Christian König @ 2022-06-02 15:47 UTC (permalink / raw)
  To: amd-gfx, Arunpravin.PaneerSelvam

The resource must be on the LRU before ttm_lru_bulk_move_add() is called.

Signed-off-by: Christian König <christian.koenig@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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-02 19:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02 15:47 [PATCH] drm/ttm: fix bulk move handling during resource init Christian König
2022-06-02 16:15 ` Luben Tuikov
2022-06-02 16:54 ` Alex Deucher
2022-06-02 18:08   ` Mike Lothian
2022-06-02 18:11     ` Mike Lothian
2022-06-02 18:55     ` Christian König
2022-06-02 19:02       ` Mike Lothian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.