Skip to contentSkip to conversation

drm/amdgpu: Warn when bad pages approaches 90% threshold

PATCH In review Kent Russell 4 participants 14 messages Oct 21, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdgpu: Warn when bad pages approaches 90% threshold

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +6 -0
index f4c05ff4b26c..ce5089216474 100644
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
 		if (res)
 			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
 				  res);
+
+		/* Warn if we are at 90% of the threshold or above */
+		if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))
+			DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+					control->ras_num_recs,
+					ras->bad_page_cnt_threshold);
 	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
 		   amdgpu_bad_page_threshold != 0) {
 		res = __verify_ras_table_checksum(control);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

When a GPU hits the bad_page_threshold, it will not be initialized by the amdgpu driver. This means that the table cannot be cleared, nor can information gathering be performed (getting serial number, BDF, etc).

If the bad_page_threshold kernel parameter is set to -2, continue to initialize the GPU, while printing a warning to dmesg that this action has been done

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 12 ++++++++----
 3 files changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index d58e37fd01f4..b85b67a88a3d 100644
@@ -205,6 +205,7 @@ extern struct amdgpu_mgpu_info mgpu_info;
 extern int amdgpu_ras_enable;
 extern uint amdgpu_ras_mask;
 extern int amdgpu_bad_page_threshold;
+extern bool amdgpu_ignore_bad_page_threshold;
 extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer;
 extern int amdgpu_async_gfx_ring;
 extern int amdgpu_mcbp;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 96bd63aeeddd..eee3cf874e7a 100644
@@ -877,7 +877,7 @@ module_param_named(reset_method, amdgpu_reset_method, int, 0444);
  * result in the GPU entering bad status when the number of total
  * faulty pages by ECC exceeds the threshold value.
  */
-MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement)");
+MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement, -2 = ignore bad page threshold)");
 module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444);
 
 MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup (8 if set to greater than 8 or less than 0, only affect gfx 8+)");
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +8 -4
index ce5089216474..bd6ed43b0df2 100644
@@ -1104,11 +1104,15 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
 			res = amdgpu_ras_eeprom_correct_header_tag(control,
 								   RAS_TABLE_HDR_VAL);
 		} else {
-			*exceed_err_limit = true;
-			dev_err(adev->dev,
-				"RAS records:%d exceed threshold:%d, "
-				"GPU will not be initialized. Replace this GPU or increase the threshold",
+			dev_err(adev->dev, "RAS records:%d exceed threshold:%d",
 				control->ras_num_recs, ras->bad_page_cnt_threshold);
+			if (amdgpu_bad_page_threshold == -2) {
+				dev_warn(adev->dev, "GPU will be initialized due to bad_page_threshold = -2.");
+				res = 0;
+			} else {
+				*exceed_err_limit = true;
+				dev_err(adev->dev, "GPU will not be initialized. Replace this GPU or increase the threshold.");
+			}
 		}
 	} else {
 		DRM_INFO("Creating a new EEPROM table");
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

Quoted 49 lines · Kent Russell

When a GPU hits the bad_page_threshold, it will not be initialized by the amdgpu driver. This means that the table cannot be cleared, nor can information gathering be performed (getting serial number, BDF, etc).

If the bad_page_threshold kernel parameter is set to -2, continue to initialize the GPU, while printing a warning to dmesg that this action has been done

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 12 ++++++++----
 3 files changed, 10 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index d58e37fd01f4..b85b67a88a3d 100644
@@ -205,6 +205,7 @@ extern struct amdgpu_mgpu_info mgpu_info;
 extern int amdgpu_ras_enable;
 extern uint amdgpu_ras_mask;
 extern int amdgpu_bad_page_threshold;
+extern bool amdgpu_ignore_bad_page_threshold;
 extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer;
 extern int amdgpu_async_gfx_ring;
 extern int amdgpu_mcbp;
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 96bd63aeeddd..eee3cf874e7a 100644
@@ -877,7 +877,7 @@ module_param_named(reset_method, amdgpu_reset_method, int, 0444);
  * result in the GPU entering bad status when the number of total
  * faulty pages by ECC exceeds the threshold value.
  */
-MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement)");
+MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement, -2 = ignore bad page threshold)");
 module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444);
 
 MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup (8 if set to greater than 8 or less than 0, only affect gfx 8+)");
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
index ce5089216474..bd6ed43b0df2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1108

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -4
@@ -1104,11 +1104,15 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
 			res = amdgpu_ras_eeprom_correct_header_tag(control,
 								   RAS_TABLE_HDR_VAL);
 		} else {
-			*exceed_err_limit = true;
-			dev_err(adev->dev,
-				"RAS records:%d exceed threshold:%d, "
-				"GPU will not be initialized. Replace this GPU or increase the threshold",
+			dev_err(adev->dev, "RAS records:%d exceed threshold:%d",
 				control->ras_num_recs, ras->bad_page_cnt_threshold); 

I thought this would all go in a single set of patches. I wasn't aware a singleton patch went in already which changed just this line--this change was always a part of a patch set.

Regards,
Luben

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +7 -0
+			if (amdgpu_bad_page_threshold == -2) {
+				dev_warn(adev->dev, "GPU will be initialized due to bad_page_threshold = -2.");
+				res = 0;
+			} else {
+				*exceed_err_limit = true;
+				dev_err(adev->dev, "GPU will not be initialized. Replace this GPU or increase the threshold.");
+			}
 		}
 	} else {
 		DRM_INFO("Creating a new EEPROM table");
#3 lore raw

RE: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

[AMD Official Use Only]

Quoted 75 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Thursday, October 21, 2021 12:21 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>; Kuehling, Felix <[email protected]>; Tuikov, Luben <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

Quoted 13 lines · Kent Russell

When a GPU hits the bad_page_threshold, it will not be initialized by the amdgpu driver. This means that the table cannot be cleared, nor can information gathering be performed (getting serial number, BDF, etc).

If the bad_page_threshold kernel parameter is set to -2, continue to initialize the GPU, while printing a warning to dmesg that this action has been done

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 12 ++++++++----
 3 files changed, 10 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu.h

Review

Quoted 12 lines

index d58e37fd01f4..b85b67a88a3d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -205,6 +205,7 @@ extern struct amdgpu_mgpu_info mgpu_info;
 extern int amdgpu_ras_enable;
 extern uint amdgpu_ras_mask;
 extern int amdgpu_bad_page_threshold;
+extern bool amdgpu_ignore_bad_page_threshold;
 extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer;
 extern int amdgpu_async_gfx_ring;
 extern int amdgpu_mcbp;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method,

Quoted 4 lines

index 96bd63aeeddd..eee3cf874e7a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -877,7 +877,7 @@ module_param_named(reset_method, amdgpu_reset_method,

int, 0444);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, int, 0444);

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
  * result in the GPU entering bad status when the number of total
  * faulty pages by ECC exceeds the threshold value.
  */
-MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default

value), 0 = disable bad page retirement)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, · line 880

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default

value), 0 = disable bad page retirement, -2 = ignore bad page threshold)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, int, 0444);

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
 module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444);
 
 MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup

(8 if set to greater than 8 or less than 0, only affect gfx 8+)");

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct

Quoted 4 lines

index ce5089216474..bd6ed43b0df2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
@@ -1104,11 +1104,15 @@ int amdgpu_ras_eeprom_init(struct

amdgpu_ras_eeprom_control *control,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -4
 			res = amdgpu_ras_eeprom_correct_header_tag(control,
 								   RAS_TABLE_HDR_VAL);
 		} else {
-			*exceed_err_limit = true;
-			dev_err(adev->dev,
-				"RAS records:%d exceed threshold:%d, "
-				"GPU will not be initialized. Replace this GPU or increase the

threshold",

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1108

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+			dev_err(adev->dev, "RAS records:%d exceed threshold:%d",
 				control->ras_num_recs, ras->bad_page_cnt_threshold);

I thought this would all go in a single set of patches. I wasn't aware a singleton patch went in already which changed just this line--this change was always a part of a patch set.

Ah sorry. When you reviewed the original patch2 clarifying the message, I merged it and then re-submitted the remaining 3 (which pared down to 2) for review. Sorry for the confusion, I was trying to minimize the number of moving parts.

Kent

Quoted 15 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct · line 1110

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
+			if (amdgpu_bad_page_threshold == -2) {
+				dev_warn(adev->dev, "GPU will be initialized due to

bad_page_threshold = -2.");

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -0
+				res = 0;
+			} else {
+				*exceed_err_limit = true;
+				dev_err(adev->dev, "GPU will not be initialized. Replace this

GPU or increase the threshold.");

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+			}
 		}
 	} else {
 		DRM_INFO("Creating a new EEPROM table");
#4 lore raw

Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

Quoted 79 lines · Kent

[AMD Official Use Only]

Quoted 75 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Thursday, October 21, 2021 12:21 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>; Kuehling, Felix <[email protected]>; Tuikov, Luben <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

Quoted 13 lines · Kent Russell

When a GPU hits the bad_page_threshold, it will not be initialized by the amdgpu driver. This means that the table cannot be cleared, nor can information gathering be performed (getting serial number, BDF, etc).

If the bad_page_threshold kernel parameter is set to -2, continue to initialize the GPU, while printing a warning to dmesg that this action has been done

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 12 ++++++++----
 3 files changed, 10 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu.h

Review

Quoted 12 lines

index d58e37fd01f4..b85b67a88a3d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -205,6 +205,7 @@ extern struct amdgpu_mgpu_info mgpu_info;
 extern int amdgpu_ras_enable;
 extern uint amdgpu_ras_mask;
 extern int amdgpu_bad_page_threshold;
+extern bool amdgpu_ignore_bad_page_threshold;
 extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer;
 extern int amdgpu_async_gfx_ring;
 extern int amdgpu_mcbp;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method,

Quoted 4 lines

index 96bd63aeeddd..eee3cf874e7a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -877,7 +877,7 @@ module_param_named(reset_method, amdgpu_reset_method,

int, 0444);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, int, 0444);

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
  * result in the GPU entering bad status when the number of total
  * faulty pages by ECC exceeds the threshold value.
  */
-MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default

value), 0 = disable bad page retirement)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, · line 880

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default

value), 0 = disable bad page retirement, -2 = ignore bad page threshold)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, int, 0444);

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
 module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444);
 
 MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup

(8 if set to greater than 8 or less than 0, only affect gfx 8+)");

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct

Quoted 4 lines

index ce5089216474..bd6ed43b0df2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
@@ -1104,11 +1104,15 @@ int amdgpu_ras_eeprom_init(struct

amdgpu_ras_eeprom_control *control,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -4
 			res = amdgpu_ras_eeprom_correct_header_tag(control,
 								   RAS_TABLE_HDR_VAL);
 		} else {
-			*exceed_err_limit = true;
-			dev_err(adev->dev,
-				"RAS records:%d exceed threshold:%d, "
-				"GPU will not be initialized. Replace this GPU or increase the

threshold",

Quoted 6 lines
Quoted 5 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1108

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+			dev_err(adev->dev, "RAS records:%d exceed threshold:%d",
 				control->ras_num_recs, ras->bad_page_cnt_threshold);

I thought this would all go in a single set of patches. I wasn't aware a singleton patch went in already which changed just this line--this change was always a part of a patch set.

Ah sorry. When you reviewed the original patch2 clarifying the message, I merged it and then re-submitted the remaining 3 (which pared down to 2) for review. Sorry for the confusion, I was trying to minimize the number of moving parts.

Admittedly, now you have 3 patches, one singleton and two coming in. Would've probably be best to submit only the current two.

No worries for now--for the future.

Regards,
Luben

Quoted 18 lines

Kent

Quoted 15 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct · line 1110

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
+			if (amdgpu_bad_page_threshold == -2) {
+				dev_warn(adev->dev, "GPU will be initialized due to

bad_page_threshold = -2.");

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -0
+				res = 0;
+			} else {
+				*exceed_err_limit = true;
+				dev_err(adev->dev, "GPU will not be initialized. Replace this

GPU or increase the threshold.");

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+			}
 		}
 	} else {
 		DRM_INFO("Creating a new EEPROM table");
#5 lore raw

RE: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

[AMD Official Use Only]

Quoted 98 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Thursday, October 21, 2021 12:47 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>; Kuehling, Felix <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

Quoted 11 lines · Kent

[AMD Official Use Only]

Quoted 7 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Thursday, October 21, 2021 12:21 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>; Kuehling, Felix <[email protected]>; Tuikov, Luben <[email protected]>
Subject: Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad

page

Quoted 37 lines
Quoted 37 lines

threshold

Quoted 13 lines · Kent Russell

When a GPU hits the bad_page_threshold, it will not be initialized by the amdgpu driver. This means that the table cannot be cleared, nor can information gathering be performed (getting serial number, BDF, etc).

If the bad_page_threshold kernel parameter is set to -2, continue to initialize the GPU, while printing a warning to dmesg that this action has been done

Review

Quoted 7 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c        |  2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 12 ++++++++----
 3 files changed, 10 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu.h

Review

Quoted 12 lines

index d58e37fd01f4..b85b67a88a3d 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -205,6 +205,7 @@ extern struct amdgpu_mgpu_info mgpu_info;
 extern int amdgpu_ras_enable;
 extern uint amdgpu_ras_mask;
 extern int amdgpu_bad_page_threshold;
+extern bool amdgpu_ignore_bad_page_threshold;
 extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer;
 extern int amdgpu_async_gfx_ring;
 extern int amdgpu_mcbp;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Quoted 4 lines
Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method,

Quoted 4 lines

index 96bd63aeeddd..eee3cf874e7a 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
@@ -877,7 +877,7 @@ module_param_named(reset_method,

amdgpu_reset_method,

Quoted 9 lines
Quoted 9 lines

int, 0444);

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, amdgpu_reset_method, int, 0444);

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -1
  * result in the GPU entering bad status when the number of total
  * faulty pages by ECC exceeds the threshold value.
  */
-MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default

value), 0 = disable bad page retirement)");

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, · line 880

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -0
+MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default

value), 0 = disable bad page retirement, -2 = ignore bad page threshold)");

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
 module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int,

0444);

Quoted 2 lines
Quoted 2 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c module_param_named(reset_method, · line 882

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
 MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to

setup

Quoted 16 lines
Quoted 16 lines

(8 if set to greater than 8 or less than 0, only affect gfx 8+)");

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct

Quoted 4 lines

index ce5089216474..bd6ed43b0df2 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
@@ -1104,11 +1104,15 @@ int amdgpu_ras_eeprom_init(struct

amdgpu_ras_eeprom_control *control,

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -4
 			res = amdgpu_ras_eeprom_correct_header_tag(control,
 								   RAS_TABLE_HDR_VAL);
 		} else {
-			*exceed_err_limit = true;
-			dev_err(adev->dev,
-				"RAS records:%d exceed threshold:%d, "
-				"GPU will not be initialized. Replace this GPU or increase the

threshold",

Quoted 3 lines
Quoted 3 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1108

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+			dev_err(adev->dev, "RAS records:%d exceed threshold:%d",
 				control->ras_num_recs, ras->bad_page_cnt_threshold);

I thought this would all go in a single set of patches. I wasn't aware a singleton patch

went

Quoted 2 lines
Quoted 2 lines

in already which changed just this line--this change was always a part of a patch set.

Quoted 8 lines
Quoted 1 line

Ah sorry. When you reviewed the original patch2 clarifying the message, I merged it and

then re-submitted the remaining 3 (which pared down to 2) for review. Sorry for the confusion, I was trying to minimize the number of moving parts.

Admittedly, now you have 3 patches, one singleton and two coming in. Would've probably be best to submit only the current two.

No worries for now--for the future.

Thanks. For the most part, all of my previous multi-patch sets have been all-or-nothing. This is the first time that a patch in the middle got an RB before the rest, so I did the wrong thing and merged it while the rest was still moving. Thanks for bearing with me!

Kent

Quoted 22 lines

Regards,
Luben

Quoted 18 lines

Kent

Quoted 15 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct · line 1110

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
+			if (amdgpu_bad_page_threshold == -2) {
+				dev_warn(adev->dev, "GPU will be initialized due to

bad_page_threshold = -2.");

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +4 -0
+				res = 0;
+			} else {
+				*exceed_err_limit = true;
+				dev_err(adev->dev, "GPU will not be initialized. Replace this

GPU or increase the threshold.");

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+			}
 		}
 	} else {
 		DRM_INFO("Creating a new EEPROM table");
#6 lore raw

Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold

On 2021-10-21 12:49, Russell, Kent wrote:
[AMD Official Use Only] -----Original Message----- From: Tuikov, Luben <[email protected]> Sent: Thursday, October 21, 2021 12:47 PM To: Russell, Kent <[email protected]>; [email protected] Cc: Joshi, Mukul <[email protected]>; Kuehling, Felix <[email protected]> Subject: Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold On 2021-10-21 12:42, Russell, Kent wrote: [AMD Official Use Only] -----Original Message----- From: Tuikov, Luben <[email protected]> Sent: Thursday, October 21, 2021 12:21 PM To: Russell, Kent <[email protected]>; [email protected] Cc: Joshi, Mukul <[email protected]>; Kuehling, Felix <[email protected]>; Tuikov, Luben <[email protected]> Subject: Re: [PATCH 2/2] drm/amdgpu: Add kernel parameter support for ignoring bad page threshold On 2021-10-21 11:57, Kent Russell wrote: When a GPU hits the bad_page_threshold, it will not be initialized by the amdgpu driver. This means that the table cannot be cleared, nor can information gathering be performed (getting serial number, BDF, etc). If the bad_page_threshold kernel parameter is set to -2, continue to initialize the GPU, while printing a warning to dmesg that this action has been done Cc: Luben Tuikov <[email protected]> Cc: Mukul Joshi <[email protected]> Signed-off-by: Kent Russell <[email protected]> Acked-by: Felix Kuehling <[email protected]> Reviewed-by: Luben Tuikov <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index d58e37fd01f4..b85b67a88a3d 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -205,6 +205,7 @@ extern struct amdgpu_mgpu_info mgpu_info; extern int amdgpu_ras_enable; extern uint amdgpu_ras_mask; extern int amdgpu_bad_page_threshold; +extern bool amdgpu_ignore_bad_page_threshold; extern struct amdgpu_watchdog_timer amdgpu_watchdog_timer; extern int amdgpu_async_gfx_ring; extern int amdgpu_mcbp; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 96bd63aeeddd..eee3cf874e7a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -877,7 +877,7 @@ module_param_named(reset_method, amdgpu_reset_method, int, 0444); * result in the GPU entering bad status when the number of total * faulty pages by ECC exceeds the threshold value. */ -MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement)"); +MODULE_PARM_DESC(bad_page_threshold, "Bad page threshold(-1 = auto(default value), 0 = disable bad page retirement, -2 = ignore bad page threshold)"); module_param_named(bad_page_threshold, amdgpu_bad_page_threshold, int, 0444); MODULE_PARM_DESC(num_kcq, "number of kernel compute queue user want to setup (8 if set to greater than 8 or less than 0, only affect gfx 8+)"); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c index ce5089216474..bd6ed43b0df2 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c @@ -1104,11 +1104,15 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, res = amdgpu_ras_eeprom_correct_header_tag(control, RAS_TABLE_HDR_VAL); } else { - *exceed_err_limit = true; - dev_err(adev->dev, - "RAS records:%d exceed threshold:%d, " - "GPU will not be initialized. Replace this GPU or increase the threshold", + dev_err(adev->dev, "RAS records:%d exceed threshold:%d", control->ras_num_recs, ras->bad_page_cnt_threshold); I thought this would all go in a single set of patches. I wasn't aware a singleton patch went in already which changed just this line--this change was always a part of a patch set. Ah sorry. When you reviewed the original patch2 clarifying the message, I merged it and then re-submitted the remaining 3 (which pared down to 2) for review. Sorry for the confusion, I was trying to minimize the number of moving parts. Admittedly, now you have 3 patches, one singleton and two coming in. Would've probably be best to submit only the current two. No worries for now--for the future. Thanks. For the most part, all of my previous multi-patch sets have been all-or-nothing. This is the first time that a patch in the middle got an RB before the rest, so I did the wrong thing and merged it while the rest was still moving. Thanks for bearing with me! Yeah, sometimes we R-B some patches in a set, but we don't break off or submit them until they've all (the whole set has) gotten an R-B. We just apply the R-B to the patches which have gotten it and carry them around the set, and repost as you did with your v3 patch set.

No big deal at the moment, but having a single consistent set is preferable--for the future. :-)

Regards,
Luben

Kent Regards, Luben Kent Regards, Luben + if (amdgpu_bad_page_threshold == -2) { + dev_warn(adev->dev, "GPU will be initialized due to bad_page_threshold = -2."); + res = 0; + } else { + *exceed_err_limit = true; + dev_err(adev->dev, "GPU will not be initialized. Replace this GPU or increase the threshold."); + } } } else { DRM_INFO("Creating a new EEPROM table");

#7 lore raw
In reply to Kent Russell

[Public]

Nit pick - suggest to use dev_warn for easy identification of the device.

Thanks,
Lijo
________________________________
From: amd-gfx <[email protected]> on behalf of Kent Russell <[email protected]>
Sent: Thursday, October 21, 2021 9:27:10 PM
To: [email protected] <[email protected]>
Cc: Russell, Kent <[email protected]>; Tuikov, Luben <[email protected]>; Joshi, Mukul <[email protected]>
Subject: [PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +6 -0
index f4c05ff4b26c..ce5089216474 100644
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
                 if (res)
                         DRM_ERROR("RAS table incorrect checksum or error:%d\n",
                                   res);
+
+               /* Warn if we are at 90% of the threshold or above */
+               if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))
+                       DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+                                       control->ras_num_recs,
+                                       ras->bad_page_cnt_threshold);
         } else if (hdr->header == RAS_TABLE_HDR_BAD &&
                    amdgpu_bad_page_threshold != 0) {
                 res = __verify_ras_table_checksum(control);

--
2.25.1

#8 lore raw

[Public]

I had noticed that all of these RAS messages use DRM instead of dev_warn. I wasn't sure if there was a reason for that or not. It's definitely inconsistent.

DRM_ERROR("Partial read for checksum, res:%d\n", res); DRM_DEBUG_DRIVER("Found existing EEPROM table with %d records", DRM_ERROR("RAS table incorrect checksum or error:%d\n",
DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
DRM_ERROR("RAS Table incorrect checksum or error:%d\n", dev_info(adev->dev, "records:%d threshold:%d, resetting RAS table header signature", dev_err(adev->dev, "RAS records:%d exceed threshold:%d", dev_warn(adev->dev, "GPU will be initialized due to bad_page_threshold = -2."); DRM_INFO("Creating a new EEPROM table");

Might be worth making a separate patch to handle those inconsistencies. I agree that device is useful for this kind of error/warning/info

Kent

From: Lazar, Lijo <[email protected]>
Sent: Thursday, October 21, 2021 12:31 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Russell, Kent <[email protected]>; Tuikov, Luben <[email protected]>; Joshi, Mukul <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold

[Public]

Nit pick - suggest to use dev_warn for easy identification of the device.

Thanks,
Lijo
________________________________
From: amd-gfx <[email protected]<mailto:[email protected]>> on behalf of Kent Russell <[email protected]<mailto:[email protected]>>
Sent: Thursday, October 21, 2021 9:27:10 PM
To: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Russell, Kent <[email protected]<mailto:[email protected]>>; Tuikov, Luben <[email protected]<mailto:[email protected]>>; Joshi, Mukul <[email protected]<mailto:[email protected]>>
Subject: [PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +6 -0
index f4c05ff4b26c..ce5089216474 100644
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
                 if (res)
                         DRM_ERROR("RAS table incorrect checksum or error:%d\n",
                                   res);
+
+               /* Warn if we are at 90% of the threshold or above */
+               if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))
+                       DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+                                       control->ras_num_recs,
+                                       ras->bad_page_cnt_threshold);
         } else if (hdr->header == RAS_TABLE_HDR_BAD &&
                    amdgpu_bad_page_threshold != 0) {
                 res = __verify_ras_table_checksum(control);

--
2.25.1

#9 lore raw
In reply to Kent Russell
Quoted 17 lines · Kent Russell

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
index f4c05ff4b26c..ce5089216474 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1081

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
 		if (res)
 			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
 				  res);
+
+		/* Warn if we are at 90% of the threshold or above */

The kernel uses a couple of styles, this is one of them:

/* Warn ...
 */
if (...)

Please use this style as it is used extensively in the amdgpu_ras_eeprom.c file.

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1082

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+		if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))

You don't need the extra parenthesis around multiplication--it has higher precedence than relational operators--drop the extra parenthesis.

Regards,
Luben

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +3 -0
+			DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+					control->ras_num_recs,
+					ras->bad_page_cnt_threshold);
 	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
 		   amdgpu_bad_page_threshold != 0) {
 		res = __verify_ras_table_checksum(control);
#10 lore raw
Quoted 34 lines · Luben Tuikov
Quoted 17 lines · Kent Russell

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
index f4c05ff4b26c..ce5089216474 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1081

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
 		if (res)
 			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
 				  res);
+
+		/* Warn if we are at 90% of the threshold or above */

The kernel uses a couple of styles, this is one of them:

/* Warn ...
 */
if (...)

Please use this style as it is used extensively in the amdgpu_ras_eeprom.c file.

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1082

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+		if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))

You don't need the extra parenthesis around multiplication--it has higher precedence than relational operators--drop the extra parenthesis.

Quoted 6 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1085

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +3 -0
+			DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+					control->ras_num_recs,
+					ras->bad_page_cnt_threshold);

One more note: The code uses "dev_err()" for this very similar message:

            dev_err(adev->dev,
                "RAS records:%d exceed threshold:%d, "
                "GPU will not be initialized. Replace this GPU or increase the threshold", control->ras_num_recs, ras->bad_page_cnt_threshold);

Since your message is essentially the same, sans the "90% of threshold", perhaps you want to use dev_warn(), instead of "DRM_WARN()".

Regards,
Luben

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
 	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
 		   amdgpu_bad_page_threshold != 0) {
 		res = __verify_ras_table_checksum(control);
#11 lore raw

[AMD Official Use Only]

Quoted 54 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Thursday, October 21, 2021 12:45 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold

Quoted 6 lines · Luben Tuikov
Quoted 5 lines · Kent Russell

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Quoted 8 lines

Review

Quoted 8 lines
Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct

Quoted 4 lines

index f4c05ff4b26c..ce5089216474 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct

amdgpu_ras_eeprom_control *control,

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1081

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
 		if (res)
 			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
 				  res);
+
+		/* Warn if we are at 90% of the threshold or above */

The kernel uses a couple of styles, this is one of them:

Quoted 8 lines

/* Warn ...
 */
if (...)

Please use this style as it is used extensively in the amdgpu_ras_eeprom.c file.

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1082

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+		if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))

You don't need the extra parenthesis around multiplication--it has higher precedence

than relational operators--drop the extra parenthesis.

Quoted 7 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1085

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +3 -0
+			DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+					control->ras_num_recs,
+					ras->bad_page_cnt_threshold);

One more note: The code uses "dev_err()" for this very similar message:

Quoted 7 lines

            dev_err(adev->dev,
                "RAS records:%d exceed threshold:%d, "
                "GPU will not be initialized. Replace this GPU or increase the threshold", control->ras_num_recs, ras->bad_page_cnt_threshold);

Since your message is essentially the same, sans the "90% of threshold", perhaps you want to use dev_warn(), instead of "DRM_WARN()".

Agreed. Lijo had a similar comment. I may follow up with another patch to change all of these table-specific DRM_* messages to dev_*

Kent

Quoted 7 lines

Regards,
Luben

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
 	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
 		   amdgpu_bad_page_threshold != 0) {
 		res = __verify_ras_table_checksum(control);
#12 lore raw
Quoted 56 lines · Kent

[AMD Official Use Only]

Quoted 52 lines

-----Original Message-----
From: Tuikov, Luben <[email protected]>
Sent: Thursday, October 21, 2021 12:45 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Joshi, Mukul <[email protected]>
Subject: Re: [PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold

Quoted 6 lines · Luben Tuikov
Quoted 5 lines · Kent Russell

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Quoted 8 lines

Review

Quoted 8 lines
Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct

Quoted 4 lines

index f4c05ff4b26c..ce5089216474 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct

amdgpu_ras_eeprom_control *control,

Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1081

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
 		if (res)
 			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
 				  res);
+
+		/* Warn if we are at 90% of the threshold or above */

The kernel uses a couple of styles, this is one of them:

Quoted 8 lines

/* Warn ...
 */
if (...)

Please use this style as it is used extensively in the amdgpu_ras_eeprom.c file.

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1082

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+		if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))

You don't need the extra parenthesis around multiplication--it has higher precedence

than relational operators--drop the extra parenthesis.

Quoted 6 lines

Regards,
Luben

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1085

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +3 -0
+			DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+					control->ras_num_recs,
+					ras->bad_page_cnt_threshold);

One more note: The code uses "dev_err()" for this very similar message:

Quoted 8 lines
Quoted 7 lines

            dev_err(adev->dev,
                "RAS records:%d exceed threshold:%d, "
                "GPU will not be initialized. Replace this GPU or increase the threshold", control->ras_num_recs, ras->bad_page_cnt_threshold);

Since your message is essentially the same, sans the "90% of threshold", perhaps you want to use dev_warn(), instead of "DRM_WARN()".

Agreed. Lijo had a similar comment. I may follow up with another patch to change all of these table-specific DRM_* messages to dev_*

You can still do that, but for this patch, make the changes I requested and change this to dev_warn().

Regards,
Luben

Quoted 9 lines

Kent

Quoted 6 lines

Regards,
Luben

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
 	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
 		   amdgpu_bad_page_threshold != 0) {
 		res = __verify_ras_table_checksum(control);
Reviewed-by
#13 lore raw
In reply to Luben Tuikov

Am 2021-10-21 um 12:35 p.m. schrieb Luben Tuikov:

Quoted 25 lines · Kent Russell
Quoted 17 lines

dmesg doesn't warn when the number of bad pages approaches the threshold for page retirement. WARN when the number of bad pages is at 90% or greater for easier checks and planning, instead of waiting until the GPU is full of bad pages.

Cc Luben Tuikov <[email protected]>
Cc Mukul Joshi <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +0 -0
index f4c05ff4b26c..ce5089216474 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1081

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +2 -0
@@ -1077,6 +1077,12 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control,
 		if (res)
 			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
 				  res);
+
+		/* Warn if we are at 90% of the threshold or above */

The kernel uses a couple of styles, this is one of them:

Quoted 2 lines

/* Warn ...
 */

That's a waste of space. That means there can be no single-line comments?

checkpatch.pl complains about multi-line comments that don't have the final */ on their own line. But a single line comment is OK. Let's stick with the coding style recommended by checkpatch.pl. If we make up our own arbitrary rules for different reviewers and different parts of the code, I think it becomes a mine-field of pointless cosmetic fixes for anyone trespassing on unfamiliar code.

Quoted 6 lines

if (...)

Please use this style as it is used extensively in the amdgpu_ras_eeprom.c file.

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control, · line 1082

Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +1 -0
+		if ((10 * control->ras_num_recs) >= (ras->bad_page_cnt_threshold * 9))

You don't need the extra parenthesis around multiplication--it has higher precedence than relational operators--drop the extra parenthesis.

I agree. With that fixed, the patch is

Quoted 10 lines

Regards,
Luben

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +3 -0
+			DRM_WARN("RAS records:%u exceeds 90%% of threshold:%d",
+					control->ras_num_recs,
+					ras->bad_page_cnt_threshold);
 	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
 		   amdgpu_bad_page_threshold != 0) {
 		res = __verify_ras_table_checksum(control);