[PATCH] drm/amd/display: Fix crash on device remove/driver unload

Harry Wentland harry.wentland at amd.com
Wed Sep 15 20:14:35 UTC 2021


On 2021-09-15 16:11, Andrey Grodzovsky wrote:
> Why:
> DC core is being released from DM before it's referenced
> from hpd_rx wq destruction code.
> 
> How: Move hpd_rx destruction before DC core destruction.
> 
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky at amd.com>

Reviewed-by: Harry Wentland <harry.wentland at amd.com>

Harry

> ---
>  .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 24 +++++++++----------
>  1 file changed, 12 insertions(+), 12 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 5d3679bd6b29..1c0547bb09de 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -1572,6 +1572,18 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
>  				      &adev->dm.dmub_bo_gpu_addr,
>  				      &adev->dm.dmub_bo_cpu_addr);
>  
> +	if (adev->dm.hpd_rx_offload_wq) {
> +		for (i = 0; i < adev->dm.dc->caps.max_links; i++) {
> +			if (adev->dm.hpd_rx_offload_wq[i].wq) {
> +				destroy_workqueue(adev->dm.hpd_rx_offload_wq[i].wq);
> +				adev->dm.hpd_rx_offload_wq[i].wq = NULL;
> +			}
> +		}
> +
> +		kfree(adev->dm.hpd_rx_offload_wq);
> +		adev->dm.hpd_rx_offload_wq = NULL;
> +	}
> +
>  	/* DC Destroy TODO: Replace destroy DAL */
>  	if (adev->dm.dc)
>  		dc_destroy(&adev->dm.dc);
> @@ -1590,18 +1602,6 @@ static void amdgpu_dm_fini(struct amdgpu_device *adev)
>  		adev->dm.freesync_module = NULL;
>  	}
>  
> -	if (adev->dm.hpd_rx_offload_wq) {
> -		for (i = 0; i < adev->dm.dc->caps.max_links; i++) {
> -			if (adev->dm.hpd_rx_offload_wq[i].wq) {
> -				destroy_workqueue(adev->dm.hpd_rx_offload_wq[i].wq);
> -				adev->dm.hpd_rx_offload_wq[i].wq = NULL;
> -			}
> -		}
> -
> -		kfree(adev->dm.hpd_rx_offload_wq);
> -		adev->dm.hpd_rx_offload_wq = NULL;
> -	}
> -
>  	mutex_destroy(&adev->dm.audio_lock);
>  	mutex_destroy(&adev->dm.dc_lock);
>  
> 



More information about the amd-gfx mailing list