All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lang Yu <lang.yu@amd.com>
To: <amd-gfx@lists.freedesktop.org>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>,
	Christian K nig <C3B6christian.koenig@amd.com>,
	Huang Rui <ray.huang@amd.com>, Lang Yu <lang.yu@amd.com>
Subject: [PATCH] drm/kfd: fix ttm_bo_release warning
Date: Thu, 23 Sep 2021 17:44:05 +0800	[thread overview]
Message-ID: <20210923094405.144613-1-lang.yu@amd.com> (raw)

If a BO is pinned, unpin it before freeing it.

Call Trace:
	ttm_bo_put+0x30/0x50 [ttm]
	amdgpu_bo_unref+0x1e/0x30 [amdgpu]
	amdgpu_gem_object_free+0x34/0x50 [amdgpu]
	drm_gem_object_free+0x1d/0x30 [drm]
	amdgpu_amdkfd_gpuvm_free_memory_of_gpu+0x31f/0x3a0 [amdgpu]
	kfd_process_device_free_bos+0xa3/0xf0 [amdgpu]
	kfd_process_wq_release+0x224/0x2e0 [amdgpu]
	process_one_work+0x220/0x3c0
	worker_thread+0x4d/0x3f0
	kthread+0x114/0x150
	process_one_work+0x3c0/0x3c0
	kthread_park+0x90/0x90
	ret_from_fork+0x22/0x30

Signed-off-by: Lang Yu <lang.yu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 2d6b2d77b738..7e693b064072 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1567,6 +1567,9 @@ int amdgpu_amdkfd_gpuvm_free_memory_of_gpu(
 	pr_debug("Release VA 0x%llx - 0x%llx\n", mem->va,
 		mem->va + bo_size * (1 + mem->aql_queue));
 
+	if (mem->bo->tbo.pin_count)
+		amdgpu_bo_unpin(mem->bo);
+
 	ret = unreserve_bo_and_vms(&ctx, false, false);
 
 	/* Remove from VM internal data structures */
-- 
2.25.1


             reply	other threads:[~2021-09-23  9:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23  9:44 Lang Yu [this message]
2021-09-23 11:39 ` [PATCH] drm/kfd: fix ttm_bo_release warning Christian König
2021-09-23 12:09   ` Yu, Lang
2021-09-23 12:23     ` Christian König
2021-09-23 14:24       ` Yu, Lang
2021-09-23 14:52         ` Christian König
2021-09-24  5:35           ` Yu, Lang
2021-09-24  5:42             ` Christian König
2021-09-24  5:50               ` Yu, Lang
2021-09-24  5:54                 ` Christian König
2021-09-24  6:34                   ` Yu, Lang
2021-09-24  6:37                     ` Christian König
2021-09-24 10:37                       ` Yu, Lang
2021-09-23 16:21     ` Felix Kuehling
2021-09-24  5:35       ` Yu, Lang

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=20210923094405.144613-1-lang.yu@amd.com \
    --to=lang.yu@amd.com \
    --cc=C3B6christian.koenig@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=ray.huang@amd.com \
    /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.