Skip to contentSkip to conversation

drm/amdgpu: Clear garbage data in err_data before usage

PATCH In review Jiawei Gu 2 participants 3 messages Jan 6, 2022

Subsystems (2)
lore
Share & tools
lore

Jiawei Gu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Clear garbage data in err_data before usage

Memory of err_data should be cleaned before usage when there're multiple entry in ras ih. Otherwise garbage data from last loop will be used.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
index 31bad1a20ed0..3f5bf5780ebf 100644
@@ -1592,6 +1592,7 @@ static void amdgpu_ras_interrupt_handler(struct ras_manager *obj)
 				/* Let IP handle its data, maybe we need get the output
 				 * from the callback to udpate the error type/count, etc
 				 */
+				memset(&err_data, 0, sizeof(err_data));
 				ret = data->cb(obj->adev, &err_data, &entry);
 				/* ue will trigger an interrupt, and in that case
 				 * we need do a reset to recovery the whole system.
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only]

May I know how do you reproduce the issue?

Quoted 38 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jiawei Gu
Sent: Thursday, January 6, 2022 5:17 PM
To: [email protected]; Clements, John <[email protected]>; Yang, Stanley <[email protected]>; Deng, Emily <[email protected]>
Cc: Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Clear garbage data in err_data before usage

Memory of err_data should be cleaned before usage when there're multiple entry in ras ih.
Otherwise garbage data from last loop will be used.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -0
index 31bad1a20ed0..3f5bf5780ebf 100644
@@ -1592,6 +1592,7 @@ static void amdgpu_ras_interrupt_handler(struct
 ras_manager *obj)
 				/* Let IP handle its data, maybe we need get

the output
* from the callback to udpate the error
type/count, etc

drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
 				 */
+				memset(&err_data, 0, sizeof(err_data));
 				ret = data->cb(obj->adev, &err_data, &entry);
 				/* ue will trigger an interrupt, and in that case
 				 * we need do a reset to recovery the whole

system.
--
2.17.1

author Reviewed-by Tao Zhou
#2 lore raw

[AMD Official Use Only]

Via ras_ctrl sys node one uncorrectable error injection on Sienna Cichlid, two interrupts will be triggered.
I was informed the two interrupts are as expected since when error address is not 64byte aligned, one 64Byte SDP request will be split to two 32Byte request in UMC and sent to dram

Then the second interrupt handling will read the garbage data in err_data.
And the consequence is that ue counter increased by 2, and page at 0x0 address will be saved unexpectedly.

Best regards,
Jiawei

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Thursday, January 6, 2022 6:05 PM
To: Gu, JiaWei (Will) <[email protected]>; [email protected]; Clements, John <[email protected]>; Yang, Stanley <[email protected]>; Deng, Emily <[email protected]>
Cc: Gu, JiaWei (Will) <[email protected]>
Subject: RE: [PATCH] drm/amdgpu: Clear garbage data in err_data before usage

[AMD Official Use Only]

May I know how do you reproduce the issue?

Quoted 36 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Jiawei Gu
Sent: Thursday, January 6, 2022 5:17 PM
To: [email protected]; Clements, John <[email protected]>; Yang, Stanley <[email protected]>; Deng, Emily <[email protected]>
Cc: Gu, JiaWei (Will) <[email protected]>
Subject: [PATCH] drm/amdgpu: Clear garbage data in err_data before usage

Memory of err_data should be cleaned before usage when there're multiple entry in ras ih.
Otherwise garbage data from last loop will be used.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +1 -0
index 31bad1a20ed0..3f5bf5780ebf 100644
@@ -1592,6 +1592,7 @@ static void amdgpu_ras_interrupt_handler(struct
 ras_manager *obj)
 				/* Let IP handle its data, maybe we need get the output
 				 * from the callback to udpate the error type/count, etc
 				 */
+				memset(&err_data, 0, sizeof(err_data));
 				ret = data->cb(obj->adev, &err_data, &entry);
 				/* ue will trigger an interrupt, and in that case

* we need do a reset to recovery the whole system.
--
2.17.1