drm/amd/pm: Send message when resp status is 0xFC
Subsystems (3)
PATCH 1/1 drm/amd/pm: Send message when resp status is 0xFC
When PMFW is really busy, it will respond with 0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is 0xFC.
--- 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
@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(struct smu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;__smu_cmn_send_msg (smu, msg_index, param);
@@ -391,7 +390,6 @@ int smu_cmn_send_smc_msg_with_param(struct smu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) {__smu_cmn_reg_print_error (smu, reg, index, param, msg); goto Out;
Signature · 1 line
2.25.1
[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked.
Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy. Or we can just update the smu_cmn_send_smc_msg APIs to give it another try on PMFW busy.
BR
Evan
Quoted 43 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is0xFCWhen PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is0xFC.Signed-off-by Lijo Lazar <[email protected]>--- 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
-1@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1__smu_cmn_send_msg (smu, msg_index, param);@@ -391,7 +390,6 @@ int smu_cmn_send_smc_msg_with_param(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) {__smu_cmn_reg_print_error (smu, reg, index, param, msg);goto Out;
--
2.25.1
[AMD Official Use Only]
Quoted 1 line
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees 0xFC in response register, this patch is to address that.
Thanks,
Lijo
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is 0xFC
[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked.
Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy. Or we can just update the smu_cmn_send_smc_msg APIs to give it another try on PMFW busy.
BR
Evan
Quoted 43 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is0xFCWhen PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is0xFC.Signed-off-by Lijo Lazar <[email protected]>--- 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
-1@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;
__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6 @@ int
smu_cmn_send_smc_msg_with_param(structsmu_context*smu,drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-2reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) {__smu_cmn_reg_print_error (smu, reg, index, param, msg); goto Out; --2.25.1
[AMD Official Use Only]
Quoted 11 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 7 lines
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.
[Quan, Evan] Yes, I know. But the caller here could be another one. I mean there may be another caller stepped in.
BR
Evan
Quoted 70 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 9 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 3 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 19 lines
Signed-off-by Lijo Lazar <[email protected]>--- 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
-1@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;Quoted 1 line
__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6@@ int
Quoted 11 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-2reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) {__smu_cmn_reg_print_error (smu, reg, index, param, msg); goto Out; --2.25.1
Quoted 15 lines · Evan
[AMD Official Use Only]
Quoted 11 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 9 lines
Quoted 7 lines
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.[Quan, Evan] Yes, I know. But the caller here could be another one. I mean there may be another caller stepped in.
That shouldn't cause an issue to the second caller if it got message mutex. The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for 0xFC response. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have any flow like that.
Basically, 0xFC is not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busy when a previous message was sent and PMFW won't change the response status when it becomes free.
Thanks,
Lijo
Quoted 72 lines
BR
EvanQuoted 70 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 9 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 3 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 19 lines
Signed-off-by Lijo Lazar <[email protected]>--- 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
-1@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;Quoted 1 line
__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6@@ int
Quoted 11 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,
reg =__smu_cmn_poll_stat(smu);
res =__smu_cmn_reg2errno(smu, reg);
if (reg ==SMU_RESP_NONE||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-2- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) {__smu_cmn_reg_print_error (smu, reg, index, param, msg); goto Out; --2.25.1
[AMD Official Use Only]
Quoted 39 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 2:03 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 16 lines · Evan
[AMD Official Use Only]
Quoted 12 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.[Quan, Evan] Yes, I know. But the caller here could be another one. I mean
there may be another caller stepped in.
Quoted 1 line
Quoted 6 lines
That shouldn't cause an issue to the second caller if it got message mutex. The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for
0xFCresponse. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have any flow like that.
[Quan, Evan] Yeah, but there may be some case that messages issued by the two callers have dependence. That means the message issued by the 2nd caller should be only after the 1st one.
The one i can think of is "EnableAllSmuFeatures" message should be after "SetAllowedFeatures" message. Although that should not cause any problem, I'm not sure whether there is other similar case.
What I suggest is something like below. We just do it again in smu_cmn_send_smc_msg_with_param() on PMFW busy.
int smu_cmn_send_smc_msg_with_param(struct smu_context *smu,
enum smu_message_type msg,
uint32_t param,
uint32_t *read_arg)
{
...
...
mutex_lock(&smu->message_lock);
reg = __smu_cmn_poll_stat(smu);
res = __smu_cmn_reg2errno(smu, reg);
if (reg == SMU_RESP_NONE ||
reg == SMU_RESP_BUSY_OTHER ||
res == -EREMOTEIO) {
__smu_cmn_reg_print_error(smu, reg, index, param, msg);
goto Out;
}
+retry:
__smu_cmn_send_msg(smu, (uint16_t) index, param);
reg = __smu_cmn_poll_stat(smu);
res = __smu_cmn_reg2errno(smu, reg);+ if (reg == SMU_RESP_BUSY_OTHER) {
+ mdelay(1);
+ goto retry;
+ }
...
...
}
BR
Evan
Quoted 83 lines
Basically,
0xFCis not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busy when a previous message was sent and PMFW won't change the response status when it becomes free.Thanks,
LijoQuoted 74 lines
BR
EvanQuoted 72 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 9 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 4 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 19 lines
Signed-off-by Lijo Lazar <[email protected]>--- 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
-1@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;Quoted 1 line
__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6@@ int
Quoted 11 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,
reg =__smu_cmn_poll_stat(smu);
res =__smu_cmn_reg2errno(smu, reg);
if (reg ==SMU_RESP_NONE||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-2- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) {__smu_cmn_reg_print_error (smu, reg, index, param, msg); goto Out; --2.25.1
Quoted 76 lines · Evan
[AMD Official Use Only]
Quoted 39 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 2:03 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 16 lines · Evan
[AMD Official Use Only]
Quoted 12 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 8 lines
Quoted 7 lines
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.[Quan, Evan] Yes, I know. But the caller here could be another one. I mean
there may be another caller stepped in.
Quoted 1 line
Quoted 6 lines
That shouldn't cause an issue to the second caller if it got message mutex. The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for
0xFCresponse. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have any flow like that.[Quan, Evan] Yeah, but there may be some case that messages issued by the two callers have dependence. That means the message issued by the 2nd caller should be only after the 1st one.
The one i can think of is "EnableAllSmuFeatures" message should be after "SetAllowedFeatures" message. Although that should not cause any problem, I'm not sure whether there is other similar case.What I suggest is something like below. We just do it again in
smu_cmn_send_smc_msg_with_param()on PMFW busy.int smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,enum smu_message_type msg, uint32_t param, uint32_t *read_arg) { ... ... mutex_lock(&smu->message_lock); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE || reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param, msg); goto Out; } +retry: __smu_cmn_send_msg(smu, (uint16_t) index, param); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg);
Review
Quoted 4 lines
(quoted diff) +4
-0+ if (reg == SMU_RESP_BUSY_OTHER) { + mdelay(1); + goto retry; + }
I suppose the retry option should be left to caller. Regardless of retry or not, the patch is still valid.
Example situation -
rocm-smi is trying to get metrics and another app is trying set performance profile. If metrics fetch fail and even retry of metrics fetch fail after some loops, rocm-smi is free to fetch the metrics again after say 5s. That also shouldn't prevent the second app to send performance profile message and that app also may retry the same later.
Thanks,
Lijo
Quoted 89 lines
...
...
}BR
EvanQuoted 83 lines
Basically,
0xFCis not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busy when a previous message was sent and PMFW won't change the response status when it becomes free.Thanks,
LijoQuoted 74 lines
BR
EvanQuoted 72 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 9 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 4 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 19 lines
Signed-off-by Lijo Lazar <[email protected]>--- 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
-1@@ -297,7 +297,6 @@ int smu_cmn_send_msg_without_waiting(structsmu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;Quoted 1 line
__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6@@ int
Quoted 11 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE ||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-2- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) {__smu_cmn_reg_print_error (smu, reg, index, param, msg); goto Out; --2.25.1
[AMD Official Use Only]
Quoted 105 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 3:43 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 25 lines · Evan
[AMD Official Use Only]
Quoted 21 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 2:03 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 8 lines · Evan
[AMD Official Use Only]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; amd-Quoted 20 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
Quoted 6 lines
Quoted 4 lines
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.[Quan, Evan] Yes, I know. But the caller here could be another one. I mean
there may be another caller stepped in.
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
That shouldn't cause an issue to the second caller if it got message mutex. The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for
0xFCresponse. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have anyflow like that.
Quoted 1 line
[Quan, Evan] Yeah, but there may be some case that messages issued by
the two callers have dependence.
Quoted 1 line
That means the message issued by the 2nd caller should be only after the
1st one.
Quoted 1 line
The one i can think of is "EnableAllSmuFeatures" message should be after
"SetAllowedFeatures" message.
Quoted 1 line
Although that should not cause any problem, I'm not sure whether there is
other similar case.
Quoted 2 lines
What I suggest is something like below. We just do it again in
smu_cmn_send_smc_msg_with_param()on PMFW busy.Quoted 21 lines
int smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,enum smu_message_type msg, uint32_t param, uint32_t *read_arg) { ... ... mutex_lock(&smu->message_lock); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE || reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param, msg); goto Out; } +retry: __smu_cmn_send_msg(smu, (uint16_t) index, param); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg);Review
Quoted 4 lines
(quoted diff) +4
-0+ if (reg == SMU_RESP_BUSY_OTHER) { + mdelay(1); + goto retry; + }I suppose the retry option should be left to caller. Regardless of retry or not, the patch is still valid.
Quoted 7 lines
Example situation -
rocm-smi is trying to get metrics and another app is trying set performance profile. If metrics fetch fail and even retry of metrics fetch fail after some loops, rocm-smi is free to fetch the metrics again after say 5s. That also shouldn't prevent the second app to send performance profile message and that app also may retry the same later.
[Quan, Evan] I have no doubt the second app may still be able to send performance profile message.
However, the metrics data retrieved by rocm-smi will be different under such scenario.
That is after performance profile setting the clock frequencies may go up.
If the first app is sensitive to that(suppose it wants to compare the clock frequencies before and after performance profile setting), that will be a problem.
I reconsider this a bit. Can we add one more parameter for smu_cmn_send_smc_msg_with_param()? That parameter can tell what the caller wants(retry or abort) under PMFW busy scenario.
BR
Evan
Quoted 98 lines
Thanks,
LijoQuoted 4 lines
...
...
}Quoted 44 lines
BR
EvanQuoted 42 lines
Basically,
0xFCis not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busy when a previous message was sent and PMFW won't change the response status when it becomes free.Thanks,
LijoQuoted 33 lines
BR
EvanQuoted 31 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 5 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher,Alexander
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
<[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is
0xFCQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 6 lines
Signed-off-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 -- 1 file changed, 2 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-0@@ -297,7 +297,6 @@ intsmu_cmn_send_msg_without_waiting(struct
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1smu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
@@ int
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
Quoted 8 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE ||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param,msg);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
goto Out;--
2.25.1
Quoted 111 lines · Evan
[AMD Official Use Only]
Quoted 107 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 3:43 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 25 lines · Evan
[AMD Official Use Only]
Quoted 21 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 2:03 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 8 lines · Evan
[AMD Official Use Only]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; amd-Quoted 20 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
Quoted 6 lines
Quoted 4 lines
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.[Quan, Evan] Yes, I know. But the caller here could be another one. I mean
there may be another caller stepped in.
Quoted 1 line
Quoted 6 lines
Quoted 6 lines
That shouldn't cause an issue to the second caller if it got message mutex. The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for
0xFCresponse. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have anyflow like that.
Quoted 1 line
[Quan, Evan] Yeah, but there may be some case that messages issued by
the two callers have dependence.
Quoted 1 line
That means the message issued by the 2nd caller should be only after the
1st one.
Quoted 1 line
The one i can think of is "EnableAllSmuFeatures" message should be after
"SetAllowedFeatures" message.
Quoted 1 line
Although that should not cause any problem, I'm not sure whether there is
other similar case.
Quoted 2 lines
What I suggest is something like below. We just do it again in
smu_cmn_send_smc_msg_with_param()on PMFW busy.Quoted 21 lines
int smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,enum smu_message_type msg, uint32_t param, uint32_t *read_arg) { ... ... mutex_lock(&smu->message_lock); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE || reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param, msg); goto Out; } +retry: __smu_cmn_send_msg(smu, (uint16_t) index, param); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg);Review
Quoted 4 lines
(quoted diff) +4
-0+ if (reg == SMU_RESP_BUSY_OTHER) { + mdelay(1); + goto retry; + }I suppose the retry option should be left to caller. Regardless of retry or not, the patch is still valid.
Example situation -
Quoted 7 lines
Quoted 5 lines
rocm-smi is trying to get metrics and another app is trying set performance profile. If metrics fetch fail and even retry of metrics fetch fail after some loops, rocm-smi is free to fetch the metrics again after say 5s. That also shouldn't prevent the second app to send performance profile message and that app also may retry the same later.
[Quan, Evan] I have no doubt the second app may still be able to send performance profile message.
However, the metrics data retrieved by rocm-smi will be different under such scenario > That is after performance profile setting the clock frequencies may
go up.
Quoted 1 line
If the first app is sensitive to that(suppose it wants to compare the clock frequencies before and after performance profile setting), that will be a problem
Ah, my intention was to tell about a different use case, probably a bad example.
What I intended is -
rocm-smi is running periodically collecting metrics data and another app which doesn't bother about the background data collection trying to do something else. Thus a metrics fetch fail shouldn't prevent the other app from changing performance profile or whatever it intended to do. Also, rocm-smi may be able to fetch data during the next polling interval when the PMFW gets relatively free.
Quoted 3 lines
I reconsider this a bit. Can we add one more parameter for
smu_cmn_send_smc_msg_with_param()? That parameter can tell what the caller wants(retry or abort) under PMFW busy scenario.
There is one complication to this. The same message could return 0xFC under different conditions, and it may be fine for situation A but not for situation B. For ex: during driver load or init after a reset, we don't expect PMFW to be busy.Driver may send message to get metrics data to check say 'smart shift is enabled or not'. A failure with 0xFC is not a good sign that time and we should abort there.
The same message sent during runtime (like rocm-smi data collection) may fail with 0xFC due to workload conditions.
Adding another parameter will complicate things as we need to check every condition of message usage. In the present case, a message failure with 0xFC is treated as failure during init and we don't proceed. For a runtime use, apps always have a choice whether to retry the same API or not.
Thanks,
Lijo
Quoted 101 lines
BR
EvanQuoted 98 lines
Thanks,
LijoQuoted 4 lines
...
...
}Quoted 44 lines
BR
EvanQuoted 42 lines
Basically,
0xFCis not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busy when a previous message was sent and PMFW won't change the response status when it becomes free.Thanks,
LijoQuoted 33 lines
BR
EvanQuoted 31 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 5 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher,Alexander
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
<[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is
0xFCQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 6 lines
Signed-off-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 -- 1 file changed, 2 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-0@@ -297,7 +297,6 @@ intsmu_cmn_send_msg_without_waiting(struct
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1smu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
@@ int
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
Quoted 8 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE ||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param,msg);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
goto Out;--
2.25.1
[Public]
Hi Evan,
Any comments on this?
Thanks,
Lijo
-----Original Message-----
From: Lazar, Lijo
Sent: Friday, February 25, 2022 7:30 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is 0xFC
Quoted 122 lines · Evan
[AMD Official Use Only]
Quoted 111 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 3:43 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 25 lines · Evan
[AMD Official Use Only]
Quoted 21 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 2:03 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 8 lines · Evan
[AMD Official Use Only]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; amd-Quoted 20 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
Quoted 6 lines
Quoted 4 lines
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.[Quan, Evan] Yes, I know. But the caller here could be another one. I mean
there may be another caller stepped in.
Quoted 1 line
Quoted 7 lines
Quoted 7 lines
That shouldn't cause an issue to the second caller if it got message mutex. The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for
0xFCresponse. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have anyflow like that.
Quoted 2 lines
[Quan, Evan] Yeah, but there may be some case that messages issued by
the two callers have dependence.
Quoted 2 lines
That means the message issued by the 2nd caller should be only after the
1st one.
Quoted 2 lines
The one i can think of is "EnableAllSmuFeatures" message should be after
"SetAllowedFeatures" message.
Quoted 2 lines
Although that should not cause any problem, I'm not sure whether there is
other similar case.
Quoted 2 lines
What I suggest is something like below. We just do it again in
smu_cmn_send_smc_msg_with_param()on PMFW busy.Quoted 21 lines
int smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,enum smu_message_type msg, uint32_t param, uint32_t *read_arg) { ... ... mutex_lock(&smu->message_lock); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE || reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param, msg); goto Out; } +retry: __smu_cmn_send_msg(smu, (uint16_t) index, param); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg);Review
Quoted 4 lines
(quoted diff) +4
-0+ if (reg == SMU_RESP_BUSY_OTHER) { + mdelay(1); + goto retry; + }I suppose the retry option should be left to caller. Regardless of retry or not, the patch is still valid.
Quoted 7 lines
Example situation -
rocm-smi is trying to get metrics and another app is trying set performance profile. If metrics fetch fail and even retry of metrics fetch fail after some loops, rocm-smi is free to fetch the metrics again after say 5s. That also shouldn't prevent the second app to send performance profile message and that app also may retry the same later.
Quoted 4 lines
[Quan, Evan] I have no doubt the second app may still be able to send performance profile message. However, the metrics data retrieved by rocm-smi will be different
under such scenario > That is after performance profile setting the
clock frequencies may
go up.
Quoted 3 lines
If the first app is sensitive to that(suppose it wants to compare the clock frequencies before and after performance profile setting), that will be a problem
Ah, my intention was to tell about a different use case, probably a bad example.
What I intended is -
rocm-smi is running periodically collecting metrics data and another app which doesn't bother about the background data collection trying to do something else. Thus a metrics fetch fail shouldn't prevent the other app from changing performance profile or whatever it intended to do. Also, rocm-smi may be able to fetch data during the next polling interval when the PMFW gets relatively free.
Quoted 3 lines
I reconsider this a bit. Can we add one more parameter for
smu_cmn_send_smc_msg_with_param()? That parameter can tell what the caller wants(retry or abort) under PMFW busy scenario.
There is one complication to this. The same message could return 0xFC under different conditions, and it may be fine for situation A but not for situation B. For ex: during driver load or init after a reset, we don't expect PMFW to be busy.Driver may send message to get metrics data to check say 'smart shift is enabled or not'. A failure with 0xFC is not a good sign that time and we should abort there.
The same message sent during runtime (like rocm-smi data collection) may fail with 0xFC due to workload conditions.
Adding another parameter will complicate things as we need to check every condition of message usage. In the present case, a message failure with 0xFC is treated as failure during init and we don't proceed. For a runtime use, apps always have a choice whether to retry the same API or not.
Thanks,
Lijo
Quoted 102 lines
BR
EvanQuoted 99 lines
Thanks,
LijoQuoted 4 lines
...
...
}Quoted 45 lines
BR
EvanQuoted 43 lines
Basically,
0xFCis not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busy when a previous message was sent and PMFW won't change the response status when it becomes free.Thanks,
LijoQuoted 34 lines
BR
EvanQuoted 32 lines
Thanks,
Lijo-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already blocked. Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.BR
EvanQuoted 5 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher,Alexander
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
<[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is
0xFCQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 6 lines
Signed-off-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 -- 1 file changed, 2 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-0@@ -297,7 +297,6 @@ intsmu_cmn_send_msg_without_waiting(struct
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1smu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
@@ int
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
Quoted 8 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE ||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param,msg);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
goto Out;--
2.25.1
Quan, Evan
Reviewed-by[Public]
Sorry for missing this. Busy with new asic bringup.
Let's adopt this for now and we can revise it later if we do see some corner case.
Thanks,
Evan
Quoted 309 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, March 8, 2022 1:58 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp status is0xFC[Public]
Hi Evan,
Any comments on this?
Thanks,
Lijo-----Original Message-----
From: Lazar, Lijo
Sent: Friday, February 25, 2022 7:30 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 25 lines · Evan
[AMD Official Use Only]
Quoted 21 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 3:43 PM
To: Quan, Evan <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 8 lines · Evan
[AMD Official Use Only]
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 2:03 PM
To: Quan, Evan <[email protected]>; amd-Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: Re: [PATCH] drm/amd/pm: Send message when resp status is0xFCQuoted 4 lines · Evan
[AMD Official Use Only]
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 1:47 PM
To: Quan, Evan <[email protected]>; amd-Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Cc Zhang, Hawking <[email protected]>; Deucher,Alexander
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
<[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp statusis
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
0xFC[AMD Official Use Only]
Quoted 2 lines
That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy
This patch expects this method. Caller may try to resend message again. As part of message sending, driver first checks response register. Current logic blocks sending any message if it sees
0xFCin response register, this patch is to address that.Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 2 lines
[Quan, Evan] Yes, I know. But the caller here could be another one. I mean
there may be another caller stepped in.
Quoted 1 line
That shouldn't cause an issue to the second caller if it got message
mutex.
Quoted 51 lines
Quoted 51 lines
Quoted 6 lines
Quoted 6 lines
The second caller also should be able to send message if PMFW got free by that time. The first caller can retry when it gets back the message mutex. FW doesn't maintain any state for
0xFCresponse. Any other message may be sent after that. If driver keeps the state based on two callers, that is a logic problem in driver. I don't think we have anyflow like that.
Quoted 2 lines
[Quan, Evan] Yeah, but there may be some case that messages issued by
the two callers have dependence.
Quoted 2 lines
That means the message issued by the 2nd caller should be only after the
1st one.
Quoted 2 lines
The one i can think of is "EnableAllSmuFeatures" message should be after
"SetAllowedFeatures" message.
Quoted 2 lines
Although that should not cause any problem, I'm not sure whether there is
other similar case.
Quoted 2 lines
What I suggest is something like below. We just do it again in
smu_cmn_send_smc_msg_with_param()on PMFW busy.Quoted 21 lines
int smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,enum smu_message_type msg, uint32_t param, uint32_t *read_arg) { ... ... mutex_lock(&smu->message_lock); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE || reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param, msg); goto Out; } +retry: __smu_cmn_send_msg(smu, (uint16_t) index, param); reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg);Review
Quoted 4 lines
(quoted diff) +4
-0+ if (reg == SMU_RESP_BUSY_OTHER) { + mdelay(1); + goto retry; + }I suppose the retry option should be left to caller. Regardless of retry or not, the patch is still valid.
Quoted 7 lines
Quoted 7 lines
Example situation -
rocm-smi is trying to get metrics and another app is trying set performance profile. If metrics fetch fail and even retry of metrics fetch fail after some loops, rocm-smi is free to fetch the metrics again after say 5s. That also shouldn't prevent the second app to send performance profile message and that app also may retry the same
later.
Quoted 1 line
[Quan, Evan] I have no doubt the second app may still be able to send
performance profile message.
Quoted 3 lines
However, the metrics data retrieved by rocm-smi will be different under such scenario > That is after performance profile setting the clock frequencies may
go up.
Quoted 3 lines
If the first app is sensitive to that(suppose it wants to compare the clock frequencies before and after performance profile setting), that will be a problem
Ah, my intention was to tell about a different use case, probably a bad example.
What I intended is -
rocm-smi is running periodically collecting metrics data and another app which doesn't bother about the background data collection trying to do something else. Thus a metrics fetch fail shouldn't prevent the other app from changing performance profile or whatever it intended to do. Also, rocm-smi may be able to fetch data during the next polling interval when the PMFW gets relatively free.
Quoted 2 lines
I reconsider this a bit. Can we add one more parameter for
smu_cmn_send_smc_msg_with_param()?Quoted 1 line
That parameter can tell what the caller wants(retry or abort) under PMFW
busy scenario.
There is one complication to this. The same message could return
0xFCunder different conditions, and it may be fine for situation A but not for situation B. For ex: during driver load or init after a reset, we don't expect PMFW to be busy.Driver may send message to get metrics data to check say 'smart shift is enabled or not'. A failure with0xFCis not a good sign that time and we should abort there.The same message sent during runtime (like rocm-smi data collection) may fail with
0xFCdue to workload conditions.Adding another parameter will complicate things as we need to check every condition of message usage. In the present case, a message failure with
0xFCis treated as failure during init and we don't proceed. For a runtime use, apps always have a choice whether to retry the same API or not.Thanks,
LijoQuoted 16 lines
BR
EvanQuoted 13 lines
Thanks,
LijoQuoted 9 lines
...
...
}BR
EvanQuoted 3 lines
Basically,
0xFCis not valid pre-condition check for sending any message. As per PMFW team - it only means that PMFW was busywhen a
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
previous message was sent and PMFW won't change the response
status
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
when it becomes free.
Thanks,
LijoQuoted 6 lines
BR
EvanQuoted 4 lines
Thanks,
LijoQuoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
-----Original Message-----
From: Quan, Evan <[email protected]>
Sent: Friday, February 25, 2022 11:07 AM
To: Lazar, Lijo <[email protected]>; [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher,Alexander
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
<[email protected]>; Wang, Yang(Kevin) <[email protected]>
Subject: RE: [PATCH] drm/amd/pm: Send message when resp statusis
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
0xFC[AMD Official Use Only]
This may introduce some problems for two callers scenarios. That is the 2nd one will still proceed even if the 1st one was already
blocked.
Quoted 59 lines
Quoted 59 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Maybe the logics here should be performed by the caller. That is the caller can perform something like issuing the same message again without prerequisites check on PMFW busy.
Or we can just update thesmu_cmn_send_smc_msgAPIs to give it another try on PMFW busy.Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
BR
EvanQuoted 5 lines
-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Friday, February 25, 2022 12:22 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher,Alexander
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
<[email protected]>; Wang, Yang(Kevin) <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH] drm/amd/pm: Send message when resp status is
0xFCQuoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 5 lines
When PMFW is really busy, it will respond with
0xFC. However, it doesn't change the response register state when it becomes free. Driver should retry and proceed to send message if the response status is
0xFC.Quoted 6 lines
Signed-off-by Lijo Lazar <[email protected]>--- drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 2 -- 1 file changed, 2 deletions(-)Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int
Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-0@@ -297,7 +297,6 @@ intsmu_cmn_send_msg_without_waiting(struct
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1smu_context *smu, reg =__smu_cmn_poll_stat (smu); res =__smu_cmn_reg2errno (smu, reg);if (reg ==SMU_RESP_NONE || - reg ==SMU_RESP_BUSY_OTHER || res == -EREMOTEIO ) goto Out;__smu_cmn_send_msg(smu, msg_index, param); @@ -391,7 +390,6
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
@@ int
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c
Quoted 8 lines
smu_cmn_send_smc_msg_with_param(struct
smu_context*smu,reg = __smu_cmn_poll_stat(smu); res = __smu_cmn_reg2errno(smu, reg); if (reg == SMU_RESP_NONE ||drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0
-1- reg == SMU_RESP_BUSY_OTHER || res == -EREMOTEIO) { __smu_cmn_reg_print_error(smu, reg, index, param,msg);
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
goto Out;--
2.25.1