Open Compute server power saving by turning off Turbo Boost in Ubuntu via the command line.

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Klee

Well-Known Member
Jun 2, 2016
1,289
396
83
Open Compute server power saving by turning off Turbo Boost in Ubuntu via the command line.

This summer is hot already, I live in the deep south here in the USA, so with three Wiwynn Open Compute servers utilizing the E5 cpu's at %100 they put WAY too much heat out and since these servers are not in a proper server environment but in my house I found myself not running them for the last month or two because frankly they pump out way too much heat.

This past winter it was a non issue as I have a gas heater and running the servers when its cold lowers my gas bill about what they raise my electricity bill.

So this past weekend I decided to do something about it without having to hook up a video card to each server just to enter the bios to turn off Turbo Boost, I found a way that is much easier via the command line and also much faster.

You can turn Turbo Boost off and back on via the command line in Linux.

First install "msr-tools".

Then load the module: sudo modprobe msr


After that you need this script to enable or disable Turbo Boost.

Code:
#!/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 it and give it a name of turbo-boost.

Then : "sudo chmod +x turbo-boost" to make it executable.

Now to use it enter: "bash turbo-boost disable" or "bash turbo-boost enable"

Nice, quick and easy without having to reboot into the bios.

This is not my idea I found the info online months back, don't remember where, but I have finally tried it out.

Now the server fan profile tries to keep the cpu's about 78c-8oc with my E5-2660 V1's and they still run that temp but the fans are MUCH quieter and there is just a slight breeze of hot air coming out of the server and not the hair drier blast that it was so it will pump less heat into my house which will drop my electricity bill since the a/c will not have to work as hard.

And yes you will lose some performance with Turbo Boost disabled but all you have to do to get it back is run the enable command.

Output:
@node01:~$ bash turbo-boost disable
core 0: disabled
core 1: disabled
core 2: disabled
core 3: disabled
core 4: disabled
core 5: disabled
core 6: disabled
core 7: disabled
core 8: disabled
core 9: disabled
core 10: disabled
core 11: disabled
core 12: disabled
core 13: disabled
core 14: disabled
core 15: disabled
core 16: disabled
core 17: disabled
core 18: disabled
core 19: disabled
core 20: disabled
core 21: disabled
core 22: disabled
core 23: disabled
core 24: disabled
core 25: disabled
core 26: disabled
core 27: disabled
core 28: disabled
core 29: disabled
core 30: disabled
core 31: disabled
@node01:~$ bash turbo-boost enable
core 0: enabled
core 1: enabled
core 2: enabled
core 3: enabled
core 4: enabled
core 5: enabled
core 6: enabled
core 7: enabled
core 8: enabled
core 9: enabled
core 10: enabled
core 11: enabled
core 12: enabled
core 13: enabled
core 14: enabled
core 15: enabled
core 16: enabled
core 17: enabled
core 18: enabled
core 19: enabled
core 20: enabled
core 21: enabled
core 22: enabled
core 23: enabled
core 24: enabled
core 25: enabled
core 26: enabled
core 27: enabled
core 28: enabled
core 29: enabled
core 30: enabled
core 31: enabled

EDIT: This is on Ubuntu server 18.04. And also when I power them down I'll stick a kilowatt meter to compare the power savings.

EDIT2: And yes some creative ducting and a exhauster fan sucking the hot air out of the house would probably be better but that involves cutting a hole in a dining room wall, running ducts, buying the hardware and running another electrical circuit so that kind of rules that out.
 
Last edited:

Klee

Well-Known Member
Jun 2, 2016
1,289
396
83
I just tried it on my main pc just to test, Dual Xeon E5-2667 V3 ES cpu's and Ubuntu 16.04.4 and it works.

Of course it does not do too much because the base clock on these ES cpu's is 2.9 GHz and all core boost is 3.0 GHz.
 

Vit K

Member
Feb 23, 2017
88
30
18
In windows, include server, you can use power plan to reduce cpu multiplier down to minimal and even park the cores. I wonder if linux has this too.