Skip to contentSkip to conversation

drm/amdgpu: report bad status in GPU recovery

PATCH In review Tao Zhou 3 participants 11 messages Jul 31, 2024 – Aug 1, 2024

Subsystems (2)
lore
Share & tools
lore

Tao Zhou

author
#0 lore raw

PATCH 1/1 drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		tmp_adev->asic_reset_res = 0;
 
 		if (r) {
-			/* bad news, how to tell it to userspace ? */
-			dev_info(tmp_adev->dev, "GPU reset(%d) failed\n", atomic_read(&tmp_adev->gpu_reset_counter));
+			/* bad news, how to tell it to userspace ?
+			 * for ras error, we should report GPU bad status instead of
+			 * reset failure
+			 */
+			if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+				dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
+					atomic_read(&tmp_adev->gpu_reset_counter));
 			amdgpu_vf_error_put(tmp_adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
 		} else {
 			dev_info(tmp_adev->dev, "GPU reset(%d) succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter));
Signature · 1 line
2.34.1
#1 lore raw
Quoted 14 lines · Tao Zhou

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
 		tmp_adev->asic_reset_res = 0;
 

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev, · line 5942

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -2
 		if (r) {
-			/* bad news, how to tell it to userspace ? */
-			dev_info(tmp_adev->dev, "GPU reset(%d) failed\n", atomic_read(&tmp_adev->gpu_reset_counter));
+			/* bad news, how to tell it to userspace ?
+			 * for ras error, we should report GPU bad status instead of
+			 * reset failure
+			 */
+			if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+				dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
+					atomic_read(&tmp_adev->gpu_reset_counter));

Better to check reset_context.src == AMDGPU_RESET_SRC_RAS to confirm that the reset is indeed triggered due to ras error.

Thanks,
Lijo

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
 			amdgpu_vf_error_put(tmp_adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
 		} else {
 			dev_info(tmp_adev->dev, "GPU reset(%d) succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter));
author
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 35 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, July 31, 2024 9:31 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: report bad status in GPU recovery

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct

Quoted 13 lines · Tao Zhou

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -2
            tmp_adev->asic_reset_res = 0;
 
            if (r) {
-                   /* bad news, how to tell it to userspace ? */
-                   dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",

atomic_read(&tmp_adev->gpu_reset_counter));

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5937

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
+                   /* bad news, how to tell it to userspace ?
+                    * for ras error, we should report GPU bad status instead

of

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+                    * reset failure
+                    */
+                   if
Quoted 8 lines

(!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5941

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+                           dev_info(tmp_adev->dev, "GPU reset(%d)

failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5943

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+                                   atomic_read(&tmp_adev-
 gpu_reset_counter));

Better to check reset_context.src == AMDGPU_RESET_SRC_RAS to confirm that the reset is indeed triggered due to ras error.

[Tao] It seems AMDGPU_RESET_SRC_RAS is not used currently, I will set it before use the flag.

Quoted 10 lines

Thanks,
Lijo

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5944

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
                    amdgpu_vf_error_put(tmp_adev,

AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
            } else {
                    dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n",

Quoted 1 line

atomic_read(&tmp_adev->gpu_reset_counter));

#3 lore raw
Quoted 39 lines · Tao

[AMD Official Use Only - AMD Internal Distribution Only]

Quoted 37 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Wednesday, July 31, 2024 9:31 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: report bad status in GPU recovery

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct

Quoted 13 lines · Tao Zhou

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct

amdgpu_device *adev,

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev,

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -2
            tmp_adev->asic_reset_res = 0;
 
            if (r) {
-                   /* bad news, how to tell it to userspace ? */
-                   dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",

atomic_read(&tmp_adev->gpu_reset_counter));

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5937

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
+                   /* bad news, how to tell it to userspace ?
+                    * for ras error, we should report GPU bad status instead

of

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct amdgpu_device *adev,

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
+                    * reset failure
+                    */
+                   if

(!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+                           dev_info(tmp_adev->dev, "GPU reset(%d)
Quoted 9 lines
Quoted 6 lines

failed\n",

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5943

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
+                                   atomic_read(&tmp_adev-
 gpu_reset_counter));

Better to check reset_context.src == AMDGPU_RESET_SRC_RAS to confirm that the reset is indeed triggered due to ras error.

[Tao] It seems AMDGPU_RESET_SRC_RAS is not used currently, I will set it before use the flag.

It's set here -
https://elixir.bootlin.com/linux/v6.11-rc1/source/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c#L2607

Thanks,
Lijo

Quoted 10 lines
Quoted 10 lines

Thanks,
Lijo

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c int amdgpu_device_gpu_recover(struct · line 5944

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
                    amdgpu_vf_error_put(tmp_adev,

AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
            } else {
                    dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n",

Quoted 1 line

atomic_read(&tmp_adev->gpu_reset_counter));

#4 lore raw
In reply to Tao Zhou

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n", atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
+                                       atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev, AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d) succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter));

--
2.34.1

author
#5 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

I think the if condition in amdgpu_ras_eeprom_check_err_threshold is good enough, no need to update it with is_rma.

Tao

Quoted 56 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 11:00 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
 atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
+                                       atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev,
AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d) succeeded!\n",

atomic_read(&tmp_adev->gpu_reset_counter));
--
2.34.1

#6 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Right, it's functional. My concern is whether the kernel message in amdgpu_ras_eeprom_check_err_threshold will be printed twice. This is the end of gpu recovery (i.e., report gpu reset failed or gpu reset succeed). Check_err_threshold was already done before reaching here.

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, August 1, 2024 11:49
To: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

I think the if condition in amdgpu_ras_eeprom_check_err_threshold is good enough, no need to update it with is_rma.

Tao

Quoted 58 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 11:00 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +8 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
 atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
+
+ atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev,
AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter)); --
2.34.1

author
#7 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Yes, the bad status message is printed twice with this patch. I think it's harmless and the second message is more convenient for customer.

I can add a parameter for amdgpu_ras_eeprom_check_err_threshold to disable the first message if you think printing message twice is not a good idea.

Tao

Quoted 90 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 1:30 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Right, it's functional. My concern is whether the kernel message in amdgpu_ras_eeprom_check_err_threshold will be printed twice. This is the end of gpu recovery (i.e., report gpu reset failed or gpu reset succeed). Check_err_threshold was already done before reaching here.

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, August 1, 2024 11:49
To: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

I think the if condition in amdgpu_ras_eeprom_check_err_threshold is good enough, no need to update it with is_rma.

Tao

Quoted 59 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 11:00 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
 atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU reset(%d)
+ failed\n",
+
+ atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev,
AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter)); --
2.34.1

#8 lore raw
Quoted 8 lines · Tao

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

Yes, the bad status message is printed twice with this patch. I think it's harmless and the second message is more convenient for customer.

I can add a parameter for amdgpu_ras_eeprom_check_err_threshold to disable the first message if you think printing message twice is not a good idea.

Instead of this way, can't this be added to amdgpu_ras_do_recovery() and stop all recovery actions?

Thanks,
Lijo

Quoted 93 lines

Tao

Quoted 90 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 1:30 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Right, it's functional. My concern is whether the kernel message in amdgpu_ras_eeprom_check_err_threshold will be printed twice. This is the end of gpu recovery (i.e., report gpu reset failed or gpu reset succeed). Check_err_threshold was already done before reaching here.

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, August 1, 2024 11:49
To: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

I think the if condition in amdgpu_ras_eeprom_check_err_threshold is good enough, no need to update it with is_rma.

Tao

Quoted 59 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 11:00 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
 atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU reset(%d)
+ failed\n",
+
+ atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev,
AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter)); --
2.34.1

author
#9 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

We need to perform gpu reset for HW and only make the reset flow failing from driver perspective.

Tao

Quoted 121 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Thursday, August 1, 2024 2:41 PM
To: Zhou1, Tao <[email protected]>; Zhang, Hawking <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu: report bad status in GPU recovery

Quoted 5 lines · Tao

[AMD Official Use Only - AMD Internal Distribution Only]

[AMD Official Use Only - AMD Internal Distribution Only]

Yes, the bad status message is printed twice with this patch. I think it's harmless

and the second message is more convenient for customer.

Quoted 2 lines

I can add a parameter for amdgpu_ras_eeprom_check_err_threshold to disable

the first message if you think printing message twice is not a good idea.

Quoted 1 line

Instead of this way, can't this be added to amdgpu_ras_do_recovery() and stop all recovery actions?

Thanks,
Lijo

Quoted 94 lines

Tao

Quoted 91 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 1:30 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Right, it's functional. My concern is whether the kernel message in amdgpu_ras_eeprom_check_err_threshold will be printed twice. This is the end of gpu recovery (i.e., report gpu reset failed or gpu reset succeed). Check_err_threshold was already done before reaching here.

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, August 1, 2024 11:49
To: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

I think the if condition in amdgpu_ras_eeprom_check_err_threshold is good enough, no need to update it with is_rma.

Tao

Quoted 59 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 11:00 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
 atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU
+ reset(%d) failed\n",
+
+ atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev,
AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter)); --
2.34.1

#10 lore raw
In reply to Zhou1, Tao

[AMD Official Use Only - AMD Internal Distribution Only]

How about replace amdgpu_ras_eeprom_check_err_threshold with ras->is_rma and move amdgpu_ras_eeprom_check_err_threshold to end of gpu recovery as the change you made. In such case we don;'t need to add a paremter in the function just to disable a few messages. And also the message will be the end of gpu recovery as a reminder.

amdgpu_do_asic_reset
if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev)) { /* must succeed. */ amdgpu_ras_resume(tmp_adev);

} else {
        r = -EINVAL;
        goto out;
}

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, August 1, 2024 13:58
To: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Yes, the bad status message is printed twice with this patch. I think it's harmless and the second message is more convenient for customer.

I can add a parameter for amdgpu_ras_eeprom_check_err_threshold to disable the first message if you think printing message twice is not a good idea.

Tao

Quoted 91 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 1:30 PM
To: Zhou1, Tao <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Right, it's functional. My concern is whether the kernel message in amdgpu_ras_eeprom_check_err_threshold will be printed twice. This is the end of gpu recovery (i.e., report gpu reset failed or gpu reset succeed). Check_err_threshold was already done before reaching here.

Regards,
Hawking

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, August 1, 2024 11:49
To: Zhang, Hawking <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

I think the if condition in amdgpu_ras_eeprom_check_err_threshold is good enough, no need to update it with is_rma.

Tao

Quoted 59 lines

-----Original Message-----
From: Zhang, Hawking <[email protected]>
Sent: Thursday, August 1, 2024 11:00 AM
To: Zhou1, Tao <[email protected]>; [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: report bad status in GPU recovery

[AMD Official Use Only - AMD Internal Distribution Only]

Might consider leverage is_RMA flag for the same purpose?

Regards,
Hawking

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Wednesday, July 31, 2024 18:05
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: report bad status in GPU recovery

Instead of printing GPU reset failed.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +9 -2
index 355c2478c4b6..b7c967779b4b 100644
@@ -5933,8 +5933,13 @@ int amdgpu_device_gpu_recover(struct
 amdgpu_device *adev,
                tmp_adev->asic_reset_res = 0;
 
                if (r) {
-                       /* bad news, how to tell it to userspace ? */
-                       dev_info(tmp_adev->dev, "GPU reset(%d) failed\n",
 atomic_read(&tmp_adev->gpu_reset_counter));
+                       /* bad news, how to tell it to userspace ?
+                        * for ras error, we should report GPU bad status instead of
+                        * reset failure
+                        */
+                       if (!amdgpu_ras_eeprom_check_err_threshold(tmp_adev))
+                               dev_info(tmp_adev->dev, "GPU
+ reset(%d) failed\n",
+
+ atomic_read(&tmp_adev->gpu_reset_counter));
                        amdgpu_vf_error_put(tmp_adev,
AMDGIM_ERROR_VF_GPU_RESET_FAIL, 0, r);
                } else {
                        dev_info(tmp_adev->dev, "GPU reset(%d)

succeeded!\n", atomic_read(&tmp_adev->gpu_reset_counter)); --
2.34.1