3

With cpupower, I can set arbitrary minimum and maximum frequencies. However, the CPU will round those values to the next frequency scale it can do (this is because of frequency multipliers I think).

I haven't found a way to get a list of all available frequencies, neither through cpupower nor any other tool or file. Having this information would be really awesome.

The only thing I found was cpupower frequency-info which is supposed to have a line containing such information (according to Google) but it is missing on my system. Here's my output:

~ cpupower frequency-info
analyzing CPU 0:
  driver: intel_pstate
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency:  Cannot determine or is not supported.
  hardware limits: 800 MHz - 3.80 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 800 MHz and 2.80 GHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 2.80 GHz (asserted by call to kernel)
  boost state support:
    Supported: yes
    Active: yes

And here's my cpuinfo:

processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model       : 158
model name  : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
stepping    : 9
microcode   : 0x84
cpu MHz     : 2791.480
cache size  : 6144 KB
physical id : 0
siblings    : 8
core id     : 0
cpu cores   : 4
apicid      : 0
initial apicid  : 0
fpu     : yes
fpu_exception   : yes
cpuid level : 22
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves ibpb ibrs stibp dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs        : cpu_meltdown spectre_v1 spectre_v2
bogomips    : 5618.00
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:
3

2 Answers 2

3

I've searched around and as comments say there doesn't appear to be a table of frequencies maintained anymore.

Assuming the frequencies are scaled linearly you can approximate them by looking at the directories.

To assist in typing create this alias:

alias cpuinfo="paste <(ls *) <(cat *) | column -s $'\t' -t"

First discover the number of frequency steps

$ cd /sys/devices/system/cpu/intel_pstate
$ cpuinfo
max_perf_pct  100
min_perf_pct  22
no_turbo      0
num_pstates   28
status        active
turbo_pct     33

We have 28 frequency steps determined by num_pstates.

Now look at min and max frequency MHz which can change based on Turbo Boost enabled/disabled state:

cd /sys/devices/system/cpu/cpu0/cpufreq
$ cpuinfo
affected_cpus                             0
cpuinfo_max_freq                          3500000
cpuinfo_min_freq                          800000
cpuinfo_transition_latency                4294967295
energy_performance_available_preferences  default performance balance_performance balance_power power 
energy_performance_preference             balance_performance
related_cpus                              0
scaling_available_governors               performance powersave
scaling_cur_freq                          837225
scaling_driver                            intel_pstate
scaling_governor                          powersave
scaling_max_freq                          3500000
scaling_min_freq                          800000
scaling_setspeed                          <unsupported>

I may write a script later to display frequencies automatically but to do it by hand this way:

  • Step Rate=(max-min)/steps. eg (3500-800)/28=96.428
  • Repeat 28 times: Rate=Last Rate+Step Rate. eg 800.00, 896.42, 992.856, 1089.284, 1185.712, 1282.14...

Script to list frequencies

You can copy and paste this function into your terminal:

ApproximateFrequencies () {
    NumSteps=$(cat /sys/devices/system/cpu/intel_pstate/num_pstates)
    MinFreq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq)
    MaxFreq=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq)
    LastFreq=$MinFreq
    StepRate=$((( $MaxFreq - $MinFreq ) / $NumSteps))
    for ((n=0;n<=$NumSteps;n++)); do
        echo $LastFreq
        LastFreq=$(( $LastFreq + $StepRate))
    done
}

Then run the function using ApproximateFrequencies:

800000
896428
992856
 . . .
3403556
3499984

Better still pipe through column command if you have it installed:

$ ApproximateFrequencies | column
800000  1089284 1378568 1667852 1957136 2246420 2535704 2824988 3114272 3403556
896428  1185712 1474996 1764280 2053564 2342848 2632132 2921416 3210700 3499984
992856  1282140 1571424 1860708 2149992 2439276 2728560 3017844 3307128
5
  • Hmm, (3500-800)/27 would be 100 (MHz) exactly, which is a nice round number, so it seems likely that 28 would be the full number of steps (counting both ends). That is, you'd have 28 steps with frequency f(n) = 800 + n*100, where n is in 0..27.
    – ilkkachu
    Aug 19, 2018 at 16:26
  • I agree about 100 being a nice round number. However my conky shows MHz at 1148, 1147, 1919, 1706, 1111, 2127, 1795 as I sit here watching display and typing this comment. So round numbers are not the way it works. Aug 19, 2018 at 16:28
  • mmh. That wouldn't match the steps of 96.4 either. I wonder if it averages the frequency over some (even short) period of time. I seem to remember seeing /proc/cpuinfo do that.
    – ilkkachu
    Aug 19, 2018 at 16:30
  • @ilkkachu not sure. Using the cpuinfo alias above on the cpufreq directory last two readings are 1699.941 and 1007.489 Mhz. As OP noted though when you set a frequency Intel automatically finds the closest "real" one. Aug 19, 2018 at 16:32
  • @ilkkachu I've added a script to list available frequencies based on linear methodology. Perhaps it might shed some clues. Aug 19, 2018 at 17:21
0

I can inspect /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies with

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies

This isn't limited to just Intel. I don't know if they are rounded or not.

Kernel version: 5.4.0-74

Relevant docs https://www.kernel.org/doc/Documentation/cpu-freq/user-guide.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .