<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:11pt;color:#0078D7;margin:5pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
right, that makes more sense. I will post a v2 shortly <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> Kazlauskas, Nicholas <Nicholas.Kazlauskas@amd.com><br>
<b>Sent:</b> January 11, 2021 3:22 PM<br>
<b>To:</b> Lakha, Bhawanpreet <Bhawanpreet.Lakha@amd.com>; Chen, Guchun <Guchun.Chen@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</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On 2021-01-11 2:55 p.m., Bhawanpreet Lakha wrote:<br>
> [Why]<br>
> during idle optimizations we acquire the dc_lock, this lock is also<br>
> acquired during gpu_reset so we end up hanging the system due to a<br>
> deadlock<br>
> <br>
> [How]<br>
> If we are in gpu reset dont acquire the dc lock, as we already have it<br>
<br>
Are we sure this is the behavior we want?<br>
<br>
I think if we are in GPU reset then we shouldn't be attempting to modify <br>
idle optimization state at all, ie. return early if amdgpu_in_reset.<br>
<br>
The calls around the locks are working around bad policy.<br>
<br>
Regards,<br>
Nicholas Kazlauskas<br>
<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, 4 insertions(+), 2 deletions(-)<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..2170e1b2d32c 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>
> @@ -5556,7 +5556,8 @@ 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>
> - mutex_lock(&dm->dc_lock);<br>
> + if (!amdgpu_in_reset(adev))<br>
> + mutex_lock(&dm->dc_lock);<br>
> <br>
> if (enable)<br>
> dm->active_vblank_irq_count++;<br>
> @@ -5568,7 +5569,8 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)<br>
> <br>
> DRM_DEBUG_DRIVER("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0);<br>
> <br>
> - mutex_unlock(&dm->dc_lock);<br>
> + if (!amdgpu_in_reset(adev))<br>
> + mutex_unlock(&dm->dc_lock);<br>
> <br>
> return 0;<br>
> }<br>
> <br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>