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.

Fixes:d99fbd9aab62 ("drm/ttm: Always take the bo delayed cleanup path for 
imported bos")
Acked-by: Christian König <[email protected]>
Signed-off-by: Asher Song <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c 
b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
index 0a5c8d97787a..99017e426618 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
@@ -2216,6 +2216,7 @@ static int gmc_v9_0_sw_fini(void *handle)
        if (!adev->gmc.real_vram_size) {
                dev_info(adev->dev, "Put GART in system memory for APU free\n");
                amdgpu_gart_table_ram_free(adev);
+               drain_workqueue(adev->mman.bdev.wq);
        } else {
                amdgpu_gart_table_vram_free(adev);
        }
-- 
2.25.1

Reply via email to