Skip to contentSkip to conversation

drm/amdgpu: return early if debugfs is not initialized

PATCH In review Nirmoy Das 3 participants 4 messages Oct 6, 2021

Subsystems (2)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

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

Check first if debugfs is initialized before creating amdgpu debugfs files.

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -0
index 6611b3c7c149..5497e2d31d1a 100644
@@ -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)) {
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Nirmoy Das

Check first if debugfs is initialized before creating amdgpu debugfs files.

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686

---
  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.

Thanks,
Lijo

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +3 -0
index 6611b3c7c149..5497e2d31d1a 100644
@@ -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)) {
maintainer
#2 lore raw

Am 06.10.21 um 13:55 schrieb Lazar, Lijo:

Quoted 18 lines · Nirmoy Das
Quoted 9 lines

Check first if debugfs is initialized before creating amdgpu debugfs files.

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686

---
  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

Quoted 6 lines

"
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. "

I'm really wondering why it's useful to have debugfs enabled, but not mounted.

Quoted 4 lines

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

Anyway Reviewed-by: Christian König <[email protected]>

Quoted 19 lines

Thanks,
Lijo

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -0
index 6611b3c7c149..5497e2d31d1a 100644
@@ -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)) {

#3 lore raw
In reply to Lazar, Lijo
Quoted 18 lines · Lijo
Quoted 9 lines · Nirmoy Das

Check first if debugfs is initialized before creating amdgpu debugfs files.

References: https://gitlab.freedesktop.org/drm/amd/-/issues/1686

---
  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

Quoted 8 lines

"
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.

It does work with DEBUG_FS_DISALLOW_MOUNT. I tested it with that option.

Quoted 2 lines

Thanks,

Nimroy

Quoted 19 lines

Thanks,
Lijo

Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c +2 -0
index 6611b3c7c149..5497e2d31d1a 100644
@@ -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)) {