drm/amdgpu: fix a call trace when unload amdgpu driver
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix a call trace when unload amdgpu driver
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.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -0
@@ -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); }
Signature · 1 line
2.25.1
Quoted 10 lines · Asher Song
In some APUs, the bo type of GART page table is
ttm_bo_type_sg. Those type BOs is released bybo->delayed_deletewhich is added inttm_device->wq, not released immediately.To make sure all the
ttm_resourceis released beforettm_resource_manageris finilized, drain the workqueue inttm_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]>
Thanks,
Lijo
Quoted 16 lines
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0@@ -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); }
Christian König
maintainerAm 03.09.24 um 14:31 schrieb Asher Song:
Quoted 9 lines
In some APUs, the bo type of GART page table is
ttm_bo_type_sg. Those type BOs is released bybo->delayed_deletewhich is added inttm_device->wq, not released immediately.To make sure all the
ttm_resourceis released beforettm_resource_manageris finilized, drain the workqueue inttm_device.Fixes d99fbd9aab62 ("drm/ttm: Always take the bo delayed cleanup path for imported bos")Acked-by Christian König <[email protected]>
The correct tag is Suggested-by.
Quoted 10 lines
Signed-off-by Asher Song <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_fini(void *handle) · line 2219
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0@@ -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);
That is certainly incorrectly placed in the gmc_v9_0_sw_fini(). That should be somewhere in amdgpu_ttm.c
Regards,
Christian.
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0}else {amdgpu_gart_table_vram_free (adev); }
[AMD Official Use Only - AMD Internal Distribution Only]
On Tuesday, September 3, 2024 9:29 PM wrote by Koenig, Christian
Quoted 28 lines
Am 03.09.24 um 14:31 schrieb Asher Song:
Quoted 10 lines
In some APUs, the bo type of GART page table is
ttm_bo_type_sg. Those type BOs is released bybo->delayed_deletewhich is added inttm_device->wq, not released immediately.To make sure all the
ttm_resourceis released beforettm_resource_manageris finilized, drain the workqueue inttm_device.Fixes d99fbd9aab62 ("drm/ttm: Always take the bo delayed cleanup pathfor imported bos")
Acked-by Christian König <[email protected]>The correct tag is Suggested-by.
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_fini(void *handle) · line 2217
Quoted 13 lines
Signed-off-by Asher Song <[email protected]>--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + 1 file changed, 1 insertion(+)drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0@@ -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 APUfree\n");
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static int gmc_v9_0_sw_fini(void *handle) · line 2219
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0amdgpu_gart_table_ram_free (adev); +drain_workqueue (adev->mman.bdev.wq);That is certainly incorrectly placed in the
gmc_v9_0_sw_fini(). That should be somewhere inamdgpu_ttm.cRegards,
Christian.
Thank you. Will send v2 to place drain_workqueue in amdgpu_ttm.c
Best Regards,
Asher
Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0}else {amdgpu_gart_table_vram_free (adev); }