[PATCH] drm/amd/amdgpu: fix bug fail to remove debugfs when rmmod

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux