AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Luben Tuikov <luben.tuikov@amd.com>
To: "Russell, Kent" <Kent.Russell@amd.com>,
	"Kuehling, Felix" <Felix.Kuehling@amd.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>
Cc: "Joshi, Mukul" <Mukul.Joshi@amd.com>
Subject: Re: [PATCH 1/4] drm/amdgpu: Warn when bad pages approaches threshold
Date: Tue, 19 Oct 2021 14:42:32 -0400	[thread overview]
Message-ID: <0414b32f-95ac-1d63-2c8d-ac2f95366e9f@amd.com> (raw)
In-Reply-To: <DM6PR12MB3324F45AD12D4D86590917C585BD9@DM6PR12MB3324.namprd12.prod.outlook.com>

On 2021-10-19 14:22, Russell, Kent wrote:
> [AMD Official Use Only]
>
>
>
>> -----Original Message-----
>> From: Kuehling, Felix <Felix.Kuehling@amd.com>
>> Sent: Tuesday, October 19, 2021 2:09 PM
>> To: Russell, Kent <Kent.Russell@amd.com>; amd-gfx@lists.freedesktop.org
>> Cc: Tuikov, Luben <Luben.Tuikov@amd.com>; Joshi, Mukul <Mukul.Joshi@amd.com>
>> Subject: Re: [PATCH 1/4] drm/amdgpu: Warn when bad pages approaches threshold
>>
>> Am 2021-10-19 um 1:50 p.m. schrieb Kent Russell:
>>> Currently 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 <luben.tuikov@amd.com>
>>> Cc: Mukul Joshi <Mukul.Joshi@amd.com>
>>> Signed-off-by: Kent Russell <kent.russell@amd.com>
>>> ---
>>>  drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 10 ++++++++++
>>>  1 file changed, 10 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>>> index 98732518543e..8270aad23a06 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>>> @@ -1077,6 +1077,16 @@ int amdgpu_ras_eeprom_init(struct
>> amdgpu_ras_eeprom_control *control,
>>>  		if (res)
>>>  			DRM_ERROR("RAS table incorrect checksum or error:%d\n",
>>>  				  res);
>>> +
>>> +		/* threshold = -1 is automatic, threshold = 0 means that page
>>> +		 * retirement is disabled.
>>> +		 */
>>> +		if (amdgpu_bad_page_threshold > 0 &&
>>> +		    control->ras_num_recs >= 0 &&
>>> +		    control->ras_num_recs >= (amdgpu_bad_page_threshold * 9 / 10))
>>> +			DRM_WARN("RAS records:%u approaching threshold:%d",
>>> +					control->ras_num_recs,
>>> +					amdgpu_bad_page_threshold);
>> This won't work for the default setting amdgpu_bad_page_threshold=-1.
>> For this case, you'd have to take the threshold from
>> ras->bad_page_cnt_threshold.
> Yep, completely missed that. Thanks, I'll fix that up.

Please also fix the round off, third conditional:

a >= b * 9/10   <==>   10*a >= 9*b

Then, you can also drop the second line, since from the first:

b > 0  ==>   10*a >= 9*b > 0   ==>  10a > 0  ==>  a > 0.

Which shows that,

b > 0 && 10*a >= 9*b
               is true iff a and b are both greater than 0, so you don't need the middle line of the check.

Also in your message, say something like:

DRM_WARN("RAS records:%u approaching a 90% threshold:%d",
             control->ras_num_recs,
             amdgpu_bad_page_threshold);

Regards,
Luben

>
>  Kent
>> Regards,
>>    Felix
>>
>>
>>>  	} else if (hdr->header == RAS_TABLE_HDR_BAD &&
>>>  		   amdgpu_bad_page_threshold != 0) {
>>>  		res = __verify_ras_table_checksum(control);


      reply	other threads:[~2021-10-19 18:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 17:50 [PATCH 1/4] drm/amdgpu: Warn when bad pages approaches threshold Kent Russell
2021-10-19 17:50 ` [PATCH 2/4] drm/amdgpu: Clarify error when hitting bad page threshold Kent Russell
2021-10-19 18:47   ` Luben Tuikov
2021-10-19 17:50 ` [PATCH 3/4] drm/amdgpu: Add kernel parameter for ignoring " Kent Russell
2021-10-19 18:13   ` Felix Kuehling
2021-10-19 18:23     ` Russell, Kent
2021-10-20 10:55   ` Christian König
2021-10-20 14:56     ` Russell, Kent
2021-10-20 15:02       ` Christian König
2021-10-19 17:50 ` [PATCH 4/4] drm/amdgpu: Implement ignore_bad_page_threshold parameter Kent Russell
2021-10-19 18:08 ` [PATCH 1/4] drm/amdgpu: Warn when bad pages approaches threshold Felix Kuehling
2021-10-19 18:22   ` Russell, Kent
2021-10-19 18:42     ` Luben Tuikov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0414b32f-95ac-1d63-2c8d-ac2f95366e9f@amd.com \
    --to=luben.tuikov@amd.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=Kent.Russell@amd.com \
    --cc=Mukul.Joshi@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox