[PATCH 00/12] cpufreq/amd-pstate: Fixes and optimizations

From: Dhananjay Ugwekar
Date: Wed Feb 05 2025 - 06:26:00 EST


Patch 1:
* Remove the goto label in amd_pstate_update_limits, as the mutex
has been converted to a scope based (guard) cleanup.

Patches 2-4 (adjust_perf changes):
* In amd_state_adjust_perf, max_perf was being set to highest_perf which
was leading to max_limit_perf value not being honored, fix that.
* The min_perf has a hard lower limit at lowest_nonlinear_perf,
instead set the hard limit at min_limit_perf. This gives the user the
freedom to set min_perf lower than lowest_nonlinear_perf with schedutil.
* Pass the correct perf limits to amd_pstate_update() in adjust_perf.

Patches 5-6 (Modularize perf<->freq conversion):
* Convert all perf values to u8 datatype.
* Create two helper functions which carry out all the perf<->freq
conversions throughout the code.

Patches 7-12 (Fix amd_pstate_update_limits() and add scope based cleanup
for cpufreq_policy ref counting):
* Fix a missed cpufreq_cpu_put in one of the exit paths and remove
unnecessary cpufreq_update_policy call.
* Add a missing nullptr check in amd_pstate_update.
* Add a scope based cleanup macro for cpufreq_policy ref counting.
* Remove the unnecessary driver_lock in update_limits.

Base: superm1/bleeding-edge

Dhananjay Ugwekar (12):
cpufreq/amd-pstate: Remove the goto label in amd_pstate_update_limits
cpufreq/amd-pstate: Fix max_perf updation with schedutil
cpufreq/amd-pstate: Modify the min_perf calculation in adjust_perf
callback
cpufreq/amd-pstate: Remove the redundant des_perf clamping in
adjust_perf
cpufreq/amd-pstate: Pass min/max_limit_perf as min/max_perf to
amd_pstate_update
cpufreq/amd-pstate: Convert all perf values to u8
cpufreq/amd-pstate: Modularize perf<->freq conversion
cpufreq/amd-pstate: Remove the unnecessary cpufreq_update_policy call
cpufreq/amd-pstate: Fix cpufreq_policy ref counting
cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
cpufreq/amd-pstate: Use scope based cleanup for cpufreq_policy refs
cpufreq/amd-pstate: Remove the unncecessary driver_lock in
amd_pstate_update_limits

drivers/cpufreq/amd-pstate-trace.h | 46 ++++----
drivers/cpufreq/amd-pstate.c | 167 ++++++++++++++---------------
drivers/cpufreq/amd-pstate.h | 18 ++--
include/linux/cpufreq.h | 3 +
4 files changed, 113 insertions(+), 121 deletions(-)

--
2.34.1