Skip to content

Instantly share code, notes, and snippets.

@lucasbrigida
Last active November 1, 2023 19:20
Show Gist options
  • Save lucasbrigida/1761084e0d96bacefc76461223b5a0b9 to your computer and use it in GitHub Desktop.
Save lucasbrigida/1761084e0d96bacefc76461223b5a0b9 to your computer and use it in GitHub Desktop.
Disable Intel Turbo Boost

Prerequisites

  • Intel processor

Installing

sudo apt-get install msr-tools linux-cpupower lm-sensors

OU

sudo apt-get install msr-tools linux-tools-common lm-sensors linux-tools-generic linux-cloud-tools-generic

Configuration

Follow the steps below:

  • Create directory
  • Create service file
  • Create service unit file
  • Set service

Create directory

sudo mkdir /opt/power-mode && cd $_

Create service file

  • Create the file and save it in /opt/power-mode/powersave-no-turbo-boost.sh
#!/bin/bash

cpupower frequency-set -g powersave
cpupower frequency-set -r -u 800MHz
wrmsr -a 0x1a0 0x4000850089
  • Set file permissions
sudo chmod +x /opt/power-mode/powersave-no-turbo-boost.sh

Create service unit file

  • Create the file and save it in "/opt/power-mode/powersave-no-turbo-boost.service"
[Unit]
Description=Power Mode Settings
After=acpid.socket
After=syslog.service

[Service]
User=root
Type=simple
ExecStart=/opt/power-mode/powersave-no-turbo-boost.sh
ExecStop=/opt/power-mode/powersave-no-turbo-boost.sh
TimeoutSec=30
StartLimitInterval=350

[Install]
WantedBy=multi-user.target

Service

Set power mode service with turbo boost disabled

cd /etc/systemd/system
sudo ln -s /opt/power-mode/powersave-no-turbo-boost.service powersave-no-turbo-boost.service
sudo chmod u+x /etc/systemd/system/powersave-no-turbo-boost.service
sudo systemctl enable powersave-no-turbo-boost

Check out

Check processor status

sudo reboot
sudo cpupower frequency-info

Output

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 - 2.60 GHz
  available cpufreq governors: performance powersave
  current policy: frequency should be within 800 MHz and 800 MHz.
                  The governor "powersave" may decide which speed to use
                  within this range.
  current CPU frequency: Unable to call hardware
  current CPU frequency: 798 MHz (asserted by call to kernel)
  boost state support:
    Supported: no
    Active: no
    25500 MHz max turbo 4 active cores
    25500 MHz max turbo 3 active cores
    25500 MHz max turbo 2 active cores
    25500 MHz max turbo 1 active cores

Learn More

@sebaplaza
Copy link

Hello !

Just a question, i use some alias to disable/enable turbo boost mode.

Why you have to manually set the frequency to achieve the "same" result ?

alias boost-disable="echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo"

alias boost-enable="echo 0 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo"

@lucasbrigida
Copy link
Author

@sebaplaza

Because I wanted the turbo boost to be deactivated at system startup and not after my user session was started.

@lucasbrigida
Copy link
Author

@serboox, @Globson

I'm very happy to have helped in solving your problem

@borzaka
Copy link

borzaka commented Oct 14, 2022

My solution is a cronjob:
@reboot /bin/sh -c "/usr/bin/echo 1 > /sys/devices/system/cpu/intel_pstate/no_turbo" > /dev/null 2>&1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment