<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<p style="font-family:Arial;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - General]<br>
</p>
<br>
<div>
<div>
<div dir="ltr">Ping</div>
</div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
Get <a href="https://aka.ms/o0ukef">Outlook for iOS</a></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
<b>Sent:</b> Friday, March 22, 2024 2:00:21 PM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Liu, Shaoyun <Shaoyun.Liu@amd.com><br>
<b>Subject:</b> [PATCH] drm/amdgpu : Add mes_log_enable to control mes log feature</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">The MES log might slow down the performance for extra step of log the data,<br>
disable it by default and introduce a parameter can enable it when necessary<br>
<br>
Signed-off-by: shaoyunl <shaoyun.liu@amd.com><br>
---<br>
drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 ++++++++++<br>
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 5 ++++-<br>
drivers/gpu/drm/amd/amdgpu/mes_v11_0.c | 7 +++++--<br>
4 files changed, 20 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
index 9c62552bec34..b3b84647207e 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h<br>
@@ -210,6 +210,7 @@ extern int amdgpu_async_gfx_ring;<br>
extern int amdgpu_mcbp;<br>
extern int amdgpu_discovery;<br>
extern int amdgpu_mes;<br>
+extern int amdgpu_mes_log_enable;<br>
extern int amdgpu_mes_kiq;<br>
extern int amdgpu_noretry;<br>
extern int amdgpu_force_asic_type;<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
index 80b9642f2bc4..e4277298cf1a 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c<br>
@@ -195,6 +195,7 @@ int amdgpu_async_gfx_ring = 1;<br>
int amdgpu_mcbp = -1;<br>
int amdgpu_discovery = -1;<br>
int amdgpu_mes;<br>
+int amdgpu_mes_log_enable = 0;<br>
int amdgpu_mes_kiq;<br>
int amdgpu_noretry = -1;<br>
int amdgpu_force_asic_type = -1;<br>
@@ -667,6 +668,15 @@ MODULE_PARM_DESC(mes,<br>
"Enable Micro Engine Scheduler (0 = disabled (default), 1 = enabled)");<br>
module_param_named(mes, amdgpu_mes, int, 0444);<br>
<br>
+/**<br>
+ * DOC: mes_log_enable (int)<br>
+ * Enable Micro Engine Scheduler log. This is used to enable/disable MES internal log.<br>
+ * (0 = disabled (default), 1 = enabled)<br>
+ */<br>
+MODULE_PARM_DESC(mes_log_enable,<br>
+ "Enable Micro Engine Scheduler log (0 = disabled (default), 1 = enabled)");<br>
+module_param_named(mes_log_enable, amdgpu_mes_log_enable, int, 0444);<br>
+<br>
/**<br>
* DOC: mes_kiq (int)<br>
* Enable Micro Engine Scheduler KIQ. This is a new engine pipe for kiq.<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c<br>
index 78dfd027dc99..9ace848e174c 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c<br>
@@ -100,6 +100,9 @@ static int amdgpu_mes_event_log_init(struct amdgpu_device *adev)<br>
{<br>
int r;<br>
<br>
+ if (!amdgpu_mes_log_enable)<br>
+ return 0;<br>
+<br>
r = amdgpu_bo_create_kernel(adev, PAGE_SIZE, PAGE_SIZE,<br>
AMDGPU_GEM_DOMAIN_GTT,<br>
&adev->mes.event_log_gpu_obj,<br>
@@ -1561,7 +1564,7 @@ void amdgpu_debugfs_mes_event_log_init(struct amdgpu_device *adev)<br>
#if defined(CONFIG_DEBUG_FS)<br>
struct drm_minor *minor = adev_to_drm(adev)->primary;<br>
struct dentry *root = minor->debugfs_root;<br>
- if (adev->enable_mes)<br>
+ if (adev->enable_mes && amdgpu_mes_log_enable)<br>
debugfs_create_file("amdgpu_mes_event_log", 0444, root,<br>
adev, &amdgpu_debugfs_mes_event_log_fops);<br>
<br>
diff --git a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
index 072c478665ad..63f281a9984d 100644<br>
--- a/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
+++ b/drivers/gpu/drm/amd/amdgpu/mes_v11_0.c<br>
@@ -411,8 +411,11 @@ static int mes_v11_0_set_hw_resources(struct amdgpu_mes *mes)<br>
mes_set_hw_res_pkt.enable_reg_active_poll = 1;<br>
mes_set_hw_res_pkt.enable_level_process_quantum_check = 1;<br>
mes_set_hw_res_pkt.oversubscription_timer = 50;<br>
- mes_set_hw_res_pkt.enable_mes_event_int_logging = 1;<br>
- mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr = mes->event_log_gpu_addr;<br>
+ if (amdgpu_mes_log_enable) {<br>
+ mes_set_hw_res_pkt.enable_mes_event_int_logging = 1;<br>
+ mes_set_hw_res_pkt.event_intr_history_gpu_mc_ptr =<br>
+ mes->event_log_gpu_addr;<br>
+ }<br>
<br>
return mes_v11_0_submit_pkt_and_poll_completion(mes,<br>
&mes_set_hw_res_pkt, sizeof(mes_set_hw_res_pkt),<br>
-- <br>
2.34.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>