So I looked for resolution and found disabling turbo boost can help.
- First, you need to install msr-tools:
sudo apt-get install msr-tools
- To disable turbo boost on all your cpu cores:
sudo wrmsr -pi 0x1a0 0x4000850089
where i is the cpu core number, e.g. 0, 1, 2, 3..., you can get those number by runningcat /proc/cpuinfo | grep processor
.
Note: you need to run the wrmsr command for each cpu core. - To re-enable turbo boost on all your cpu cores:
sudo wrmsr -pi 0x1a0 0x850089
where i is the cpu core number, e.g. 0, 1, 2, 3..., you can get those number by runningcat /proc/cpuinfo | grep processor
.
Note: you need to run the wrmsr command for each cpu core.
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
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-boostyou can then use it to disable/enable turbo boost:
turbo-boost disable
turbo-boost enable