Skip to contentSkip to conversation

drm/amd/ras: report bad page threshold only when exceeded

PATCH In review Xiang Liu 2 participants 3 messages Sep 30 – Oct 9

Subsystems (2)
lore
Share & tools
lore

Xiang Liu

author
#0 lore raw

PATCH 1/2 drm/amd/ras: report bad page threshold only when exceeded

Report a bad page threshold breach only when the saved record count exceeds the configured limit. Allow unlocking at equality to keep the EEPROM status consistent with that boundary.

---
 drivers/gpu/drm/amd/ras/core/eeprom.c         | 2 +-
 drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/ras/core/eeprom.c +1 -1
index e7aad113b98a..562763d33ac8 100644
@@ -693,7 +693,7 @@ static int ras_eeprom_update_header(struct ras_eeprom_control *control)
 	record_count = ras_umc_get_saved_eeprom_count(ras_core);
 	/* Modify the header if it exceeds.
 	 */
-	if (record_count >= control->record_threshold_count) {
+	if (record_count > control->record_threshold_count) {
 		control->tbl_hdr.header = RAS_TABLE_HDR_BAD;
 		if (control->tbl_hdr.version >= RAS_TABLE_VER_V2_1) {
 			control->tbl_rai.rma_status = RAS_GPU_RETIRED__ECC_REACH_THRESHOLD;
drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +4 -4
index 2f33e3132f76..e90f89be7ebf 100644
@@ -286,7 +286,7 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 				valid_err_count, mgr->ras_err_threshold);
 
 	} else if (info.eeprom_status == RAS_EEPROM_LOCKED) {
-		if (info.rma_status || (valid_err_count >= mgr->ras_err_threshold)) {
+		if (info.rma_status || valid_err_count > mgr->ras_err_threshold) {
 			if (info.rma_status)
 				RAS_DEV_ERR(ras_core->dev, "RAS records:%d exceed error threshold",
 					valid_err_count);
@@ -305,13 +305,13 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 				RAS_DEV_ERR(ras_core->dev,
 				"User defined threshold is set, runtime service will be halt when threshold is reached\n");
 			}
-		} else if ((valid_err_count < mgr->ras_err_threshold) &&
+		} else if ((valid_err_count <= mgr->ras_err_threshold) &&
 				mgr->eeprom_ops->unlock_eeprom) {
 			/* This means that, the threshold was increased since
 			 * the last time the system was booted, and now,
-			 * the saved error count is less than threshold,
+			 * the saved error count does not exceed the threshold,
 			 * so that at least one more record can be saved,
-			 * before the page count threshold is reached.
+			 * before the page count threshold is exceeded.
 			 */
 			ret = mgr->eeprom_ops->unlock_eeprom(ras_core);
 			if (ret) {
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 2/2 drm/amd/ras: use page units in EEPROM status messages

Report the actual bad page count and convert the record threshold to pages using the per-ASIC row size. Keep threshold decisions in record units.

---
 drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c | 29 +++++++++++--------
 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +17 -12
index e90f89be7ebf..6cafda806d19 100644
@@ -260,6 +260,7 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 {
 	struct ras_eeprom_mgr *mgr = &ras_core->eeprom_mgr;
 	struct ras_eeprom_info info = {0};
+	u32 bad_page_count, bad_page_threshold;
 	int valid_err_count;
 	int ret = 0;
 
@@ -274,25 +275,29 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 		return ret;
 
 	valid_err_count = ras_umc_get_saved_eeprom_count(ras_core);
+	bad_page_count = ras_umc_get_badpage_count(ras_core);
+	bad_page_threshold = mgr->ras_err_threshold * ras_core->ras_umc.max_pages_per_row;
 	if (info.eeprom_status == RAS_EEPROM_OK) {
 		RAS_DEV_DBG(ras_core->dev,
-			"Found existing EEPROM table with %d records\n",
-			valid_err_count);
+			"Found existing EEPROM table with %u records\n",
+			bad_page_count);
 
 		/* Warn if error count reaches or exceeds 90% of the threshold */
 		if (10 * valid_err_count >= 9 * mgr->ras_err_threshold)
 			RAS_DEV_WARN(ras_core->dev,
-				"RAS records:%u exceeds 90%% of threshold:%d\n",
-				valid_err_count, mgr->ras_err_threshold);
+				"RAS records:%u exceeds 90%% of threshold:%u\n",
+				bad_page_count, bad_page_threshold);
 
 	} else if (info.eeprom_status == RAS_EEPROM_LOCKED) {
 		if (info.rma_status || valid_err_count > mgr->ras_err_threshold) {
 			if (info.rma_status)
-				RAS_DEV_ERR(ras_core->dev, "RAS records:%d exceed error threshold",
-					valid_err_count);
+				RAS_DEV_ERR(ras_core->dev,
+					    "RAS records:%u exceed error threshold",
+					    bad_page_count);
 			else
-				RAS_DEV_ERR(ras_core->dev, "RAS records:%d exceed threshold:%d",
-					valid_err_count, mgr->ras_err_threshold);
+				RAS_DEV_ERR(ras_core->dev,
+					    "RAS records:%u exceed threshold:%u",
+					    bad_page_count, bad_page_threshold);
 
 			if (mgr->work_mode_over_thresh != RAS_WORK_MODE_OVER_THRESH_DEBUG)
 				ras_core->bad_page_over_threshold = true;
@@ -320,13 +325,13 @@ int ras_eeprom_mgr_check_and_report_status(struct ras_core_context *ras_core, bo
 				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);
+					"records:%u threshold:%u, resetting RAS table header signature",
+					bad_page_count, bad_page_threshold);
 			}
 		} else {
 			RAS_DEV_ERR(ras_core->dev,
-				"records:%d threshold:%d, not support to resize RAS table\n",
-				valid_err_count, mgr->ras_err_threshold);
+				"records:%u threshold:%u, not support to resize RAS table\n",
+				bad_page_count, bad_page_threshold);
 		}
 	} else {
 		RAS_DEV_ERR(ras_core->dev, "Error ras eeprom status:0x%x\n", info.eeprom_status);
Signature · 1 line
2.34.1
Reviewed-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] drm/amd/ras: use page units in EEPROM status messages

AMD General

The series is:

Quoted 99 lines

-----Original Message-----
From: Liu, Xiang(Dean) <[email protected]>
Sent: Wednesday, September 30, 2026 4:40 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 2/2] drm/amd/ras: use page units in EEPROM status messages

Report the actual bad page count and convert the record threshold to pages using the per-ASIC row size. Keep threshold decisions in record units.

---
 drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c | 29 +++++++++++--------
 1 file changed, 17 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +1 -0
index e90f89be7ebf..6cafda806d19 100644
@@ -260,6 +260,7 @@ int ras_eeprom_mgr_check_and_report_status(struct
 ras_core_context *ras_core, bo  {
      struct ras_eeprom_mgr *mgr = &ras_core->eeprom_mgr;
      struct ras_eeprom_info info = {0};
+     u32 bad_page_count, bad_page_threshold;
      int valid_err_count;
      int ret = 0;
 
@@ -274,25 +275,29 @@ int ras_eeprom_mgr_check_and_report_status(struct

ras_core_context *ras_core, bo

              return ret;

      valid_err_count = ras_umc_get_saved_eeprom_count(ras_core);
drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +7 -5
+     bad_page_count = ras_umc_get_badpage_count(ras_core);
+     bad_page_threshold = mgr->ras_err_threshold *
+ras_core->ras_umc.max_pages_per_row;
      if (info.eeprom_status == RAS_EEPROM_OK) {
              RAS_DEV_DBG(ras_core->dev,
-                     "Found existing EEPROM table with %d records\n",
-                     valid_err_count);
+                     "Found existing EEPROM table with %u records\n",
+                     bad_page_count);
 
              /* Warn if error count reaches or exceeds 90% of the threshold */
              if (10 * valid_err_count >= 9 * mgr->ras_err_threshold)
                      RAS_DEV_WARN(ras_core->dev,
-                             "RAS records:%u exceeds 90%% of threshold:%d\n",
-                             valid_err_count, mgr->ras_err_threshold);
+                             "RAS records:%u exceeds 90%% of threshold:%u\n",
+                             bad_page_count, bad_page_threshold);
 
      } else if (info.eeprom_status == RAS_EEPROM_LOCKED) {
              if (info.rma_status || valid_err_count > mgr->ras_err_threshold) {
                      if (info.rma_status)
-                             RAS_DEV_ERR(ras_core->dev, "RAS records:%d

exceed error threshold",

drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +3 -2
-                                     valid_err_count);
+                             RAS_DEV_ERR(ras_core->dev,
+                                         "RAS records:%u exceed error threshold",
+                                         bad_page_count);
                      else
-                             RAS_DEV_ERR(ras_core->dev, "RAS records:%d

exceed threshold:%d",

drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +3 -1
-                                     valid_err_count, mgr->ras_err_threshold);
+                             RAS_DEV_ERR(ras_core->dev,
+                                         "RAS records:%u exceed threshold:%u",
+                                         bad_page_count, bad_page_threshold);
 
                      if (mgr->work_mode_over_thresh !=

RAS_WORK_MODE_OVER_THRESH_DEBUG)

                              ras_core->bad_page_over_threshold = true; @@ -
320,13 +325,13 @@ int ras_eeprom_mgr_check_and_report_status(struct
ras_core_context *ras_core, bo
                              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",

drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +1 -1
-                                     valid_err_count, mgr->ras_err_threshold);
+                                     "records:%u threshold:%u, resetting RAS table

header signature",

drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +1 -1
+                                     bad_page_count, bad_page_threshold);
                      }
              } else {
                      RAS_DEV_ERR(ras_core->dev,
-                             "records:%d threshold:%d, not support to resize RAS

table\n",

drivers/gpu/drm/amd/ras/core/ras_eeprom_mgr.c +1 -1
-                             valid_err_count, mgr->ras_err_threshold);
+                             "records:%u threshold:%u, not support to resize RAS

table\n",

+                             bad_page_count, bad_page_threshold);
              }
      } else {
              RAS_DEV_ERR(ras_core->dev, "Error ras eeprom status:0x%x\n",

info.eeprom_status);
--
2.34.1