[PATCH 15/28] drm/amd/display: Do not release DC state on S3 resume

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2017-10-19 01:46 PM, Harry Wentland wrote:
> From: "Leo (Sunpeng) Li" <sunpeng.li at amd.com>
>
> Because of the following patch:
>
> Leo (Sunpeng) Li    Move copy_construct from state_alloc to atomic_check
>
> We do not allocate the DC state within dm_atomic_state_alloc anymore.
>
> Since this function is a part of the S3 resume code path, we should not
> release the state when refreshing it within amdgpu_dm_display_resume.
> Just create it, as it has already been freed.
>
> Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
> Reviewed-by: Roman Li <Roman.Li at amd.com>
> Reviewed-by: Harry Wentland <Harry.Wentland at amd.com>
> ---
>   drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 --
>   1 file changed, 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 8910a820fbf5..a6424eb1c1a5 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -691,8 +691,6 @@ int amdgpu_dm_display_resume(struct amdgpu_device *adev)
>   	 * disabled. Refresh cached state to match actual current state before
>   	 * restoring it.
>   	 */
> -	WARN_ON(kref_read(&cached_state->context->refcount) > 1);
> -	dc_release_state(cached_state->context);
>   
>   	cached_state->context = dc_create_state();

The new patch is ok but in the existing code

cached_state->context = dc_create_state();

seems to me will cause memory leak since cached_state->context is later 
overridden inside amdgpu_dm_atomic_check where you allocate
and copy construct the current dm/dc states anyway.  Seems to me you can 
drop dc_state allocation in amdgpu_dm_display_resume since you
only reference there the drm_atomic_state, later in 
amdgpu_dm_atomic_check it will be allocated anyway.

patches 9-15 Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com>

Andrey
>   	ASSERT(cached_state->context);



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux