Re: [PATCH] cpufreq: intel_pstate: Fix cpuinfo_cur_freq after performance governor changes

From: Rafael J. Wysocki
Date: Tue Jul 25 2017 - 11:43:38 EST


On Monday, July 24, 2017 07:57:45 PM Srinivas Pandruvada wrote:
> On Tue, 2017-07-25 at 01:46 +0000, Huaisheng HS1 Ye wrote:
> > Hi Rafael,
> >
> > If you delete "get" function implement within intel_pstate, the
> > sysfs interface cpuinfo_cur_freq will display <unknown> all the
> > time.
> cpuinfo_cur_freq by definition should show actual frequency HW
> frequency.

Right.

> Unless I missed something. So Len Brown's patch should also
> take care of this to get from arch specific function is available.
> So in addition to Rafael's change, what about this?
>
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 9bf97a3..29ec687 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -689,8 +689,13 @@ store_one(scaling_max_freq, max);
> static ssize_t show_cpuinfo_cur_freq(struct cpufreq_policy *policy,
> char *buf)
> {
> - unsigned int cur_freq = __cpufreq_get(policy);
> + unsigned int cur_freq;
>
> + cur_freq = arch_freq_get_on_cpu(policy->cpu);
> + if (cur_freq)
> + return sprintf(buf, "%u\n", cur_freq);
> +
> + cur_freq = __cpufreq_get(policy);
> if (cur_freq)
> return sprintf(buf, "%u\n", cur_freq);
>

So also by definition cpuinfo_cur_freq should not return the same thing as
scaling_cur_freq.

I actually would like cpuinfo_cur_freq to not be present at all, I need to
check why it still shows up if ->get is not present.

Thanks,
Rafael