Ok in this case I don't think we should do anything here. That we can't rmmod the driver on pre 4.11 is a bit annoying, but doesn't affect the upstream driver. Christian. Am 15.08.2017 um 05:00 schrieb Wang, Annie: > Hi Christian, > > Yes. drm_debugfs_cleanup() should delete all the files, after the following commit. > > commit 086f2e5cde747dcae800b2d8b0ac7741a8c6fcbe > Author: Noralf Trønnes <noralf at tronnes.org> > Date: Thu Jan 26 23:56:03 2017 +0100 > > drm: debugfs: Remove all files automatically on cleanup > > Instead of having the drivers call drm_debugfs_remove_files() in > their drm_driver->debugfs_cleanup hook, do it automatically by > traversing minor->debugfs_list. > Also use debugfs_remove_recursive() so drivers who add their own > debugfs files don't have to keep track of them for removal. > > Signed-off-by: Noralf Trønnes <noralf at tronnes.org> > Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch> > Link: http://patchwork.freedesktop.org/patch/msgid/20170126225621.12314-2-noralf at tronnes.org > > > Kernel before 4.11 don't clean debugfs files automatically. > >> -----Original Message----- >> From: Christian König [mailto:deathsimple at vodafone.de] >> Sent: Friday, August 11, 2017 4:15 PM >> To: Wang, Annie <Annie.Wang at amd.com>; Alex Deucher >> <alexdeucher at gmail.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 >> >> Hi Annie, >> >> well something is clearly not working as expected here. >> >> All those files are registered with drm_debugfs_create_files() and should >> automatically be removed when drm_debugfs_cleanup() is called. >> >> Can you figure out what is going wrong here? >> >> Thanks, >> Christian. >> >> Am 11.08.2017 um 04:25 schrieb Wang, Annie: >>> 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 >>> _______________________________________________ >>> amd-gfx mailing list >>> amd-gfx at lists.freedesktop.org >>> https://lists.freedesktop.org/mailman/listinfo/amd-gfx