Disabling Intel Turbo Boost in ubuntu

If your system is using the intel_pstate frequency scaling driver:

$ cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate
intel_pstate

Then you can inquire as to the turbo enabled or disabled status:

$ cat /sys/devices/system/cpu/intel_pstate/no_turbo
0

Where 0 means turbo is enabled and 1 means it is disabled. And you can change it by writting (as sudo) to the same location.

$ echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
1

I never remember the location or how to do the `tee' thing properly, so I prefer scripts to be run as sudo:

$ cat set_cpu_turbo_off
#! /bin/bash
echo "1" > /sys/devices/system/cpu/intel_pstate/no_turbo

$ cat set_cpu_turbo_on
#! /bin/bash
echo "0" > /sys/devices/system/cpu/intel_pstate/no_turbo

To read the current state of the Turbo Boost, we need to install the msr-tools

sudo apt-get install msr-tools

To know if the Turbo Boost feature is disabled, run:

rdmsr -pi 0x1a0 -f 38:38

1=disabled
0=enabled

Replace i with your cores number


NOte: If you get the following error:

rdmsr:open: No such file or directory

then load the “msr” module by the following command:

sudo modprobe msr

To disable the Turbo Boost feature, one can set the entire 0x1a0 MSR register to 0x4000850089, as in here:

wrmsr -pC 0x1a0 0x4000850089

Where C refers to a particular core number

ou can get those number by running

cat /proc/cpuinfo | grep processor

then once you know your numbers you have to run the command above for each core. in your case numbers would be 0 & 1 so you have to do

wrmsr -p0 0x1a0 0x4000850089

wrmsr -p1 0x1a0 0x4000850089

Solution stands for this blog


From http://notepad2.blogspot.com/2014/11/a-script-to-turn-off-intel-cpu-turbo.html

A script to disable/enable turbo boost

The following script can be used to turn off/on turbo boost:

#!/bin/bash

if [[ -z $(which rdmsr) ]]; then
    echo "msr-tools is not installed. Run 'sudo apt-get install msr-tools' to install it." >&2
    exit 1
fi

if [[ ! -z $1 && $1 != "enable" && $1 != "disable" ]]; then
    echo "Invalid argument: $1" >&2
    echo ""
    echo "Usage: $(basename $0) [disable|enable]"
    exit 1
fi

cores=$(cat /proc/cpuinfo | grep processor | awk '{print $3}')
for core in $cores; do
    if [[ $1 == "disable" ]]; then
        sudo wrmsr -p${core} 0x1a0 0x4000850089
    fi
    if [[ $1 == "enable" ]]; then
        sudo wrmsr -p${core} 0x1a0 0x850089
    fi
    state=$(sudo rdmsr -p${core} 0x1a0 -f 38:38)
    if [[ $state -eq 1 ]]; then
        echo "core ${core}: disabled"
    else
        echo "core ${core}: enabled"
    fi
done

save this to a file called turbo-boost.sh

Usage: You can copy the above script and save it into a file named turbo-boost then set it to be executable:

sudo chmod +x turbo-boost.sh

you can then use it to disable/enable turbo boost:

./turbo-boost.sh disable
./turbo-boost.sh enable

You can try setting /sys/devices/system/cpu/cpufreq/boost value to 0.

echo "0" | sudo tee /sys/devices/system/cpu/cpufreq/boost

Tags:

Cpu