Skip to contentSkip to conversation

drm/amdgpu: Only create mes event log debugfs when mes is enabled

PATCH In review shaoyunl 2 participants 3 messages Jan 31, 2024 – Feb 1, 2024

Subsystems (2)
lore
Share & tools
lore

shaoyunl

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Only create mes event log debugfs when mes is enabled

Skip the debugfs file creation for mes event log if the GPU doesn't use MES. This to prevent potential kernel oops when user try to read the event log in debugfs on a GPU without MES

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -3
index 0626ac0192a8..dd2b8f3fa2f1 100644
@@ -1565,9 +1565,9 @@ void amdgpu_debugfs_mes_event_log_init(struct amdgpu_device *adev)
 #if defined(CONFIG_DEBUG_FS)
 	struct drm_minor *minor = adev_to_drm(adev)->primary;
 	struct dentry *root = minor->debugfs_root;
-
-	debugfs_create_file("amdgpu_mes_event_log", 0444, root,
-			    adev, &amdgpu_debugfs_mes_event_log_fops);
+	if (adev->enable_mes)
+		debugfs_create_file("amdgpu_mes_event_log", 0444, root,
+				    adev, &amdgpu_debugfs_mes_event_log_fops);
 
 #endif
 }
Signature · 1 line
2.34.1
#1 lore raw

[AMD Official Use Only - General]

ping

-----Original Message-----
From: Liu, Shaoyun <[email protected]>
Sent: Wednesday, January 31, 2024 9:26 AM
To: [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH] drm/amdgpu: Only create mes event log debugfs when mes is enabled

Skip the debugfs file creation for mes event log if the GPU doesn't use MES. This to prevent potential kernel oops when user try to read the event log in debugfs on a GPU without MES

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -4
index 0626ac0192a8..dd2b8f3fa2f1 100644
@@ -1565,9 +1565,9 @@ void amdgpu_debugfs_mes_event_log_init(struct amdgpu_device *adev)  #if defined(CONFIG_DEBUG_FS)
        struct drm_minor *minor = adev_to_drm(adev)->primary;
        struct dentry *root = minor->debugfs_root;
-
-       debugfs_create_file("amdgpu_mes_event_log", 0444, root,
-                           adev, &amdgpu_debugfs_mes_event_log_fops);
+       if (adev->enable_mes)
+               debugfs_create_file("amdgpu_mes_event_log", 0444, root,
+                                   adev, &amdgpu_debugfs_mes_event_log_fops);
 
 #endif
 }
--

2.34.1

#2 lore raw

[AMD Official Use Only - General]

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Liu, Shaoyun
Sent: Thursday, February 1, 2024 10:58 AM
To: [email protected]
Subject: RE: [PATCH] drm/amdgpu: Only create mes event log debugfs when mes is enabled

[AMD Official Use Only - General]

[AMD Official Use Only - General]

ping

-----Original Message-----
From: Liu, Shaoyun <[email protected]>
Sent: Wednesday, January 31, 2024 9:26 AM
To: [email protected]
Cc: Liu, Shaoyun <[email protected]>
Subject: [PATCH] drm/amdgpu: Only create mes event log debugfs when mes is enabled

Skip the debugfs file creation for mes event log if the GPU doesn't use MES. This to prevent potential kernel oops when user try to read the event log in debugfs on a GPU without MES

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +3 -4
index 0626ac0192a8..dd2b8f3fa2f1 100644
@@ -1565,9 +1565,9 @@ void amdgpu_debugfs_mes_event_log_init(struct amdgpu_device *adev)  #if defined(CONFIG_DEBUG_FS)
        struct drm_minor *minor = adev_to_drm(adev)->primary;
        struct dentry *root = minor->debugfs_root;
-
-       debugfs_create_file("amdgpu_mes_event_log", 0444, root,
-                           adev, &amdgpu_debugfs_mes_event_log_fops);
+       if (adev->enable_mes)
+               debugfs_create_file("amdgpu_mes_event_log", 0444, root,
+                                   adev, &amdgpu_debugfs_mes_event_log_fops);
 
 #endif
 }
--

2.34.1