40

I'm new to Ubuntu and want to disable the turbo boost. I tried with cpufreq but i cant get it to work. is there any other way to do it.

In windows it was as easy as changing the CPU speed from 100 to 99.

Maythux
  • 84,289
Ivaylo
  • 439
  • 1
  • 7
  • 9
  • what's your cpu model? – Ron May 06 '15 at 15:04
  • @Ron: it is Intel(R) Pentium(R) CPU B960 @ 2.20GHz I got the information from the chat they moved to. I think it doesn't really matter, what matters is which scaling driver is being used. Currently (which is different than the past) it will default to intel_pstate if the processor supports it. – Doug Smythies May 06 '15 at 15:51
  • guys, i tried : sudo cpupower frequency-set -g powersave and it says : Setting cpu: 0 Setting cpu: 1 So where to put which core to change ? :) – Ivaylo May 06 '15 at 16:28
  • Regardless of which scaling driver you are using, turbo enabled or not is a global setting, one spot covers all CPUs. Myself, I only use primitive commands, never higher level level tools such as cpupower. – Doug Smythies May 06 '15 at 18:03

4 Answers4

66

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
Doug Smythies
  • 15,448
  • 5
  • 44
  • 61
  • If you have problems with permissions, try sudo echo "0" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo – Cirelli94 Nov 22 '16 at 17:13
  • Can this be set permanently, to stay after reboot? – Alexey Jan 15 '17 at 11:31
  • @Alexey : If you want it to be permanent, then i would suggest to do it in the BIOS instead. Otherwise make the above set_cpu_turbo_off script to run during startup. – Doug Smythies Jan 15 '17 at 14:50
  • 2
    @Cirelli94 - even so: sudo echo "1" | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo 1 tee: /sys/devices/system/cpu/intel_pstate/no_turbo: Operation not permitted –  Jan 27 '17 at 13:53
  • http://askubuntu.com/q/876903/47206 –  Jan 27 '17 at 14:28
  • 1
    For some reason, this doesn't have any effect for me in Ubuntu Server 14. sudo wrmsr --all 0x1a0 0x4000850089 does the trick. – sudo Jul 07 '17 at 00:28
  • @sudo: Yep - same here on an Intel(R) Xeon(R) E5-2680 v4 @ 2.40GHz. Can anyone explain the difference? – spawn Mar 17 '21 at 21:12
  • @spawn : bit 38 is the one that matters here, and is defined as turbo disable for "Intel® Xeon Phi™ Processors". Are you saying that when you read that register, after disabling turbo as per the answer, it still reads as zero? Seems to me that might be a bug. However, the docs says that some of these things are "shared" in Xeon processors, so not sure. If there is a bug, well its an old one. – Doug Smythies Mar 17 '21 at 21:42
27

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
Maythux
  • 84,289
  • Comments are not for extended discussion; this conversation has been moved to chat. – Mitch May 06 '15 at 07:33
  • $ rdmsr -pi 0x1a0 -f 38:38 gives me just a list of options to use with the command. e.g.: Usage: rdmsr [options] regno --help -h Print this help --version -V Print current version .... Is the above syntax outdated/ not applicable in a general way? – Sir hennihau Dec 19 '19 at 09:58
  • I get some missing files here:

    wrmsr: open: No such file or directory rdmsr: open: No such file or directory core 0: enabled wrmsr: open: No such file or directory rdmsr: open: No such file or directory core 1: enabled

    – Alexander Mills Mar 31 '20 at 18:54
  • 1
    try sudo rdmsr 0x1a0 -f 38:38 – 1a1a11a Jul 10 '20 at 15:41
  • Is it normal that I can't switch turbo boost for individual cores? It's either on for all, or off for all. – Dmitry Aug 12 '20 at 20:22
  • To set all cores at once, no need for a script: wrmsr has --all/-a switch: wrmsr -a 0x1a0 0x4000850089 – spawn Mar 17 '21 at 21:14
4

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

echo "0" | sudo tee /sys/devices/system/cpu/cpufreq/boost
Charles Green
  • 21,339
Ron
  • 20,638
-1

In my case this works:

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