[PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold
Luben Tuikov
luben.tuikov at amd.com
Thu Oct 21 16:49:25 UTC 2021
On 2021-10-21 12:47, Russell, Kent wrote:
> [AMD Official Use Only]
>
>
>
>> -----Original Message-----
>> From: Tuikov, Luben <Luben.Tuikov at amd.com>
>> Sent: Thursday, October 21, 2021 12:45 PM
>> To: Russell, Kent <Kent.Russell at amd.com>; amd-gfx at lists.freedesktop.org
>> Cc: Joshi, Mukul <Mukul.Joshi at amd.com>
>> Subject: Re: [PATCH 1/2] drm/amdgpu: Warn when bad pages approaches 90% threshold
>>
>> On 2021-10-21 12:35, Luben Tuikov wrote:
>>> On 2021-10-21 11:57, Kent Russell wrote:
>>>> 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 at amd.com>
>>>> Cc: Mukul Joshi <Mukul.Joshi at amd.com>
>>>> Signed-off-by: Kent Russell <kent.russell at amd.com>
>>>> ---
>>>> drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 ++++++
>>>> 1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>>>> index f4c05ff4b26c..ce5089216474 100644
>>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
>>>> @@ -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.
>>>
>>>> + 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
>>>
>>>> + 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()".
> 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
>
> Kent
>
>> Regards,
>> Luben
>>
>>>> } else if (hdr->header == RAS_TABLE_HDR_BAD &&
>>>> amdgpu_bad_page_threshold != 0) {
>>>> res = __verify_ras_table_checksum(control);
More information about the amd-gfx
mailing list