RE: [PATCH 3/3] drm/amd/powerplay: fix save dpm level error for smu

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

 



> the save dpm level should be save previous dpm profile level, should not
> modified by get dpm level function.
Please give a better description to explain why this change is needed.


enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu)
 {
 	struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
+	enum amd_dpm_forced_level level;
 
 	if (!smu_dpm_ctx->dpm_context)
 		return -EINVAL;
 
 	mutex_lock(&(smu->mutex));
-	if (smu_dpm_ctx->dpm_level != smu_dpm_ctx->saved_dpm_level) {
-		smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx->dpm_level;
-	}
+	level = smu_dpm_ctx->dpm_level;
 	mutex_unlock(&(smu->mutex));
 
-	return smu_dpm_ctx->dpm_level;
+	return level;
 }

Can you simplify the interface further? Maybe just return smu_dpm_ctx->dpm_level and no lock needed.

With above addressed, the patch is eviewed-by: Evan Quan <evan.quan@xxxxxxx>

> -----Original Message-----
> From: Wang, Kevin(Yang) <Kevin1.Wang@xxxxxxx>
> Sent: Friday, July 12, 2019 5:15 PM
> To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
> Cc: Feng, Kenneth <Kenneth.Feng@xxxxxxx>; Quan, Evan
> <Evan.Quan@xxxxxxx>; Xu, Feifei <Feifei.Xu@xxxxxxx>; Wang,
> Kevin(Yang) <Kevin1.Wang@xxxxxxx>
> Subject: [PATCH 3/3] drm/amd/powerplay: fix save dpm level error for smu
> 
> the save dpm level should be save previous dpm profile level, should not
> modified by get dpm level function.
> eg: default auto
> 1. auto -> standard ==> dpm_level = standard, save_dpm = auto.
> 2. standard -> auto ==> dpm_level = auto, save_dpm = standard.
> 
> Change-Id: Ib6766e57cc187df4f0c89cc68dcee7efd77529fd
> Signed-off-by: Kevin Wang <kevin1.wang@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> index be90ae59dfa8..4abedf72a15e 100644
> --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
> @@ -1428,17 +1428,16 @@ int smu_handle_task(struct smu_context *smu,
> enum amd_dpm_forced_level smu_get_performance_level(struct
> smu_context *smu)  {
>  	struct smu_dpm_context *smu_dpm_ctx = &(smu->smu_dpm);
> +	enum amd_dpm_forced_level level;
> 
>  	if (!smu_dpm_ctx->dpm_context)
>  		return -EINVAL;
> 
>  	mutex_lock(&(smu->mutex));
> -	if (smu_dpm_ctx->dpm_level != smu_dpm_ctx->saved_dpm_level)
> {
> -		smu_dpm_ctx->saved_dpm_level = smu_dpm_ctx-
> >dpm_level;
> -	}
> +	level = smu_dpm_ctx->dpm_level;
>  	mutex_unlock(&(smu->mutex));
> 
> -	return smu_dpm_ctx->dpm_level;
> +	return level;
>  }
> 
>  int smu_force_performance_level(struct smu_context *smu, enum
> amd_dpm_forced_level level)
> --
> 2.22.0

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




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

  Powered by Linux