Messages in this thread | | | Date | Tue, 16 Nov 2021 10:44:54 -0600 | Subject | Re: [PATCH] cpufreq: freq_table: Initialize cpuinfo.max_freq to correct max frequency. | From | Steev Klimaszewski <> |
| |
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
| |