[PATCH] drm/amd/display: Fix deadlock during gpu reset

Kazlauskas, Nicholas nicholas.kazlauskas at amd.com
Mon Jan 11 20:22:15 UTC 2021


On 2021-01-11 2:55 p.m., Bhawanpreet Lakha wrote:
> [Why]
> 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
> 
> [How]
> If we are in gpu reset dont acquire the dc lock, as we already have it

Are we sure this is the behavior we want?

I think if we are in GPU reset then we shouldn't be attempting to modify 
idle optimization state at all, ie. return early if amdgpu_in_reset.

The calls around the locks are working around bad policy.

Regards,
Nicholas Kazlauskas

> 
> Fixes: 06d5652541c3 ("drm/amd/display: enable idle optimizations for linux (MALL stutter)")
> Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index 99c7f9eb44aa..2170e1b2d32c 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -5556,7 +5556,8 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
>   	if (!dc_interrupt_set(adev->dm.dc, irq_source, enable))
>   		return -EBUSY;
>   
> -	mutex_lock(&dm->dc_lock);
> +	if (!amdgpu_in_reset(adev))
> +		mutex_lock(&dm->dc_lock);
>   
>   	if (enable)
>   		dm->active_vblank_irq_count++;
> @@ -5568,7 +5569,8 @@ static inline int dm_set_vblank(struct drm_crtc *crtc, bool enable)
>   
>   	DRM_DEBUG_DRIVER("Allow idle optimizations (MALL): %d\n", dm->active_vblank_irq_count == 0);
>   
> -	mutex_unlock(&dm->dc_lock);
> +	if (!amdgpu_in_reset(adev))
> +		mutex_unlock(&dm->dc_lock);
>   
>   	return 0;
>   }
> 



More information about the amd-gfx mailing list