All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: amd-gfx@lists.freedesktop.org, Arunpravin.PaneerSelvam@amd.com
Subject: [PATCH] drm/ttm: fix bulk move handling during resource init
Date: Thu,  2 Jun 2022 17:47:34 +0200	[thread overview]
Message-ID: <20220602154734.7854-1-christian.koenig@amd.com> (raw)

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


             reply	other threads:[~2022-06-02 15:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 15:47 Christian König [this message]
2022-06-02 16:15 ` [PATCH] drm/ttm: fix bulk move handling during resource init 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220602154734.7854-1-christian.koenig@amd.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Arunpravin.PaneerSelvam@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.