Skip to contentSkip to conversation

drm/amd/pm: Fix a bug in semaphore double-lock

PATCH In review Luben Tuikov 2 participants 2 messages Jul 28, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/pm: Fix a bug in semaphore double-lock

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 <[email protected]>
Cc Changfeng Zhu <[email protected]>
Cc Huang Rui <[email protected]>
Fixes e070ba49f3a764 ("drm/amd/pm: Fix a bug communicating with the SMU (v5)")
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -2
index a0e2111eb7838c..415be74df28c7f 100644
@@ -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;
 Out:
-	mutex_unlock(&smu->message_lock);
 	return res;
 }
 
Signature · 6 lines
2.32.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Luben Tuikov

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 <[email protected]>
Cc Changfeng Zhu <[email protected]>
Cc Huang Rui <[email protected]>
Fixes e070ba49f3a764 ("drm/amd/pm: Fix a bug communicating with the SMU (v5)")
Quoted 27 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -3
index a0e2111eb7838c..415be74df28c7f 100644
@@ -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;
 Out:
-       mutex_unlock(&smu->message_lock);
        return res;
 }
 
--

2.32.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx