[PATCH 1/1] drm/amdgpu: return early if debugfs is not initialized

Lazar, Lijo lijo.lazar at amd.com
Wed Oct 6 11:55:46 UTC 2021



On 10/6/2021 3:21 PM, Nirmoy Das wrote:
> Check first if debugfs is initialized before creating
> amdgpu debugfs files.
> 
> References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686
> Signed-off-by: Nirmoy Das <nirmoy.das at amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
>   1 file changed, 3 insertions(+)
> 

Sorry about another miss. There is one other option added in the patch.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a24c6f7bc923d5e2f3139855eb09b0d480d6b410

"
config DEBUG_FS_DISALLOW_MOUNT
	bool "Do not register debugfs as filesystem"
	help
	  The API is open but filesystem is not loaded. Clients can still do 
their work and read with debug tools that do not need debugfs filesystem.
"

This doesn't work under this mode. Guess, we are not worried about this.

Reviewed-by: Lijo Lazar <lijo.lazar at amd.com>

Thanks,
Lijo

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> index 6611b3c7c149..5497e2d31d1a 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
> @@ -1617,6 +1617,9 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
>   	struct dentry *ent;
>   	int r, i;
>   
> +	if (!debugfs_initialized())
> +		return 0;
> +
>   	ent = debugfs_create_file("amdgpu_preempt_ib", 0600, root, adev,
>   				  &fops_ib_preempt);
>   	if (IS_ERR(ent)) {
> 


More information about the amd-gfx mailing list