Linux – cpufreq-info differs from /proc/cpuinfo

cpu-usagelinuxperformance

I have a server and I want to ensure it's always running at maximum speed, never in energy-saving mode. I've tried a few strategies (aside from rebooting and changing the setting in the bios, which I would have to do for a few hundred servers) but I'm getting weird results from cpufreq-info. E.g.:

root@host:~# cpufreq-info -c 0
cpufrequtils 007: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1.20 GHz - 2.20 GHz
  available frequency steps: 2.20 GHz, 2.20 GHz, 2.10 GHz, 2.00 GHz, 1.90 GHz, 1.80 GHz, 1.70 GHz, 1.60 GHz, 1.50 GHz, 1.40 GHz, 1.30 GHz, 1.20 GHz
  available cpufreq governors: conservative, ondemand, userspace, powersave, performance
  current policy: frequency should be within 2.00 GHz and 2.20 GHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 1.20 GHz (asserted by call to hardware).
  cpufreq stats: 2.20 GHz:6.50%, 2.20 GHz:0.24%, 2.10 GHz:0.34%, 2.00 GHz:0.05%, 1.90 GHz:0.04%, 1.80 GHz:0.03%, 1.70 GHz:0.03%, 1.60 GHz:0.03%, 1.50 GHz:0.03%, 1.40 GHz:0.03%, 1.30 GHz:0.03%, 1.20 GHz:92.66%  (8080636)

Note that the min speed shows "2.00 GHz", and the governor is set to "performance", yet the current CPU frequency is 1.20 GHz. However, if I just look in /proc/cpuinfo, the value there is consistently ~2.2 GHz:

root@host:~# egrep 'MHz|Xeon' /proc/cpuinfo ; cpufreq-info -c 0
model name  : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
cpu MHz     : 2200.000
model name  : Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
cpu MHz     : 2201.000

Which of these is correct? Which do I believe? Aside from the BIOS changes, is there any way to guarantee maximum performance mode? For what it's worth, this is Ubuntu 12.04, with this kernel:

Linux host 3.2.0-76-generic #111-Ubuntu SMP Tue Jan 13 22:16:09 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Best Answer

I'm almost convinced it your BIOS is limiting your CPUs to 1.20 GHz. In the kernel there are two values:

  1. scaling_cur_freq which is the frequency that the cpufreq driver thinks it has requested. /proc/cpuinfo contains this value. It calls the cpufreq_quick_get() funciton.

  2. cpuinfo_cur_freq which is the frequency that is actually programmed into the CPU. cpufreq-info is using this value as indicated by "asserted by call to hardware." (It eventually calls __cpufreq_get().) It would fall back to scaling_cur_freq if cpuinfo_cur_freq wasn't available.

+1 about Matt's comments on mass BIOS update. E.g., HP Proliant DL class servers allow you to change the power regulation online. Perhaps your hardware has similar functionality.