[PATCH 0/5] cpufreq/amd-pstate: Reuse and refactor code

Dhananjay Ugwekar posted 5 patches 1 year ago
drivers/cpufreq/amd-pstate.c | 151 +++++++++++++++++------------------
1 file changed, 73 insertions(+), 78 deletions(-)
[PATCH 0/5] cpufreq/amd-pstate: Reuse and refactor code
Posted by Dhananjay Ugwekar 1 year ago
Use static calls to avoid frequent MSR/shared memory system checks.

Reuse existing functions amd_pstate_update_perf() and
amd_pstate_set_epp() instead of duplicating code.

Remove an unnecessary check for active mode in online and offline
functions.

Eliminate a redundant function amd_pstate_epp_offline().

Dhananjay Ugwekar (5):
  cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static
    calls
  cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf()
  cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and
    amd_pstate_epp_offline()
  cpufreq/amd-pstate: Remove the cppc_state check in offline/online
    functions
  cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and
    amd_pstate_epp_offline()

 drivers/cpufreq/amd-pstate.c | 151 +++++++++++++++++------------------
 1 file changed, 73 insertions(+), 78 deletions(-)

-- 
2.34.1
Re: [PATCH 0/5] cpufreq/amd-pstate: Reuse and refactor code
Posted by Mario Limonciello 1 year ago
On 12/4/2024 08:48, Dhananjay Ugwekar wrote:
> Use static calls to avoid frequent MSR/shared memory system checks.
> 
> Reuse existing functions amd_pstate_update_perf() and
> amd_pstate_set_epp() instead of duplicating code.
> 
> Remove an unnecessary check for active mode in online and offline
> functions.
> 
> Eliminate a redundant function amd_pstate_epp_offline().
> 
> Dhananjay Ugwekar (5):
>    cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static
>      calls
>    cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf()
>    cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and
>      amd_pstate_epp_offline()
>    cpufreq/amd-pstate: Remove the cppc_state check in offline/online
>      functions
>    cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and
>      amd_pstate_epp_offline()
> 
>   drivers/cpufreq/amd-pstate.c | 151 +++++++++++++++++------------------
>   1 file changed, 73 insertions(+), 78 deletions(-)
> 

For the patches not already reviewed:

Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

I'll add this to superm1/bleeding-edge.

I have another series that I will build on top of it as well.
Re: [PATCH 0/5] cpufreq/amd-pstate: Reuse and refactor code
Posted by Dhananjay Ugwekar 1 year ago
Hello Mario,

On 12/4/2024 10:37 PM, Mario Limonciello wrote:
> On 12/4/2024 08:48, Dhananjay Ugwekar wrote:
>> Use static calls to avoid frequent MSR/shared memory system checks.
>>
>> Reuse existing functions amd_pstate_update_perf() and
>> amd_pstate_set_epp() instead of duplicating code.
>>
>> Remove an unnecessary check for active mode in online and offline
>> functions.
>>
>> Eliminate a redundant function amd_pstate_epp_offline().
>>
>> Dhananjay Ugwekar (5):
>>    cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static
>>      calls
>>    cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf()
>>    cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and
>>      amd_pstate_epp_offline()
>>    cpufreq/amd-pstate: Remove the cppc_state check in offline/online
>>      functions
>>    cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and
>>      amd_pstate_epp_offline()
>>
>>   drivers/cpufreq/amd-pstate.c | 151 +++++++++++++++++------------------
>>   1 file changed, 73 insertions(+), 78 deletions(-)
>>
> 
> For the patches not already reviewed:
> 
> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>

Thanks! 

> 
> I'll add this to superm1/bleeding-edge.

There is a small warning in the 3rd patch, how do you suggest we fix that, 
should I post a new version or you'll modify the patch at your end?

   drivers/cpufreq/amd-pstate.c: In function 'amd_pstate_epp_offline':
>> drivers/cpufreq/amd-pstate.c:1664:13: warning: variable 'value' set but not used [-Wunused-but-set-variable]
    1664 |         u64 value;
         |             ^~~~~

Regards,
Dhananjay

> 
> I have another series that I will build on top of it as well.

Re: [PATCH 0/5] cpufreq/amd-pstate: Reuse and refactor code
Posted by Mario Limonciello 1 year ago
On 12/4/2024 22:29, Dhananjay Ugwekar wrote:
> Hello Mario,
> 
> On 12/4/2024 10:37 PM, Mario Limonciello wrote:
>> On 12/4/2024 08:48, Dhananjay Ugwekar wrote:
>>> Use static calls to avoid frequent MSR/shared memory system checks.
>>>
>>> Reuse existing functions amd_pstate_update_perf() and
>>> amd_pstate_set_epp() instead of duplicating code.
>>>
>>> Remove an unnecessary check for active mode in online and offline
>>> functions.
>>>
>>> Eliminate a redundant function amd_pstate_epp_offline().
>>>
>>> Dhananjay Ugwekar (5):
>>>     cpufreq/amd-pstate: Convert the amd_pstate_get/set_epp() to static
>>>       calls
>>>     cpufreq/amd-pstate: Move the invocation of amd_pstate_update_perf()
>>>     cpufreq/amd-pstate: Refactor amd_pstate_epp_reenable() and
>>>       amd_pstate_epp_offline()
>>>     cpufreq/amd-pstate: Remove the cppc_state check in offline/online
>>>       functions
>>>     cpufreq/amd-pstate: Merge amd_pstate_epp_cpu_offline() and
>>>       amd_pstate_epp_offline()
>>>
>>>    drivers/cpufreq/amd-pstate.c | 151 +++++++++++++++++------------------
>>>    1 file changed, 73 insertions(+), 78 deletions(-)
>>>
>>
>> For the patches not already reviewed:
>>
>> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> 
> Thanks!
> 
>>
>> I'll add this to superm1/bleeding-edge.
> 
> There is a small warning in the 3rd patch, how do you suggest we fix that,
> should I post a new version or you'll modify the patch at your end?
> 
>     drivers/cpufreq/amd-pstate.c: In function 'amd_pstate_epp_offline':
>>> drivers/cpufreq/amd-pstate.c:1664:13: warning: variable 'value' set but not used [-Wunused-but-set-variable]
>      1664 |         u64 value;
>           |             ^~~~~
> 
> Regards,
> Dhananjay
> 

Don't worry, it's a one line change.  I'll take care of it when I 
migrate it to superm1/linux-next.