[PATCH 2/2] drm/amdgpu: call ras_debugfs_create_all in debugfs_init

Zhou1, Tao Tao.Zhou1 at amd.com
Mon Mar 9 10:15:28 UTC 2020


[AMD Public Use]

We already have amdgpu_ras_debugfs_remove and amdgpu_ras_debugfs_remove_all.
In fact, amdgpu_debugfs_fini has been dropped in the patch below, and we are also planning to delete amdgpu_ras_debugfs_remove and amdgpu_ras_debugfs_remove_all.

drm/amdgpu: no need to clean debugfs at amdgpu

drm_minor_unregister will invoke drm_debugfs_cleanup
to clean all the child node under primary minor node.
We don't need to invoke amdgpu_debugfs_fini and
amdgpu_debugfs_regs_cleanup to clean agian.
Otherwise, it will raise the NULL pointer like below.

v2: remove all debugfs cleanup/fini code at amdgpu

Signed-off-by: Yintian Tao <yttao at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

Regards,
Tao

> -----Original Message-----
> From: Chen, Guchun <Guchun.Chen at amd.com>
> Sent: 2020年3月9日 17:21
> To: Yang, Stanley <Stanley.Yang at amd.com>; amd-gfx at lists.freedesktop.org
> Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Li, Dennis
> <Dennis.Li at amd.com>; Clements, John <John.Clements at amd.com>; Zhou1,
> Tao <Tao.Zhou1 at amd.com>; Yang, Stanley <Stanley.Yang at amd.com>
> Subject: RE: [PATCH 2/2] drm/amdgpu: call ras_debugfs_create_all in
> debugfs_init
> 
> [AMD Public Use]
> 
> Shall we need other codes to remove ras debugfs in debugfs_fini to avoid
> leak?
> 
> Regards,
> Guchun
> 
> -----Original Message-----
> From: Stanley.Yang <Stanley.Yang at amd.com>
> Sent: Monday, March 9, 2020 5:12 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Zhang, Hawking <Hawking.Zhang at amd.com>; Chen, Guchun
> <Guchun.Chen at amd.com>; Li, Dennis <Dennis.Li at amd.com>; Clements,
> John <John.Clements at amd.com>; Zhou1, Tao <Tao.Zhou1 at amd.com>;
> Yang, Stanley <Stanley.Yang at amd.com>
> Subject: [PATCH 2/2] drm/amdgpu: call ras_debugfs_create_all in
> debugfs_init
> 
> From: Tao Zhou <tao.zhou1 at amd.com>
> 
> and remove each ras IP's own debugfs creation
> 
> Signed-off-by: Tao Zhou <tao.zhou1 at amd.com>
> Signed-off-by: Stanley.Yang <Stanley.Yang at amd.com>
> Change-Id: If3d16862afa0d97abad183dd6e60478b34029e95
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c     | 1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c   | 1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c    | 1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c     | 5 -----
>  drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c    | 1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c     | 1 -
>  drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c    | 1 -
>  8 files changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index deca6343d0cc..1d513e4f9934 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1315,6 +1315,7 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_ib_preempt,
> NULL,  DEFINE_SIMPLE_ATTRIBUTE(fops_sclk_set, NULL,
>  			amdgpu_debugfs_sclk_set, "%llu\n");
> 
> +extern void amdgpu_ras_debugfs_create_all(struct amdgpu_device *adev);
>  int amdgpu_debugfs_init(struct amdgpu_device *adev)  {
>  	int r, i;
> @@ -1387,6 +1388,8 @@ int amdgpu_debugfs_init(struct amdgpu_device
> *adev)
>  		}
>  	}
> 
> +	amdgpu_ras_debugfs_create_all(adev);
> +
>  	return amdgpu_debugfs_add_files(adev, amdgpu_debugfs_list,
>  					ARRAY_SIZE(amdgpu_debugfs_list));
>  }
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> index 7403588684b3..d12bb4a35780 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
> @@ -565,7 +565,6 @@ int amdgpu_gfx_ras_late_init(struct amdgpu_device
> *adev)
>  	int r;
>  	struct ras_fs_if fs_info = {
>  		.sysfs_name = "gfx_err_count",
> -		.debugfs_name = "gfx_err_inject",
>  	};
>  	struct ras_ih_if ih_info = {
>  		.cb = amdgpu_gfx_process_ras_data_cb, diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> index 676c48c02d77..ead3dc572ec5 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mmhub.c
> @@ -32,7 +32,6 @@ int amdgpu_mmhub_ras_late_init(struct
> amdgpu_device *adev)
>  	};
>  	struct ras_fs_if fs_info = {
>  		.sysfs_name = "mmhub_err_count",
> -		.debugfs_name = "mmhub_err_inject",
>  	};
> 
>  	if (!adev->mmhub.ras_if) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> index 7d5c3a9de9ea..6201a5f4b4fa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.c
> @@ -30,7 +30,6 @@ int amdgpu_nbio_ras_late_init(struct amdgpu_device
> *adev)
>  	};
>  	struct ras_fs_if fs_info = {
>  		.sysfs_name = "pcie_bif_err_count",
> -		.debugfs_name = "pcie_bif_err_inject",
>  	};
> 
>  	if (!adev->nbio.ras_if) {
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> index 422cdd1ce3ad..57af4ea8fb58 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
> @@ -1178,7 +1178,6 @@ static void
> amdgpu_ras_debugfs_remove_all(struct amdgpu_device *adev)  static int
> amdgpu_ras_fs_init(struct amdgpu_device *adev)  {
>  	amdgpu_ras_sysfs_create_feature_node(adev);
> -	amdgpu_ras_debugfs_create_ctrl_node(adev);
> 
>  	return 0;
>  }
> @@ -1882,8 +1881,6 @@ int amdgpu_ras_late_init(struct amdgpu_device
> *adev,
>  			goto interrupt;
>  	}
> 
> -	amdgpu_ras_debugfs_create(adev, fs_info);
> -
>  	r = amdgpu_ras_sysfs_create(adev, fs_info);
>  	if (r)
>  		goto sysfs;
> @@ -1892,7 +1889,6 @@ int amdgpu_ras_late_init(struct amdgpu_device
> *adev,
>  cleanup:
>  	amdgpu_ras_sysfs_remove(adev, ras_block);
>  sysfs:
> -	amdgpu_ras_debugfs_remove(adev, ras_block);
>  	if (ih_info->cb)
>  		amdgpu_ras_interrupt_remove_handler(adev, ih_info);
>  interrupt:
> @@ -1909,7 +1905,6 @@ void amdgpu_ras_late_fini(struct amdgpu_device
> *adev,
>  		return;
> 
>  	amdgpu_ras_sysfs_remove(adev, ras_block);
> -	amdgpu_ras_debugfs_remove(adev, ras_block);
>  	if (ih_info->cb)
>                  amdgpu_ras_interrupt_remove_handler(adev, ih_info);
>  	amdgpu_ras_feature_enable(adev, ras_block, 0); diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> index 7854c053e85d..250a309e4dee 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> @@ -93,7 +93,6 @@ int amdgpu_sdma_ras_late_init(struct amdgpu_device
> *adev,
>  	struct ras_ih_if *ih_info = (struct ras_ih_if *)ras_ih_info;
>  	struct ras_fs_if fs_info = {
>  		.sysfs_name = "sdma_err_count",
> -		.debugfs_name = "sdma_err_inject",
>  	};
> 
>  	if (!ih_info)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> index f4d40855147b..9dd51f0d2c11 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
> @@ -28,7 +28,6 @@ int amdgpu_umc_ras_late_init(struct amdgpu_device
> *adev)
>  	int r;
>  	struct ras_fs_if fs_info = {
>  		.sysfs_name = "umc_err_count",
> -		.debugfs_name = "umc_err_inject",
>  	};
>  	struct ras_ih_if ih_info = {
>  		.cb = amdgpu_umc_process_ras_data_cb, diff --git
> a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> index a54ce398ed77..0837f872741b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
> @@ -598,7 +598,6 @@ int amdgpu_xgmi_ras_late_init(struct
> amdgpu_device *adev)
>  	};
>  	struct ras_fs_if fs_info = {
>  		.sysfs_name = "xgmi_wafl_err_count",
> -		.debugfs_name = "xgmi_wafl_err_inject",
>  	};
> 
>  	if (!adev->gmc.xgmi.supported ||
> --
> 2.17.1


More information about the amd-gfx mailing list