CPU Undervolting in Linux

Undervolting in Linux

For Linux there is no official program for undervolting, so enthusiasts using reverse engineering methods have found ways to change the voltage on Intel CPUs and have created their own utilities.

Linux Undervolting Information: https://github.com/mihic/linux-intel-undervolt

Utilities for Undervolting in Linux:

I'll show you how to do undervolting in Linux with intel-undervolt, this utility is written in C (the other two are Python and Bash scripts).

Undervolting with intel-undervolt

Install the program:

git clone https://github.com/kitsunyan/intel-undervolt
cd intel-undervolt/
make
sudo make install
sudo systemctl daemon-reload

Using the program:

intel-undervolt COMMAND

As a COMMAND can be

  read      Read and display current values
  apply     Apply values from config file
  daemon    Run in daemon mode

Let's read the current values:

sudo intel-undervolt read

At the moment I have the default settings:

CPU (0): -0.00 mV
GPU (1): -0.00 mV
CPU Cache (2): -0.00 mV
System Agent (3): -0.00 mV
Analog I/O (4): -0.00 mV

I will install sysbench – a CPU benchmark tool for Linux. To install sysbench in Debian-based distros Ubuntu, Linux Mint, Kali Linux)

sudo apt install sysbench

I will start it for 5 minutes, with the load on all 12 cores:

sysbench cpu --threads=12 --time=300 run

My current result without undervolting:

Setting up undervolt in intel-undervolt

To configure intel-undervolt, you need to change the values in the /etc/intel-undervolt.conf configuration file :

sudo gedit /etc/intel-undervolt.conf

By default, it contains the following:

# CPU Undervolting
# Usage: apply ${index} ${display_name} ${undervolt_value}
# Example: apply 2 'CPU Cache' -25.84
 
apply 0 'CPU' 0
apply 1 'GPU' 0
apply 2 'CPU Cache' 0
apply 3 'System Agent' 0
apply 4 'Analog I/O' 0
 
# TDP Alteration
# Usage: tdp ${short_term} ${long_term}
# Usage: tdp ${short_term}/${time_window} ${long_term}/${time_window}
# Example: tdp 45/0.002 35/28
 
# Critical Temperature Offset Alteration
# Usage: tjoffset ${temperature_offset}
# Example: tjoffset -20
 
# Daemon Update Inverval
# Usage: interval ${interval_in_milliseconds}
 
interval 5000

To apply the undervolting settings, use the syntax: apply ${index} ${display_name} ${undervolt_value}.

Here: apply – the command to apply the settings, ${index} – the number of the setting that we apply, ${display_name} – the value of the undervolting.

As ${index} can be:

  • 0 – CPU
  • 1 – GPU (that is, the video core of the CPU)
  • 2 – CPU Cache (that is, the cache of the CPU)
  • 3 – System Agent
  • 4 – Analog I / O

For example:

apply 2 'CPU Cache' -25.84

means CPU cache undervolting for 25.84 mV.

Power limit

Here you can specify values for TDP.

TDP for processors matters for a short time Turbo Boost and for a long time Turbo Boost. The duration of both intervals of the Turbo Boosts can also be adjusted.

Two syntax options are supported:

tdp ${short_term} ${long_term}
tdp ${short_term}/${time_window} ${long_term}/${time_window}

Here:

  • ${short_term} – the maximum power for that period of Turbo Boost when it is allowed to go beyond the boundaries of the usual Turbo Boost
  • ${long_term} – the limiting power of the ‘normal’ Turbo Boost
  • ${time_window} – the duration of this period of the usual Turbo Boost or a short ‘super’ Turbo Boost

Example:

tdp 35/5 25/60

It sets the value of TDP to 35 when the Turbo Boost is allowed to go beyond the usual Turbo Boost, while the duration of this segment is 5 seconds. The value of the ‘normal’ Turbo Boost is set to 25, and its duration is 60 seconds.

It is not necessary to specify the time of a short and long Turbo Boost, you can use the following syntax, only with TDP values:

tdp 35 25

In this case, default time intervals will be used.

Temperature Limit

You can set the temperature limit, after which thermal throttling begins. The temperature is indicated as the offset value from the maximum temperature level. Suppose we have:

tjoffset -20

If the maximum temperature level is set to 100, the resultant limit is 100 — 20 = 80°C. Remember that an offset of more than 15°C is allowed only in Skylake and newer ones.

Apply settings

After you changed the file /etc/intel-undervolt.conf, for the settings to take effect you need to run

sudo intel-undervolt apply

The program needs the root permissions. You can apply your settings automatically by enabling the intel-undervolt.service service.

Daemon Mode

Sometimes power and temperature limits can be reset by EC, BIOS or something else. This behavior can be suppressed by periodically applying limit settings. intel-undervolt-loop.service allows you to run this program in the deamon mode, which will apply the settings at a certain interval. You can change the interval by changing the value interval:

interval 5000

This value is in milliseconds, by default it is set to 5 seconds.

Undervolt Tests in Linux

After applying the undervolt, start the benchmark again:

sysbench cpu --threads=12 --time=300 run

New value:

The first time I got:

  • CPU speed: events per second: 9065.31
  • Overall statistics: the total number of events: 2719621

The event in this benchmarking program is the number of operations performed.

The second time I got:

  • CPU speed: events per second: 12486.27
  • General statistics: the total number of events: 3745908

The increase in productivity is 12486.27 / 9065.31 * 100% = 137,73%, that is, 37%.

In Windows, I have increased productivity in Hashcat when cracking Wi-Fi passwords on the central processor from 16995 H/s to 19850 H/s.

19850/16995 * 100% = 116.8%, that is, 16%.

As you can see, there really is a growth. And the longer the processor runs at the maximum frequency, the greater the gain in power compared to the standard settings.

Note: I also greatly increased the TDP, do not do so, if not sure. In my case, after lowering the voltage, throttling due to the excess of TDP does not practically come (default TDP is enough for CPU), so this setting has very little effect at all + cooling system works really nice in my model. With this setting you can bring your processor to the extreme temperature – without stress tests with temperature control, do not change this value. If you have a thermal throttling (due to overheating) – do not change this setting at all! In this case, you will make much worse and there are real prospects to ‘burn’ the processor.

Starting the intel-undervolt service

To start the intel-undervolt service, use the command:

udo systemctl start intel-undervolt

To stop:

sudo systemctl stop intel-undervolt

To check the status:

systemctl status intel-undervolt

After the reboot, the service will not start. To do this, you need to enable auto running:

sudo systemctl enable intel-undervolt

Warning: Before adding the service to startup, make sure that your system is stable with the selected undervolting values. Otherwise, you risk getting an endlessly rebooted system.

Conclusion

So, undervolting actually allows you to achieve power increase and (or) a cooler CPU without additional electricity consumption.

In this article, I did not consider the underwriting of the CPU core video (Intel HD GPU). This should especially give positive results for netbooks, in which there is no discrete (separate) video card.

Undervolting is not magic, so do not expect sudden changes.

Remember that you can add to the startup only settings for which the system is stable. All tests should be done with disabled intel-undervolt autoloading (or similar programs) – this is the best guarantee that you will be able to boot into the system if you chose wrong values for undervolting.

Also recommended:

Leave a Reply

Your email address will not be published.

wp-puzzle.com logo