[PATCH v2 3/3][SRU][I][OEM-5.13] drm/amd/pm: Fix a bug in semaphore double-lock

AceLan Kao acelan.kao at canonical.com
Fri Oct 1 03:36:04 UTC 2021

From: Luben Tuikov <luben.tuikov at amd.com>

BugLink: https://bugs.launchpad.net/bugs/1945553

Fix a bug in smu_cmn_send_msg_without_waiting() in
that this function does not need to take the
smu->message_lock mutex in order to send a message
down to the SMU. The mutex is acquired by the
caller of this function instead.

Cc: Alex Deucher <Alexander.Deucher at amd.com>
Cc: Changfeng Zhu <Changfeng.Zhu at amd.com>
Cc: Huang Rui <ray.huang at amd.com>
Fixes: 5810323ba69289 ("drm/amd/pm: Fix a bug communicating with the SMU (v5)")
Signed-off-by: Luben Tuikov <luben.tuikov at amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher at amd.com>
Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
(cherry picked from commit 544dcd74b7093ad4befac99b11d90331aa73348e)
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao at canonical.com>
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
index c45215d7d932f..68423df66f9de 100644
--- a/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
+++ b/drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
@@ -259,7 +259,6 @@ int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
 	if (smu->adev->no_hw_access)
 		return 0;
-	mutex_lock(&smu->message_lock);
 	reg = __smu_cmn_poll_stat(smu);
 	res = __smu_cmn_reg2errno(smu, reg);
 	if (reg == SMU_RESP_NONE ||
@@ -269,7 +268,6 @@ int smu_cmn_send_msg_without_waiting(struct smu_context *smu,
 	__smu_cmn_send_msg(smu, msg_index, param);
 	res = 0;
-	mutex_unlock(&smu->message_lock);
 	return res;

More information about the kernel-team mailing list