<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2024-09-04 04:04, Asher Song wrote:<br>
</div>
<blockquote type="cite" cite="mid:20240904080420.559277-1-Asher.Song@amd.com">
<pre class="moz-quote-pre" wrap="">In some APUs, the bo type of GART page table is ttm_bo_type_sg.
Those type BOs is released by bo->delayed_delete which is added in ttm_device->wq, not released immediately.
To make sure all the ttm_resource is released before ttm_resource_manager is finilized, drain the workqueue in ttm_device.
v2: move drain_workqueue to amdgpu_ttm.c
Fixes:d99fbd9aab62 ("drm/ttm: Always take the bo delayed cleanup path for imported bos")
Suggested-by: Christian König <a class="moz-txt-link-rfc2396E" href="mailto:christian.koenig@amd.com"><christian.koenig@amd.com></a>
Signed-off-by: Asher Song <a class="moz-txt-link-rfc2396E" href="mailto:Asher.Song@amd.com"><Asher.Song@amd.com></a></pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">Acked-by: Philip Yang <a class="moz-txt-link-rfc2396E" href="mailto:Philip.Yang@amd.com"><Philip.Yang@amd.com></a>
Most likely this will fix another bug caused by race condition b/w GPU mode 1 reset and delayed bo cleanup worker.
Thank you.
Philip
</pre>
<blockquote type="cite" cite="mid:20240904080420.559277-1-Asher.Song@amd.com">
<pre class="moz-quote-pre" wrap="">
---
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 5c938ff0bf48..cbac21df5c47 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -2461,6 +2461,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev)
drm_dev_exit(idx);
}
+ drain_workqueue(adev->mman.bdev.wq);
amdgpu_direct_gma_fini(adev);
amdgpu_vram_mgr_fini(adev);
amdgpu_gtt_mgr_fini(adev);
</pre>
</blockquote>
</body>
</html>