Skip to contentSkip to conversation

drm/amd/ras: report threshold status after bad pages are saved

PATCH In review Xiang Liu 2 participants 4 messages Sep 29 – Oct 9

Subsystems (2)
lore
Share & tools
lore

Xiang Liu

author
#0 lore raw

PATCH 1/3 drm/amd/ras: report threshold status after bad pages are saved

The EEPROM table is tagged as over threshold while the new bad page records are written out, so the table status queried while the records are only queued still reports the table as writable. The device is therefore never flagged as having reached the threshold and neither the in-band CPER record nor the out-of-band RMA reason is emitted.

Re-evaluate the table status once the records have been appended, so the report is driven by the state that was just persisted.

---
 drivers/gpu/drm/amd/ras/core/ras_umc.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/ras/core/ras_umc.c +7 -0
index b3f30da19a78..c2663f84a883 100644
@@ -848,6 +848,13 @@ static int ras_umc_save_bad_pages(struct ras_core_context *ras_core)
 		RAS_DEV_INFO(ras_core->dev, "Saved %d pages to EEPROM table.\n",
 			ras_umc_count_valid_pages(ras_core,
 				&data->bps[eeprom_record_num], save_count));
+
+		/* The table is only tagged as over threshold while the new
+		 * records are written out, so the status has to be
+		 * re-evaluated here.
+		 */
+		ras_eeprom_mgr_check_and_report_status(ras_core, true);
+		ras_umc_report_badpage_info(ras_core);
 	}
 
 exit:
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/3 drm/amd/ras: report the bad page threshold in every work mode

Only the mode that halts runtime services flags the device once the bad page threshold is reached, so on a default or warn-only threshold the in-band CPER record and the out-of-band RMA reason are not emitted even though the table records that the threshold was hit.

Track the threshold condition separately from the halt decision and use it to drive the report, so every mode except the debug one tells the host that the device reached its bad page budget.

---
 drivers/gpu/drm/amd/ras/core/ras.h            | 1 +
 drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c | 4 ++++
 drivers/gpu/drm/amd/ras/core/ras_umc.c        | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/ras/core/ras.h +1 -0
index fcea457d5cbe..8c6e8ab89c58 100644
@@ -415,6 +415,7 @@ struct ras_core_context {
 	bool poison_supported;
 
 	bool is_rma;
+	bool bad_page_over_threshold;
 	bool is_initialized;
 	bool in_early_init;
 	bool early_init_service_enabled;
drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +4 -0
index 1781d037ef13..2f33e3132f76 100644
@@ -294,6 +294,9 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 				RAS_DEV_ERR(ras_core->dev, "RAS records:%d exceed threshold:%d",
 					valid_err_count, mgr->ras_err_threshold);
 
+			if (mgr->work_mode_over_thresh != RAS_WORK_MODE_OVER_THRESH_DEBUG)
+				ras_core->bad_page_over_threshold = true;
+
 			if (mgr->work_mode_over_thresh == RAS_WORK_MODE_OVER_THRESH_STRICT) {
 				RAS_DEV_WARN(ras_core->dev,
 				"Please consult AMD Service Action Guide (SAG) for appropriate service procedures\n");
@@ -315,6 +318,7 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 				RAS_DEV_ERR(ras_core->dev, "Failed to resize RAS table\n");
 			} else {
 				ras_core->is_rma = false;
+				ras_core->bad_page_over_threshold = false;
 				RAS_DEV_INFO(ras_core->dev,
 					"records:%d threshold:%d, resetting RAS table header signature",
 					valid_err_count, mgr->ras_err_threshold);
drivers/gpu/drm/amd/ras/core/ras_umc.c +1 -1
index c2663f84a883..6af41c68d83b 100644
@@ -701,7 +701,7 @@ void ras_umc_report_badpage_info(struct ras_core_context *ras_core)
 			&ras_umc->last_channel_bitmap);
 	}
 
-	if (ras_core->is_rma)
+	if (ras_core->is_rma || ras_core->bad_page_over_threshold)
 		ras_core_event_notify(ras_core, RAS_EVENT_ID__DEVICE_RMA, NULL);
 }
 
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 3/3 drm/amd/ras: init reserved vram size before RAS core sw init

In reply to Xiang Liu

The RAS core derives the bad page threshold from con->reserved_pages_in_bytes when amdgpu_ras_mgr_sw_init() builds the EEPROM configuration. That field is still zero at this point, so the threshold falls back to the 16MB default and ends up at 128 pages on ASICs that reserve 32MB.

Set the reserved vram size before RAS core sw init so the threshold is computed from the per-ASIC value.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -2
index becad704113c..0d39b1872b4c 100644
@@ -3628,6 +3628,9 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 
 	amdgpu_ras_check_supported(adev);
 
+	/* The RAS core derives the bad page threshold from this value. */
+	amdgpu_ras_init_reserved_vram_size(adev);
+
 	param.ras_feature_enable = amdgpu_ras_enable;
 	param.ras_feature_mask = amdgpu_ras_mask;
 	param.ras_bad_page_threshold = amdgpu_bad_page_threshold;
@@ -3725,8 +3728,6 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 	/* Get RAS schema for particular SOC */
 	con->schema = amdgpu_get_ras_schema(adev);
 
-	amdgpu_ras_init_reserved_vram_size(adev);
-
 	if (amdgpu_ras_fs_init(adev)) {
 		r = -EINVAL;
 		goto release_con;
Signature · 1 line
2.34.1
#3 lore raw

RE: [PATCH 3/3] drm/amd/ras: init reserved vram size before RAS core sw init

AMD General

The series is: Reviewed-by: Tao Zhou <[email protected]>

Better to let Thomas take a look at it.

Quoted 48 lines

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Tuesday, September 29, 2026 8:02 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Zhou1, Tao <[email protected]>; Yang, Stanley <[email protected]>; Chai, Thomas <[email protected]>; Liu, Xiang(Dean) <[email protected]>
Subject: [PATCH 3/3] drm/amd/ras: init reserved vram size before RAS core sw init

The RAS core derives the bad page threshold from con->reserved_pages_in_bytes when amdgpu_ras_mgr_sw_init() builds the EEPROM configuration. That field is still zero at this point, so the threshold falls back to the 16MB default and ends up at 128 pages on ASICs that reserve 32MB.

Set the reserved vram size before RAS core sw init so the threshold is computed from the per-ASIC value.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +3 -0
index becad704113c..0d39b1872b4c 100644
@@ -3628,6 +3628,9 @@ int amdgpu_ras_init(struct amdgpu_device *adev)
 
      amdgpu_ras_check_supported(adev);
 
+     /* The RAS core derives the bad page threshold from this value. */
+     amdgpu_ras_init_reserved_vram_size(adev);
+
      param.ras_feature_enable = amdgpu_ras_enable;
      param.ras_feature_mask = amdgpu_ras_mask;
      param.ras_bad_page_threshold = amdgpu_bad_page_threshold; @@ -

3725,8 +3728,6 @@ int amdgpu_ras_init(struct amdgpu_device *adev)

      /* Get RAS schema for particular SOC */
      con->schema = amdgpu_get_ras_schema(adev);
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +0 -3
-     amdgpu_ras_init_reserved_vram_size(adev);
-
      if (amdgpu_ras_fs_init(adev)) {
              r = -EINVAL;
              goto release_con;
--

2.34.1