Commit 6f6a7bba authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher

drm/amd/powerplay: fix deadlock issue for smu_force_performance_level

the smu->mutex is internal lock resource in sw-smu, some functions will use
it at the same time, so it maybe will cause deadlock issue.
this patch fix this issue in smu_force_performance_level function.
Signed-off-by: default avatarKevin Wang <kevin1.wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 3ebab625
......@@ -370,18 +370,9 @@ static ssize_t amdgpu_set_dpm_forced_performance_level(struct device *dev,
}
if (is_support_sw_smu(adev)) {
mutex_lock(&adev->pm.mutex);
if (adev->pm.dpm.thermal_active) {
count = -EINVAL;
mutex_unlock(&adev->pm.mutex);
goto fail;
}
ret = smu_force_performance_level(&adev->smu, level);
if (ret)
count = -EINVAL;
else
adev->pm.dpm.forced_level = level;
mutex_unlock(&adev->pm.mutex);
} else if (adev->powerplay.pp_funcs->force_performance_level) {
mutex_lock(&adev->pm.mutex);
if (adev->pm.dpm.thermal_active) {
......
......@@ -1459,12 +1459,15 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev
break;
}
mutex_lock(&smu->mutex);
smu->adev->ip_blocks[i].version->funcs->enable_umd_pstate(smu, &level);
ret = smu_handle_task(smu, level,
AMD_PP_TASK_READJUST_POWER_STATE);
if (ret)
return ret;
mutex_lock(&smu->mutex);
smu_dpm_ctx->dpm_level = level;
mutex_unlock(&smu->mutex);
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment