Disabling Turbo Boost in Linux
Intel Turbo Boost is a technology used to increase the frequency of the internal CPU cores of a processor. One can say that it is an automatic overclocking facility.
The frequency gain depends on the number of cores active at a moment. The less processors active, the greater frequency gain.
Additionally, the current processor temperature, and power/current consumption are taken into account. If the temperature is not excessive, then an extra frequency boost can be applied. A similar situation happens if we are plugged into the wall or if we are running on battery.
Since we do some speed benchmarks, and controlling the frequency boost at a given time is hard due to different environment temperature around the globe, the recommendation is to disable it. I mean, reproducing the experiment on a computer in a different geographical location will give mixed results, hence, we disable it for easiness.
To read the current state of the Turbo Boost, we need to install the msr-tools. The package is available for Linux, and there is a Mac and Windows version. In the case of Windows, “they say” that one can setup the maximum frequency to 99%, that should do the trick.
The msr-tools are a couple of instructions to read the MSR registers: Model Specific Register. For the Sandy Bridge micro-architecture, the flag for the Turbo Boost is the 38th bit of the 0x1a0 register.
To know if the Turbo Boost feature is disabled, run:
rdmsr -pi 0x1a0 -f 38:38
- 1=disabled
- 0=enabled
where i stands for the core number. Alternatively, one can run the following linux command:
cat /proc/cpuinfo | grep “cpu cores” | uniq -c | xargs | cut -d\ -f1,5| awk ’{print “ht”,($1!=$2)?“on”:“off”}’
Please note that this is a per core feature. In deed, it is good that this is a per core feature since one can disable the Turbo Boost in all of the CPU cores exempt one to improve the performance of a single-core application. When the Turbo Boost is required for a single core, the frequency boost is greater (so, one can more less warranty that our application takes the most of the processor).
To disable the Turbo Boost feature, one can set the entire 0x1a0 MSR register to 0x4000850089, as in here:
wrmsr -pi 0x1a0 0x4000850089
again, the i refers to the particular CPU core.
Please note that one needs permissions to run that, hence, a sudo modifier may be required.
–LJ
UPDATE: Thanks to Diego Aranha for the info, which got it from Mike Scott.
For more information, please refer to Table 34-10, page 3945 of the Intel 64 and IA-32 Architectures Software Developer’s Manual, combined volumes: 1, 2A, 2B, 2C, 3A, 3B and 3C.
UPDATE 2: [2013-07-23] Thanks to Thomaz Oliveira to point out that we need to load the MSR module on Linux (at least on kernel 3.8):
sudo modprobe msr
1 Notes/ Hide
cannibalhymn-blog reblogged this from luisjdominguezp luisjdominguezp posted this





