[PATCH] drm/amd/amdgpu: fix bug fail to remove debugfs when rmmod
Wang, Annie
Annie.Wang at amd.com
Fri Aug 11 02:25:31 UTC 2017
Hi Alex,
The following files are all left.
amdgpu_fence_info
amdgpu_firmware_info
amdgpu_gem_info
amdgpu_gpu_reset
amdgpu_gtt_mm
amdgpu_pm_info
amdgpu_sa_info
amdgpu_test_ib
amdgpu_vram_mm
ttm_dma_page_pool
ttm_page_pool
Instead of fini them separately, how about implement the callback function --- debugfs_fini.
.debugfs_fini = amdgpu_debugfs_cleanup,
And in the future I will send another patch to collect all the init function
.debugfs_init = amdgpu_debugfs_init,
>-----Original Message-----
>From: Alex Deucher [mailto:alexdeucher at gmail.com]
>Sent: Friday, August 11, 2017 1:01 AM
>To: Wang, Annie <Annie.Wang at amd.com>
>Cc: amd-gfx list <amd-gfx at lists.freedesktop.org>
>Subject: Re: [PATCH] drm/amd/amdgpu: fix bug fail to remove debugfs when
>rmmod
>
>On Thu, Aug 10, 2017 at 5:12 AM, Wang Hongcheng <Annie.Wang at amd.com>
>wrote:
>> Some debug files are forgotten to remove at fini. Remove them all in
>> pci_remove.
>>
>> BUG: SWDEV-129297
>
>What files are failing to get removed? I'd prefer to remove them in the relevant
>places in the code (to mirror where they are added) rather than generically
>cleaning everything up. Either that or unify all the debugfs init/fini stuff in one
>place.
>
>Alex
>
>>
>> Signed-off-by: Wang Hongcheng <Annie.Wang at amd.com>
>> ---
>> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 ++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 +++++++++++++++++++
>> drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 ++
>> 3 files changed, 23 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> index c28069e4..b542191 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>> @@ -1250,6 +1250,8 @@ struct amdgpu_debugfs { int
>> amdgpu_debugfs_add_files(struct amdgpu_device *adev,
>> const struct drm_info_list *files,
>> unsigned nfiles);
>> +int amdgpu_debugfs_cleanup(struct amdgpu_device *adev);
>> +
>> int amdgpu_debugfs_fence_init(struct amdgpu_device *adev);
>>
>> #if defined(CONFIG_DEBUG_FS)
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> index 7e40071..7594abb 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>> @@ -3215,6 +3215,25 @@ int amdgpu_debugfs_add_files(struct
>amdgpu_device *adev,
>> return 0;
>> }
>>
>> +int amdgpu_debugfs_cleanup(struct amdgpu_device *adev) {
>> + struct drm_info_node *node, *tmp;
>> +
>> + if (!&adev->ddev->primary->debugfs_root)
>> + return 0;
>> +
>> + mutex_lock(&adev->ddev->primary->debugfs_lock);
>> + list_for_each_entry_safe(node, tmp,
>> + &adev->ddev->primary->debugfs_list, list) {
>> + debugfs_remove(node->dent);
>> + list_del(&node->list);
>> + kfree(node);
>> + }
>> + mutex_unlock(&adev->ddev->primary->debugfs_lock);
>> +
>> + return 0;
>> +}
>> +
>> #if defined(CONFIG_DEBUG_FS)
>>
>> static ssize_t amdgpu_debugfs_regs_read(struct file *f, char __user
>> *buf, diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> index 13c91a6..4f5af93 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
>> @@ -594,7 +594,9 @@ static void
>> amdgpu_pci_remove(struct pci_dev *pdev) {
>> struct drm_device *dev = pci_get_drvdata(pdev);
>> + struct amdgpu_device *adev = dev->dev_private;
>>
>> + amdgpu_debugfs_cleanup(adev);
>> drm_dev_unregister(dev);
>> drm_dev_unref(dev);
>> }
>> --
>> 2.7.4
>>
>> _______________________________________________
>> amd-gfx mailing list
>> amd-gfx at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list