<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div>We don't need that.</div>
<div><br>
</div>
<div>TTM only reschedules when the BOs are still busy.</div>
<div><br>
</div>
<div>And if the BOs are still busy when you unload the driver we have much bigger problems that this TTM worker :)</div>
<div><br>
</div>
<div>Regards,</div>
<div>Christian</div>
<br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> Pan, Xinhui <Xinhui.Pan@amd.com><br>
<b>Gesendet:</b> Mittwoch, 13. April 2022 05:08<br>
<b>An:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; Koenig, Christian <Christian.Koenig@amd.com>; Pan, Xinhui <Xinhui.Pan@amd.com><br>
<b>Betreff:</b> [PATCH] drm/amdgpu: Make sure ttm delayed work finished</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">ttm_device_delayed_workqueue would reschedule itself if there is pending<br>
BO to be destroyed. So just one flush + cancel_sync is not enough. We<br>
still see lru_list not empty warnging.<br>
<br>
Fix it by waiting all BO to be destroyed.<br>
<br>
Signed-off-by: xinhui pan <xinhui.pan@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 10 ++++++++--<br>
1 file changed, 8 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
index 6f47726f1765..e249923eb9a7 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c<br>
@@ -3957,11 +3957,17 @@ static void amdgpu_device_unmap_mmio(struct amdgpu_device *adev)<br>
*/<br>
void amdgpu_device_fini_hw(struct amdgpu_device *adev)<br>
{<br>
+ int pending = 1;<br>
+<br>
dev_info(adev->dev, "amdgpu: finishing device.\n");<br>
flush_delayed_work(&adev->delayed_init_work);<br>
- if (adev->mman.initialized) {<br>
+ while (adev->mman.initialized && pending) {<br>
flush_delayed_work(&adev->mman.bdev.wq);<br>
- ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);<br>
+ pending = ttm_bo_lock_delayed_workqueue(&adev->mman.bdev);<br>
+ if (pending) {<br>
+ ttm_bo_unlock_delayed_workqueue(&adev->mman.bdev, true);<br>
+ msleep((HZ / 100) < 1) ? 1 : HZ / 100);<br>
+ }<br>
}<br>
adev->shutdown = true;<br>
<br>
-- <br>
2.25.1<br>
<br>
</div>
</span></font></div>
</body>
</html>