Re: [PATCH 11/15] cpufreq/amd-pstate: Cache EPP value and use that everywhere

From: Mario Limonciello
Date: Fri Dec 06 2024 - 11:19:09 EST


On 12/6/2024 10:14, Gautham R. Shenoy wrote:
Hello Mario,

On Thu, Dec 05, 2024 at 04:28:43PM -0600, Mario Limonciello wrote:
Cache the value in cpudata->epp_cached, and use that for all callers.
As all callers use cached value merge amd_pstate_get_energy_pref_index()
into show_energy_performance_preference().

Check if the EPP value is changed before writing it to MSR or
shared memory region.

The patch looks ok to me. Just one comment below:

[..snip..]

@@ -1610,6 +1591,8 @@ static int amd_pstate_epp_set_policy(struct cpufreq_policy *policy)
cpudata->policy = policy->policy;
+ guard(mutex)(&amd_pstate_limits_lock);
+

Shouldn't this hunk be a different patch. The changelog doesn't say
anything about making amd_pstate_epp_update_limit() call while holding
the amd_pstate_limits_lock.

I'll drop the hunk entirely. I'm intending an overhaul of all the mutex handling code after this series is landed.



ret = amd_pstate_epp_update_limit(policy);
if (ret)
return ret;
--
2.43.0


For the rest of the patch

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@xxxxxxx>
Thx


--
Thanks and Regards
gautham.