Skip to contentSkip to conversation

amdgpu/pm: Clarify Documentation of error handling in send_smc_mesg

PATCH In review Darren Powell 3 participants 5 messages Apr 8, 2022

Subsystems (3)
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 caller 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")

---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -2
index b8d0c70ff668..b1bd1990c88b 100644
@@ -356,12 +356,15 @@ 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
+ * Return 0 on success, or if the message is dropped.
+ * On error, -errno is returned 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.
  *
  * If we weren't able to send the message to the SMU, we also print
- * the error to the standard log.
+ * the error to the standard log. Dropped messages can be caused
+ * due to PCI slot recovery or attempting to send from a virtual GPU,
+ * and do not print an error.
  *
  * Command completion status is printed only if the -errno is
  * -EREMOTEIO, indicating that the SMU returned back an

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

Signature · 1 line
2.35.1
#1 lore raw

Dear Darren,

Thank you for your patch.

Am 08.04.22 um 04:26 schrieb Darren Powell:

Quoted 9 lines

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 caller 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")

Please remove the indentation. If you re-rolled the patch, you could also spell *documentation* lowercase in the commit message summary.

Quoted 28 lines
---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -2
index b8d0c70ff668..b1bd1990c88b 100644
@@ -356,12 +356,15 @@ 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
+ * Return 0 on success, or if the message is dropped.
+ * On error, -errno is returned 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.
   *
   * If we weren't able to send the message to the SMU, we also print
- * the error to the standard log.
+ * the error to the standard log. Dropped messages can be caused
+ * due to PCI slot recovery or attempting to send from a virtual GPU,
+ * and do not print an error.
   *
   * Command completion status is printed only if the -errno is
   * -EREMOTEIO, indicating that the SMU returned back an
Quoted 1 line

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

The diff looks good – despite Mozilla Thunderbird quoting it strangely.

Kind regards,

Paul

#2 lore raw

[AMD Official Use Only]

will respin and incorporate your suggestions
Thanks,
Darren
________________________________
From: Paul Menzel <[email protected]>
Sent: Friday, April 8, 2022 2:29 AM
To: Powell, Darren <[email protected]>
Cc: [email protected] <[email protected]>; Tuikov, Luben <[email protected]>; 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

Dear Darren,

Thank you for your patch.

Am 08.04.22 um 04:26 schrieb Darren Powell:

Quoted 9 lines

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 caller 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")

Please remove the indentation. If you re-rolled the patch, you could also spell *documentation* lowercase in the commit message summary.

Quoted 28 lines
---
  drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 7 +++++--
  1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +5 -2
index b8d0c70ff668..b1bd1990c88b 100644
@@ -356,12 +356,15 @@ 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
+ * Return 0 on success, or if the message is dropped.
+ * On error, -errno is returned 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.
   *
   * If we weren't able to send the message to the SMU, we also print
- * the error to the standard log.
+ * the error to the standard log. Dropped messages can be caused
+ * due to PCI slot recovery or attempting to send from a virtual GPU,
+ * and do not print an error.
   *
   * Command completion status is printed only if the -errno is
   * -EREMOTEIO, indicating that the SMU returned back an
Quoted 1 line

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

The diff looks good – despite Mozilla Thunderbird quoting it strangely.

Kind regards,

Paul

#3 lore raw
In reply to Darren Powell

I'd add who and how is the message dropped, and also mention that we're unable to recognize a dropped message.

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 caller is a virtual GPU, or

The caller? Isn't this code executed on a CPU sending to the SMU (which lives on a GPU)?

Quoted 16 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")

---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index b8d0c70ff668..b1bd1990c88b 100644

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_wait_for_response(struct smu_context *smu) · line 360

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -1
@@ -356,12 +356,15 @@ 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
+ * Return 0 on success, or if the message is dropped.
+ * On error, -errno is returned if we weren't able to send

Something like this:

Return 0 on success, -errno on error. If the message was dropped due to PCI bus recovery or sending to a virtual GPU, we're unable to detect this and success is also returned.

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_wait_for_response(struct smu_context *smu) · line 367

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +3 -1
  * the message or if the message completed with some kind of
  * error. 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.
+ * the error to the standard log. Dropped messages can be caused
+ * due to PCI slot recovery or attempting to send from a virtual GPU,
+ * and do not print an error.

This is a moot point with the clarification I suggested above and I'd remove that.

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
  *
  * Command completion status is printed only if the -errno is
  * -EREMOTEIO, indicating that the SMU returned back an

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

Regards,

Signature · 1 line
Luben
#4 lore raw

[AMD Official Use Only]

inline

________________________________
From: Tuikov, Luben <[email protected]>
Sent: Friday, April 8, 2022 9:33 AM
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'd add who and how is the message dropped, and also mention that we're unable to recognize a dropped message.

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 caller is a virtual GPU, or

The caller? Isn't this code executed on a CPU sending to the SMU (which lives on a GPU)? [DP] Great point, will fix

Quoted 16 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")

---
 drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
index b8d0c70ff668..b1bd1990c88b 100644

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_wait_for_response(struct smu_context *smu) · line 360

Quoted 6 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +2 -1
@@ -356,12 +356,15 @@ 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
+ * Return 0 on success, or if the message is dropped.
+ * On error, -errno is returned if we weren't able to send

Something like this:

Return 0 on success, -errno on error. If the message was dropped due to PCI bus recovery or sending to a virtual GPU, we're unable to detect this and success is also returned.

drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c int smu_cmn_wait_for_response(struct smu_context *smu) · line 367

Quoted 8 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +3 -1
  * the message or if the message completed with some kind of
  * error. 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.
+ * the error to the standard log. Dropped messages can be caused
+ * due to PCI slot recovery or attempting to send from a virtual GPU,
+ * and do not print an error.

This is a moot point with the clarification I suggested above and I'd remove that. [DP] sounds more succinct, will address in v2

Quoted 5 lines
drivers/gpu/drm/amd/pm/swsmu/smu_cmn.c +0 -0
  *
  * Command completion status is printed only if the -errno is
  * -EREMOTEIO, indicating that the SMU returned back an

base-commit: 4585c45a6a66cb17cc97f4370457503746e540b7

Regards,
--
Luben