[Public] Hi Christian
I ping Leslie offline with no response. How about this patch. Looks like more reasonable to put doorbell_fini with mem_scratch_fini/ free_static_csa together. diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index d4b01ef00025..ff48096c1d80 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -3508,6 +3508,7 @@ static int amdgpu_device_ip_fini(struct amdgpu_device *adev) amdgpu_device_mem_scratch_fini(adev); amdgpu_ib_pool_fini(adev); amdgpu_seq64_fini(adev); + amdgpu_doorbell_fini(adev); } if (adev->ip_blocks[i].version->funcs->sw_fini) { r = adev->ip_blocks[i].version->funcs->sw_fini(&adev->ip_blocks[i]); @@ -4851,7 +4852,6 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) iounmap(adev->rmmio); adev->rmmio = NULL; - amdgpu_doorbell_fini(adev); drm_dev_exit(idx); } Best, Zhenguo Cloud-GPU Core team, SRDC -----Original Message----- From: Yin, ZhenGuo (Chris) Sent: Tuesday, April 1, 2025 11:41 AM To: Koenig, Christian <christian.koe...@amd.com>; amd-gfx@lists.freedesktop.org; Shi, Leslie <yuliang....@amd.com> Cc: Sharma, Shashank <shashank.sha...@amd.com>; Deucher, Alexander <alexander.deuc...@amd.com> Subject: RE: [PATCH] drm/amdgpu: fix warning of drm_mm_clean Hi Leslie Any comment on this? Looks like you add this code 3 years ago on patch: drm/amdgpu: Unmap MMIO mappings when device is not unplugged Best, Zhenguo Cloud-GPU Core team, SRDC -----Original Message----- From: Koenig, Christian <christian.koe...@amd.com> Sent: Monday, March 31, 2025 8:07 PM To: Yin, ZhenGuo (Chris) <zhenguo....@amd.com>; amd-gfx@lists.freedesktop.org Cc: Sharma, Shashank <shashank.sha...@amd.com>; Deucher, Alexander <alexander.deuc...@amd.com> Subject: Re: [PATCH] drm/amdgpu: fix warning of drm_mm_clean Am 31.03.25 um 13:26 schrieb ZhenGuo Yin: > Kernel doorbell BOs needs to be freed before ttm_fini. Good catch, but does anybody remember why we have the drm_dev_enter()/drm_dev_exit() here? It's clearly for hotplug, but it doesn't make sense to have the amdgpu_doorbell_fini() under it as far as I can see. Regards, Christian. > > Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages") > Signed-off-by: ZhenGuo Yin <zhenguo....@amd.com> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index d4b01ef00025..b49604ade6c2 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -4807,6 +4807,13 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) > int i, idx; > bool px; > > + if (drm_dev_enter(adev_to_drm(adev), &idx)) { > + iounmap(adev->rmmio); > + adev->rmmio = NULL; > + amdgpu_doorbell_fini(adev); > + drm_dev_exit(idx); > + } > + > amdgpu_device_ip_fini(adev); > amdgpu_fence_driver_sw_fini(adev); > amdgpu_ucode_release(&adev->firmware.gpu_info_fw); > @@ -4847,14 +4854,6 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) > if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) > vga_client_unregister(adev->pdev); > > - if (drm_dev_enter(adev_to_drm(adev), &idx)) { > - > - iounmap(adev->rmmio); > - adev->rmmio = NULL; > - amdgpu_doorbell_fini(adev); > - drm_dev_exit(idx); > - } > - > if (IS_ENABLED(CONFIG_PERF_EVENTS)) > amdgpu_pmu_fini(adev); > if (adev->mman.discovery_bin)