Undervolting

From Void Linux Wiki
Jump to: navigation, search

Introduction

Undervolting your computer's components is a good way to get more battery life out of your computer without sacrificing performance. While this may seem scary, modern processors have many built-in defenses against voltage failures and temperature extremes, so you should not be concerned about damaging your hardware. You should, however, still keep a proper backup of all your data that will be safe in the event of data loss (especially if you're using a hard drive instead of an SSD).

Additionally, it doesn't come without some work -- you'll have to use some programs to test your settings to make sure they're compatible with your computer, and you'll have to create a runit service to set the voltage offsets. Don't worry though, it's quite easy!

All of the programs used in this guide are free software. This guide only details how to undervolt a mobile (laptop) Intel CPU, not any AMD CPUs or any desktop Intel CPUs. If you want to undervolt a desktop CPU, you can usually do that easily through the computer's BIOS. However, that is outside the scope of this guide.

Setup

First, you'll need to install the undervolt utility itself from https://github.com/georgewhewell/undervolt with the command

$ sudo pip3 install undervolt 

Then you'll need to install the utilities for testing your voltage offsets:

 $ sudo xbps-install -S stress glmark2

Setting a good undervolt

Undervolting is much like overclocking, but slightly different. You want to gradually increase the voltage offset, testing each time you do, until your system starts to run into problems (crashing, hanging, etc.) Repeating what was stated earlier: while this may seem scary, modern processors have many built-in defenses against voltage failures and temperature extremes, so you should not be concerned about damaging your hardware. Once you reach this "limit", you'll roll back the offset a little bit, just enough until your system is stable during tests and everyday workloads. You will have reached your system's ideal voltage offset.

Undervolting the CPU

1. Gradually increase the voltage offset

$ sudo undervolt --core -5 --cache -5 --uncore -5 --analogio -5

2. Stress test the undervolt

$ stress --cpu 8 --io 2 --vm 2 --timeout 60

3. Adjust undervolt

If your system doesn't crash or experience severe issues, go back to step 1, increasing the undervolt by 5 each time. For example, if you started at 5, your next command would look like

$ sudo undervolt --core -10 --cache -10 --uncore -10 --analogio -10

Then stress test your undervolt again in step 2.

If your system DOES crash or experience severe issues, go back to step 1, reducing the undervolt by 5 each time. For example, if you are experiencing issues at a voltage offset of -90, your next command would look like

$ sudo undervolt --core -85 --cache -85 --uncore -85 --analogio -85

Then go to step 2 and stress test your computer until you feel confident in its stability.

Undervolting the GPU

If you have an Intel GPU as well, you can undervolt it similarly to your CPU, but a few steps will be different.

1. Gradually increase the voltage offset

$ sudo undervolt --gpu -5

2. Stress test the undervolt

$ glmark2

Let this run for a while, either as long as you can tolerate or a full cycle.

3. Adjust undervolt

If your system doesn't crash or experience severe issues, go back to step 1, increasing the undervolt by 5 each time. For example, if you started at 5, your next command would look like

$ sudo undervolt --gpu -10

Then stress test your undervolt again in step 2.

If your system DOES crash or experience severe issues, go back to step 1, reducing the undervolt by 5 each time. For example, if you are experiencing issues at a voltage offset of -90, your next command would look like

$ sudo undervolt --gpu -85

Then go to step 2 and stress test your computer until you feel confident in its stability.

Testing together

It's a good idea to stress test your undervolt settings (CPU and GPU) together after you've set them both. Run both stress tests at the same time. If your system experiences instability, try decreasing some of your voltage offsets. You may wish to consider increasing the "--timeout" value, or remove it altogether, with the stress utility.

Creating a system service

Once you are happy with your undervolt settings, you'll want to make a runit service so that your undervolt settings get applied automatically, recurrently. That way your system is always respecting the undervolt settings you've chosen.

First, make the directory for the service:

$ sudo mkdir -p /etc/sv/undervolt

Then create a file named "run" in that directory and edit it to contain these contents:

 #!/bin/sh
 undervolt --core -85 --uncore -85 --analogio -85 --cache -85 --gpu -85
 sleep 60

Replace the offsets with your own. Then mark the file as executable:

$ sudo chmod a+x /etc/sv/undervolt/run

Then enable the service:

$ sudo ln -s /etc/sv/undervolt /var/services/