[AMD Official Use Only - General]

Reviewed-by: Harish Kasiviswanathan <harish.kasiviswanat...@amd.com>

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

[AMD Official Use Only - General]

[AMD Official Use Only - General]


-----Original Message-----
From: Liu, Shaoyun <shaoyun....@amd.com>
Sent: Wednesday, January 31, 2024 9:26 AM
To: amd-gfx@lists.freedesktop.org
Cc: Liu, Shaoyun <shaoyun....@amd.com>
Subject: [PATCH] drm/amdgpu: Only create mes event log debugfs when mes is 

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

Signed-off-by: shaoyunl <shaoyun....@amd.com>
 drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c 
index 0626ac0192a8..dd2b8f3fa2f1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
@@ -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);


Reply via email to