AMD General

After per discussed , the patch is

Reviewed-by: Yang Wang <[email protected]>

Best Regards,
Kevin
________________________________
From: Lazar, Lijo <[email protected]>
Sent: Monday, June 1, 2026 5:57 PM
To: Wang, Yang(Kevin) <[email protected]>; Kamal, Asad 
<[email protected]>; [email protected] 
<[email protected]>
Cc: Zhang, Hawking <[email protected]>; Ma, Le <[email protected]>; Zhang, 
Morris <[email protected]>; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH v2] drm/amd/pm: Stop pp_od_clk_voltage emit at PAGE_SIZE



On 01-Jun-26 1:15 PM, Wang, Yang(Kevin) wrote:
> AMD General
>
> Hi Asad,
>
> Your patch doesn't seem to resolve the issue you're facing; I  think the 
> correct logic should check the return value and the size variable
> What's your opinion?

I think stop printing if buffer is full seems sufficient.

The expectation is that size out param shouldn't be updated if the
function returns failure.

Thanks,
Lijo

>
> Here is the pseudocode:
> ret = amdgpu_dpm_emit_clock_levels(adev, od_clocks[clk_index], buf, &size);
> if (ret < 0) {
>      continue; // for next clock item.
> } else if (ret == 0) {
>      // Check ret and size/PAGE_SIZE here to meet the requirements
> } else {
>   // go out to return.
> }
> Best Regards,
> Kevin
>
>> -----Original Message-----
>> From: Kamal, Asad <[email protected]>
>> Sent: Friday, May 29, 2026 11:54 PM
>> To: [email protected]
>> Cc: Lazar, Lijo <[email protected]>; Zhang, Hawking
>> <[email protected]>; Ma, Le <[email protected]>; Zhang, Morris
>> <[email protected]>; Deucher, Alexander
>> <[email protected]>; Wang, Yang(Kevin)
>> <[email protected]>; Kamal, Asad <[email protected]>
>> Subject: [PATCH v2] drm/amd/pm: Stop pp_od_clk_voltage emit at PAGE_SIZE
>>
>> Stop appending OD sections in amdgpu_get_pp_od_clk_voltage() once the
>> sysfs page is full, instead of checking every
>> sysfs_emit_at() in SMU helpers
>>
>> v2: Drop the prior series that checked sysfs_emit_at() return values in every
>> SMU *_emit_clk_levels() helper and smu_cmn_print_*().
>> (Kevin)
>>
>> Signed-off-by: Asad Kamal <[email protected]>
>> ---
>>   drivers/gpu/drm/amd/pm/amdgpu_pm.c | 15 ++++++++++++---
>>   1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> index 60db9b66d08c..03c95621fe2c 100644
>> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
>> @@ -866,11 +866,15 @@ static ssize_t
>> amdgpu_get_pp_od_clk_voltage(struct device *dev,
>>        if (ret)
>>                return ret;
>>
>> -     for (clk_index = 0 ; clk_index < ARRAY_SIZE(od_clocks) ; clk_index++) {
>> +     for (clk_index = 0; clk_index < ARRAY_SIZE(od_clocks); clk_index++) {
>> +             if (size >= PAGE_SIZE)
>> +                     break;
>>                amdgpu_dpm_emit_clock_levels(adev, od_clocks[clk_index],
>> buf, &size);
>>        }
>>
>> -     if (size == 0)
>> +     if (size >= PAGE_SIZE)
>> +             size = PAGE_SIZE;
>> +     else if (size == 0)
>>                size = sysfs_emit(buf, "\n");
>>
>>        amdgpu_pm_put_access(adev);
>> @@ -3915,12 +3919,17 @@ static int amdgpu_retrieve_od_settings(struct
>> amdgpu_device *adev,
>>        if (ret)
>>                return ret;
>>
>> +     if (size >= PAGE_SIZE)
>> +             goto out_pm_put;
>> +
>>        ret = amdgpu_dpm_emit_clock_levels(adev, od_type, buf, &size);
>>        if (ret) {
>>                size = ret;
>>                goto out_pm_put;
>>        }
>> -     if (size == 0)
>> +     if (size >= PAGE_SIZE)
>> +             size = PAGE_SIZE;
>> +     else if (size == 0)
>>                size = sysfs_emit(buf, "\n");
>>
>>   out_pm_put:
>> --
>> 2.46.0
>

Reply via email to