Skip to contentSkip to conversation

amdgpu/pm: Clarify documentation of error handling in send_smc_mesg

PATCH Superseded Darren Powell 3 participants 5 messages Apr 12, 2022 – Apr 13, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdgpu/pm: Clarify documentation of error handling in send_smc_mesg

Contrary to the smu_cmn_send_smc_msg_with_param documentation, two cases exist where messages are silently dropped with no error returned to the caller. These cases occur in unusual situations where either:
1. the message target is a virtual GPU, or
2. a PCI recovery is underway and the HW is not yet in sync with the SW

For more details see
commit 4ea5081c82c4 ("drm/amd/powerplay: enable SMC message filter") commit bf36b52e781d ("drm/amdgpu: Avoid accessing HW when suspending SW state")

(v2)
Reworked with suggestions from Luben & Paul

---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -3
index b8d0c70ff668..8008ae5508e6 100644
@@ -356,9 +356,11 @@ int smu_cmn_wait_for_response(struct smu_context *smu)
  * completion of the command, and return back a value from the SMU in
  * @read_arg pointer.
  *
- * Return 0 on success, -errno on error, if we weren't able to send
- * the message or if the message completed with some kind of
- * error. See __smu_cmn_reg2errno() for details of the -errno.
+ * Return 0 on success, -errno when a problem is encountered sending
+ * message or receiving reply. If there is a PCI bus recovery or
+ * the destination is a virtual GPU, the message is simply dropped and
+ * success is also returned.
+ * See __smu_cmn_reg2errno() for details of the -errno.
  *
  * If we weren't able to send the message to the SMU, we also print
  * the error to the standard log.

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

Signature · 1 line
2.35.1
#1 lore raw
Quoted 4 lines · Darren Powell

Contrary to the smu_cmn_send_smc_msg_with_param documentation, two cases exist where messages are silently dropped with no error returned to the caller. These cases occur in unusual situations where either:
1. the message target is a virtual GPU, or

This is not fully correct - only messages which are not valid for virtual GPU are dropped, not all.

Thanks,
Lijo

Quoted 36 lines

2. a PCI recovery is underway and the HW is not yet in sync with the SW

For more details see
commit 4ea5081c82c4 ("drm/amd/powerplay: enable SMC message filter") commit bf36b52e781d ("drm/amdgpu: Avoid accessing HW when suspending SW state")

(v2)
Reworked with suggestions from Luben & Paul

---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -3
index b8d0c70ff668..8008ae5508e6 100644
@@ -356,9 +356,11 @@ int smu_cmn_wait_for_response(struct smu_context *smu)
   * completion of the command, and return back a value from the SMU in
   * @read_arg pointer.
   *
- * Return 0 on success, -errno on error, if we weren't able to send
- * the message or if the message completed with some kind of
- * error. See __smu_cmn_reg2errno() for details of the -errno.
+ * Return 0 on success, -errno when a problem is encountered sending
+ * message or receiving reply. If there is a PCI bus recovery or
+ * the destination is a virtual GPU, the message is simply dropped and
+ * success is also returned.
+ * See __smu_cmn_reg2errno() for details of the -errno.
   *
   * If we weren't able to send the message to the SMU, we also print
   * the error to the standard log.

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

#2 lore raw

[AMD Official Use Only]

I needed to dig further down to find the message map, I had been looking back in mailing list looking for clarification but hadn't found anything. Will reword
Thanks
Darren
________________________________
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, April 12, 2022 12:19 AM
To: Powell, Darren <[email protected]>; [email protected] <[email protected]>
Cc: Tuikov, Luben <[email protected]>; Quan, Evan <[email protected]>; Grodzovsky, Andrey <[email protected]>; [email protected] <[email protected]>
Subject: Re: [PATCH 1/1] amdgpu/pm: Clarify documentation of error handling in send_smc_mesg

Quoted 4 lines · Darren Powell

Contrary to the smu_cmn_send_smc_msg_with_param documentation, two cases exist where messages are silently dropped with no error returned to the caller. These cases occur in unusual situations where either:
1. the message target is a virtual GPU, or

This is not fully correct - only messages which are not valid for virtual GPU are dropped, not all.

Thanks,
Lijo

Quoted 36 lines

2. a PCI recovery is underway and the HW is not yet in sync with the SW

For more details see
commit 4ea5081c82c4 ("drm/amd/powerplay: enable SMC message filter") commit bf36b52e781d ("drm/amdgpu: Avoid accessing HW when suspending SW state")

(v2)
Reworked with suggestions from Luben & Paul

---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -3
index b8d0c70ff668..8008ae5508e6 100644
@@ -356,9 +356,11 @@ int smu_cmn_wait_for_response(struct smu_context *smu)
   * completion of the command, and return back a value from the SMU in
   * @read_arg pointer.
   *
- * Return 0 on success, -errno on error, if we weren't able to send
- * the message or if the message completed with some kind of
- * error. See __smu_cmn_reg2errno() for details of the -errno.
+ * Return 0 on success, -errno when a problem is encountered sending
+ * message or receiving reply. If there is a PCI bus recovery or
+ * the destination is a virtual GPU, the message is simply dropped and
+ * success is also returned.
+ * See __smu_cmn_reg2errno() for details of the -errno.
   *
   * If we weren't able to send the message to the SMU, we also print
   * the error to the standard log.

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

#3 lore raw
In reply to Darren Powell

I suppose I didn't quite register this on a first read:

Quoted 1 line · Darren Powell

Contrary to the smu_cmn_send_smc_msg_with_param documentation, two

I'd just say

Clarify the documentation to also mention that we drop messages and return success in the following two cases:
1. ...

That "Contrary to the ..." sounds a bit harsh.

Regards,
Luben

Quoted 37 lines

cases exist where messages are silently dropped with no error returned to the caller. These cases occur in unusual situations where either:
1. the message target is a virtual GPU, or
2. a PCI recovery is underway and the HW is not yet in sync with the SW

For more details see
commit 4ea5081c82c4 ("drm/amd/powerplay: enable SMC message filter") commit bf36b52e781d ("drm/amdgpu: Avoid accessing HW when suspending SW state")

(v2)
Reworked with suggestions from Luben & Paul

---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -3
index b8d0c70ff668..8008ae5508e6 100644
@@ -356,9 +356,11 @@ int smu_cmn_wait_for_response(struct smu_context *smu)
  * completion of the command, and return back a value from the SMU in
  * @read_arg pointer.
  *
- * Return 0 on success, -errno on error, if we weren't able to send
- * the message or if the message completed with some kind of
- * error. See __smu_cmn_reg2errno() for details of the -errno.
+ * Return 0 on success, -errno when a problem is encountered sending
+ * message or receiving reply. If there is a PCI bus recovery or
+ * the destination is a virtual GPU, the message is simply dropped and
+ * success is also returned.
+ * See __smu_cmn_reg2errno() for details of the -errno.
  *
  * If we weren't able to send the message to the SMU, we also print
  * the error to the standard log.
Quoted 1 line

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

Regards,

Signature · 1 line
Luben
#4 lore raw

[AMD Official Use Only]

Yes, it looks like I was a little snippy writing that intro, will lighten the grammar.
Thanks
Darren
________________________________
From: Tuikov, Luben <[email protected]>
Sent: Tuesday, April 12, 2022 5:09 PM
To: Powell, Darren <[email protected]>; [email protected] <[email protected]>
Cc: Quan, Evan <[email protected]>; [email protected] <[email protected]>; Grodzovsky, Andrey <[email protected]>
Subject: Re: [PATCH 1/1] amdgpu/pm: Clarify documentation of error handling in send_smc_mesg

I suppose I didn't quite register this on a first read:

Quoted 1 line · Darren Powell

Contrary to the smu_cmn_send_smc_msg_with_param documentation, two

I'd just say

Clarify the documentation to also mention that we drop messages and return success in the following two cases:
1. ...

That "Contrary to the ..." sounds a bit harsh.

Regards,
Luben

Quoted 37 lines

cases exist where messages are silently dropped with no error returned to the caller. These cases occur in unusual situations where either:
1. the message target is a virtual GPU, or
2. a PCI recovery is underway and the HW is not yet in sync with the SW

For more details see
commit 4ea5081c82c4 ("drm/amd/powerplay: enable SMC message filter") commit bf36b52e781d ("drm/amdgpu: Avoid accessing HW when suspending SW state")

(v2)
Reworked with suggestions from Luben & Paul

---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -3
index b8d0c70ff668..8008ae5508e6 100644
@@ -356,9 +356,11 @@ int smu_cmn_wait_for_response(struct smu_context *smu)
  * completion of the command, and return back a value from the SMU in
  * @read_arg pointer.
  *
- * Return 0 on success, -errno on error, if we weren't able to send
- * the message or if the message completed with some kind of
- * error. See __smu_cmn_reg2errno() for details of the -errno.
+ * Return 0 on success, -errno when a problem is encountered sending
+ * message or receiving reply. If there is a PCI bus recovery or
+ * the destination is a virtual GPU, the message is simply dropped and
+ * success is also returned.
+ * See __smu_cmn_reg2errno() for details of the -errno.
  *
  * If we weren't able to send the message to the SMU, we also print
  * the error to the standard log.
Quoted 1 line

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

Regards,
--
Luben