drm/amdgpu: optimize timeout implemention in ras_eeprom_update_record_num
Subsystems (2)
PATCH 1/1 drm/amdgpu: optimize timeout implemention in ras_eeprom_update_record_num
The busy status returned by ras_eeprom_update_record_num may not be an error, increase timeout to exclude false busy status. Also add more comments to make the code readable.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +11 -5
@@ -874,7 +874,7 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)int amdgpu_ras_eeprom_update_record_num (struct amdgpu_ras_eeprom_control *control) {struct amdgpu_device *adev =to_amdgpu_device (control); -int ret, timeout =1000 ; +int ret, retry =20 ;if (!amdgpu_ras_smu_eeprom_supported (adev))return 0 ;
@@ -882,17 +882,23 @@ int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *contro control->ras_num_recs_old = control->ras_num_recs;do { +/* 1000ms timeout is long enough, smu_get_badpage_count won't +* return -EBUSY before timeout. +*/ ret =amdgpu_ras_smu_get_badpage_count (adev, - &(control->ras_num_recs),12 ); + &(control->ras_num_recs),1000 );if (!ret && (control->ras_num_recs_old == control->ras_num_recs)) { -/* record number update in PMFW needs some time */ +/* record number update in PMFW needs some time, +* smu_get_badpage_count may return immediately without +* count update, sleep for a while and retry again. +*/ msleep (50 ); - timeout -=50 ; + retry--; }else {break ; } - }while (timeout); + }while (retry);/* no update of record number is not a real failure, * don't print warning here
Signature · 1 line
2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
I recommend defining a macro for this timeout setting
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Tao Zhou
Sent: Thursday, November 6, 2025 16:46
To: [email protected]
Cc: Zhou1, Tao <[email protected]>
Subject: [PATCH] drm/amdgpu: optimize timeout implemention in ras_eeprom_update_record_num
The busy status returned by ras_eeprom_update_record_num may not be an error, increase timeout to exclude false busy status. Also add more comments to make the code readable.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +11 -5
@@ -874,7 +874,7 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control) int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *control) {struct amdgpu_device *adev =to_amdgpu_device (control); -int ret, timeout =1000 ; +int ret, retry =20 ;if (!amdgpu_ras_smu_eeprom_supported (adev))return 0 ;
@@ -882,17 +882,23 @@ int amdgpu_ras_eeprom_update_record_num(struct amdgpu_ras_eeprom_control *contro control->ras_num_recs_old = control->ras_num_recs;do { +/* 1000ms timeout is long enough, smu_get_badpage_count won't +* return -EBUSY before timeout. +*/ ret =amdgpu_ras_smu_get_badpage_count (adev, - &(control->ras_num_recs),12 ); + &(control->ras_num_recs),1000 );if (!ret && (control->ras_num_recs_old == control->ras_num_recs)) { -/* record number update in PMFW needs some time */ +/* record number update in PMFW needs some time, +* smu_get_badpage_count may return immediately without +* count update, sleep for a while and retry again. +*/ msleep (50 ); - timeout -=50 ; + retry--; }else {break ; } - }while (timeout); + }while (retry);/* no update of record number is not a real failure, * don't print warning here
--
2.34.1