All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steev Klimaszewski <steev@kali.org>
To: Thara Gopinath <thara.gopinath@linaro.org>,
	rafael@kernel.org, viresh.kumar@linaro.org,
	bjorn.andersson@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH] cpufreq: freq_table: Initialize cpuinfo.max_freq to correct max frequency.
Date: Tue, 16 Nov 2021 10:44:54 -0600	[thread overview]
Message-ID: <19991c37-4d05-b464-128b-8e7a767970b1@kali.org> (raw)
In-Reply-To: <7b440c0f-57eb-e367-bcc7-91c731d360d5@kali.org>


On 11/16/21 10:15 AM, Steev Klimaszewski wrote:
>
> On 11/16/21 9:31 AM, Thara Gopinath wrote:
>> Hi Steev,
>>
>> Thanks for testing this.
>>
>> On 11/15/21 8:23 PM, Steev Klimaszewski wrote:
>>
>> --- snip
>>>>
>>>> diff --git a/drivers/cpufreq/freq_table.c 
>>>> b/drivers/cpufreq/freq_table.c
>>>> index 67e56cf638ef..6784f94124df 100644
>>>> --- a/drivers/cpufreq/freq_table.c
>>>> +++ b/drivers/cpufreq/freq_table.c
>>>> @@ -35,11 +35,15 @@ int cpufreq_frequency_table_cpuinfo(struct 
>>>> cpufreq_policy *policy,
>>>>       struct cpufreq_frequency_table *pos;
>>>>       unsigned int min_freq = ~0;
>>>>       unsigned int max_freq = 0;
>>>> +    unsigned int cpuinfo_max_freq = 0;
>>>>       unsigned int freq;
>>>>       cpufreq_for_each_valid_entry(pos, table) {
>>>>           freq = pos->frequency;
>>>> +        if (freq > cpuinfo_max_freq)
>>>> +            cpuinfo_max_freq = freq;
>>>> +
>>>>           if (!cpufreq_boost_enabled()
>>>>               && (pos->flags & CPUFREQ_BOOST_FREQ))
>>>>               continue;
>>>> @@ -57,8 +61,8 @@ int cpufreq_frequency_table_cpuinfo(struct 
>>>> cpufreq_policy *policy,
>>>>        * If the driver has set its own cpuinfo.max_freq above 
>>>> max_freq, leave
>>>>        * it as is.
>>>>        */
>>>> -    if (policy->cpuinfo.max_freq < max_freq)
>>>> -        policy->max = policy->cpuinfo.max_freq = max_freq;
>>>> +    if (policy->cpuinfo.max_freq < cpuinfo_max_freq)
>>>> +        policy->cpuinfo.max_freq = cpuinfo_max_freq;
>>>>       if (policy->min == ~0)
>>>>           return -EINVAL;
>>>
>>>
>>> Something still isn't quite right...
>>>
>>> The setup is that I have an rc.local of
>>>
>>> #!/bin/sh
>>>
>>> echo 1 > /sys/devices/system/cpu/cpufreq/boost
>>>
>>> exit 0
>>>
>>>
>>> After booting and logging in:
>>>
>>> steev@limitless:~$ cat 
>>> /sys/devices/system/cpu/cpufreq/policy4/stats/time_in_state
>>> 825600 2499
>>> <snip>
>>> 2649600 38
>>> 2745600 31
>>> 2841600 1473
>>> 2956800 0
>>
>> Did you try debugging this ? As in did you read back boost and 
>> cpuinfo_max_freq at this point to ensure that everything is as 
>> expected ?
>>
>>
> Hi Thara,
>
> I did - sorry I forgot to mention that boost does show 1 for enabled 
> and cpuinfo_max_freq is set to 2956800.  However, scaling_max_freq is 
> still listed as 2841600 and scaling_available_frequencies still shows 
> 2841600 as the max available. scaling_boost_freqencies does also list 
> 2956800.
>
> steev@limitless:~$ grep . /sys/devices/system/cpu/cpufreq/policy4/*
> /sys/devices/system/cpu/cpufreq/policy4/affected_cpus:4 5 6 7
> grep: /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq: 
> Permission denied
> /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_max_freq:2956800
> /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_min_freq:825600
> /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_transition_latency:0
> /sys/devices/system/cpu/cpufreq/policy4/related_cpus:4 5 6 7
> /sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies:825600 
> 902400 979200 1056000 1209600 1286400 1363200 1459200 1536000 1612800 
> 1689600 1766400 1843200 1920000 1996800 2092800 2169600 2246400 
> 2323200 2400000 2476800 2553600 2649600 2745600 2841600
> /sys/devices/system/cpu/cpufreq/policy4/scaling_available_governors:ondemand 
> conservative powersave userspace performance schedutil
> /sys/devices/system/cpu/cpufreq/policy4/scaling_boost_frequencies:2956800
> /sys/devices/system/cpu/cpufreq/policy4/scaling_cur_freq:1920000
> /sys/devices/system/cpu/cpufreq/policy4/scaling_driver:qcom-cpufreq-hw
> /sys/devices/system/cpu/cpufreq/policy4/scaling_governor:schedutil
> /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq:2841600
> /sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq:825600
> /sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed:<unsupported>
>
Once it does start working (e.g. I've run echo 0 to turn off boost, and 
then echo 1 to turn it back one)

steev@limitless:~$ grep . /sys/devices/system/cpu/cpufreq/policy4/*
/sys/devices/system/cpu/cpufreq/policy4/affected_cpus:4 5 6 7
grep: /sys/devices/system/cpu/cpufreq/policy4/cpuinfo_cur_freq: 
Permission denied
/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_max_freq:2956800
/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_min_freq:825600
/sys/devices/system/cpu/cpufreq/policy4/cpuinfo_transition_latency:0
/sys/devices/system/cpu/cpufreq/policy4/related_cpus:4 5 6 7
/sys/devices/system/cpu/cpufreq/policy4/scaling_available_frequencies:825600 
902400 979200 1056000 1209600 1286400 1363200 1459200 1536000 1612800 
1689600 1766400 1843200 1920000 1996800 2092800 2169600 2246400 2323200 
2400000 2476800 2553600 2649600 2745600 2841600
/sys/devices/system/cpu/cpufreq/policy4/scaling_available_governors:ondemand 
conservative powersave userspace performance schedutil
/sys/devices/system/cpu/cpufreq/policy4/scaling_boost_frequencies:2956800
/sys/devices/system/cpu/cpufreq/policy4/scaling_cur_freq:1920000
/sys/devices/system/cpu/cpufreq/policy4/scaling_driver:qcom-cpufreq-hw
/sys/devices/system/cpu/cpufreq/policy4/scaling_governor:schedutil
/sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq:2956800
/sys/devices/system/cpu/cpufreq/policy4/scaling_min_freq:825600
/sys/devices/system/cpu/cpufreq/policy4/scaling_setspeed:<unsupported>


Notice that the scaling_max_freq is now 2956800 instead of 2841600 when 
it isn't working.

Sorry for forgetting and sending another mail :(

-- steev


      reply	other threads:[~2021-11-16 16:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 19:50 [PATCH] cpufreq: freq_table: Initialize cpuinfo.max_freq to correct max frequency Thara Gopinath
2021-11-16  1:23 ` Steev Klimaszewski
2021-11-16  3:00   ` Steev Klimaszewski
2021-11-16  3:59   ` Viresh Kumar
2021-11-16 15:27     ` Thara Gopinath
2021-11-17  7:24       ` Viresh Kumar
2021-11-16 15:31   ` Thara Gopinath
2021-11-16 16:15     ` Steev Klimaszewski
2021-11-16 16:44       ` Steev Klimaszewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19991c37-4d05-b464-128b-8e7a767970b1@kali.org \
    --to=steev@kali.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=thara.gopinath@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.