<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
sorry, I misread your email, I will post a v3</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Bhawan<br>
</div>
<div id="appendonsend"></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> Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com><br>
<b>Sent:</b> January 12, 2021 11:03 AM<br>
<b>To:</b> Chen, Guchun <Guchun.Chen@amd.com>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Subject:</b> Re: [PATCH] drm/amd/display: Fix deadlock during gpu reset v2</font>
<div> </div>
</div>
<style type="text/css" style="display:none">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
No need since "<font size="2"><span style="font-size:11pt">dc_allow_idle_optimizations</span></font>" will not do anything for asics below dcn3</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Bhawan<br>
</div>
<div id="x_appendonsend"></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Chen, Guchun <Guchun.Chen@amd.com><br>
<b>Sent:</b> January 11, 2021 10:01 PM<br>
<b>To:</b> Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amd/display: Fix deadlock during gpu reset v2</font>
<div> </div>
</div>
<div class="x_BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="x_PlainText">[AMD Public Use]<br>
<br>
When using dc_allow_idle_optimizations, should it be guarded by CONFIG_DRM_AMD_DC_DCN?<br>
<br>
Regards,<br>
Guchun<br>
<br>
-----Original Message-----<br>
From: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com> <br>
Sent: Tuesday, January 12, 2021 5:03 AM<br>
To: Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com>; Chen, Guchun <Guchun.Chen@amd.com>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
Cc: amd-gfx@lists.freedesktop.org; Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com><br>
Subject: [PATCH] drm/amd/display: Fix deadlock during gpu reset v2<br>
<br>
[Why]<br>
during idle optimizations we acquire the dc_lock, this lock is also acquired during gpu_reset so we end up hanging the system due to a deadlock<br>
<br>
[How]<br>
If we are in gpu reset:<br>
 - disable idle optimizations and skip calls to the dc function<br>
<br>
v2: skip idle optimizations calls<br>
<br>
Fixes: 06d5652541c3 ("drm/amd/display: enable idle optimizations for linux (MALL stutter)")<br>
Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com><br>
---<br>
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++++<br>
 1 file changed, 6 insertions(+)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
index 99c7f9eb44aa..858c6ff173ba 100644<br>
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c<br>
@@ -1816,6 +1816,9 @@ static int dm_suspend(void *handle)<br>
 <br>
         if (amdgpu_in_reset(adev)) {<br>
                 mutex_lock(&dm->dc_lock);<br>
+<br>
+               dc_allow_idle_optimizations(adev->dm.dc, false);<br>
+<br>
                 dm->cached_dc_state = dc_copy_state(dm->dc->current_state);<br>
 <br>
                 dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); @@ -5556,6 +5559,9 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)<br>
         if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))<br>
                 return -EBUSY;<br>
 <br>
+       if (amdgpu_in_reset(adev))<br>
+               return 0;<br>
+<br>
         mutex_lock(&dm->dc_lock);<br>
 <br>
         if (enable)<br>
--<br>
2.25.1<br>
</div>
</span></font></div>
</div>
</div>
</body>
</html>