Re: [PATCH] cpufreq/cppc: changing highest_perf to nominal_perf in cppc_cpufreq_cpu_init()
From: Viresh Kumar
Date: Thu Jun 06 2024 - 03:16:15 EST
On 10-05-24, 11:06, liwei (JK) wrote:
> In the above function calling process, the frequency is obtained twice. The
> first time is in cpufreq_online(), and the second time is in
> cpufreq_verify_current_freq().
>
> When the frequency configuration takes effect slowly, the kernel cannot
> sense when the frequency configuration takes effect.
Who is making this frequency change. I am not sure I understand how is
that taking place slowly.
> It may take effect
> before the frequency is read twice, between the frequencies read twice, or
> after the frequency is read twice.
>
> |------------------|--------------------|---------------------|
> set highest_freq get() get() target()
>
> If it takes effect before two read operations, there will be no problem.
>
> If it takes effect between two read operations, policy->cur will be updated
> in cpufreq_verify_current_freq(), the execution path is as follows:
> new_freq = cpufreq_driver->get() // new_freq = turbo_freq
> if (policy->cur != new_freq)
> cpufreq_out_of_sync(policy, new_freq)
> ...
> policy->cur = new_freq // cur = turbo_freq
> ...
> __cpufreq_driver_target(policy->max)
> cppc_set_perf(target) // policy->cur!=target
>
> Reconfigure frequency to policy->max.
>
> If policy->cur is not set to turbo_freq after two read operations,
> policy->cur will not be updated in cpufreq_verify_current_freq(), the
> execution path is as follows:
> new_freq = cpufreq_driver->get() // new_freq == policy->cur
> if (policy->cur != new_freq)
> ...
> __cpufreq_driver_target(policy->max)
> ret // policy->cur==target
>
> Configured frequency will remain at turbo-freq.
>
> When reading scaling_cur_freq, the frequency value that may be read is
> policy->cur. If arch does not implement arch_freq_get_on_cpu(), and the
> registered cpufreq_driver does not define setpolicy()/get(), the frequency
> will not be obtained through the get() and will directly feed back
> policy->cur. If the above problem occurs, no exception will be detected when
> reading scaling_cur_freq. But reading cpuinfo_cur_freq will reacquire the
> frequency through the get() interface and feedback the newly acquired
> frequency value.
--
viresh