[PATCH] drm/amdkfd: Free gang_ctx_bo and wptr_bo in pqm_uninit

ZhenGuo Yin zhenguo.yin at amd.com
Mon Nov 6 10:40:07 UTC 2023


[Why]
There will be a warning trace when cleaning up the gtt
drm_mm allocator during unloading driver since gang_ctx_bo
and wptr_bo do not get freed.

[How]
Free gang_ctx_bo and wptr_bo in pqm_uninit.

Signed-off-by: ZhenGuo Yin <zhenguo.yin at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 77649392e233..fdb03b08df72 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -179,6 +179,14 @@ void pqm_uninit(struct process_queue_manager *pqm)
 		    !pqn->q->device->kfd->shared_resources.enable_mes)
 			amdgpu_amdkfd_remove_gws_from_process(pqm->process->kgd_process_info,
 				pqn->q->gws);
+
+		if (pqn->q->device->kfd->shared_resources.enable_mes) {
+			amdgpu_amdkfd_free_gtt_mem(pqn->q->device->kfd->adev,
+						   pqn->q->gang_ctx_bo);
+			if (pqn->q->wptr_bo)
+				amdgpu_amdkfd_free_gtt_mem(pqn->q->device->kfd->adev, pqn->q->wptr_bo);
+		}
+
 		kfd_procfs_del_queue(pqn->q);
 		uninit_queue(pqn->q);
 		list_del(&pqn->process_queue_list);
-- 
2.35.1



More information about the amd-gfx mailing list