[Success]Lenovo T61 / R500, Dell E6400

You can write down your success stories here (temperature decreasements, power savings, etc).
Post Reply
Posts: 1
Joined: Tue 2. Jan 2018, 17:17

[Success]Lenovo T61 / R500, Dell E6400

Post by EmmAnueL » Thu 4. Jan 2018, 21:05

Tested on lenovo T61 (cpu intel T8300), lenovo R500 (cpu intel P9600), Dell E6400 (cpu intel T9550)
with Xubuntu 16.04-3, kernel 4.10.0-42-generic

Download, forum "PHCTool Downloads", section "Releases" : phctool_0.5.2-2.tar.gz
and from forum "PHC Discussions", topic "phc-intel 0.3.2 and 0.4.0 + dkms for kernel 2.6.27 to 4.14 :
Download cpuinfo.py joined to this topic

Decompact, for example under your $HOME/Download directory.
You should have "0.5.2-2" and "phc-intel-pack-rev24" directories and cpuinfo.py file.

Check : go to phc-intel-pack-rev24/inc
there are all linux kernel supported. At the moment of writing this topic, I use the 4.10
linux kernel (Xubuntu 16.04-3). It is present, but if your version is not listed, I do not know
if Linux-PHC will work...

Let's go

We install Linux-PHC v0.3.2 and some packages we will need.
Open a "terminal" window :

Code: Select all

cd Downloads/phc-intel-pack-rev24/
sudo apt install dkms dpkg-dev debhelper stress-ng linux-tools-common cpufrequtils
Now, install the following packages with your linux kernel version (uname -a).
For me, it is the 4.10.0-42-generic :

Code: Select all

sudo apt install linux-tools-4.10.0-42-generic linux-cloud-tools-4.10.0-42-generic

sudo make dkms_mkdeb
sudo dpkg -i phc-intel-dkms_0.3.2_all.deb 
To enable the phc-intel module

Code: Select all

sudo mousepad /etc/default/grub
# change GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
# to GRUB_CMDLINE_LINUX_DEFAULT="quiet splash processor.ignore_ppc=1 cpufreq_driver=phc-intel"

Code: Select all

sudo update-grub
Reboot your computer.

Open a "terminal" window :

Code: Select all

sudo lsmod | grep phc      # You should have "phc_intel". If there is nothing, something does not work...
If it is ok, Linux-PHC v0.3.2 is installed.

Now, we install PHCtool. PHCtool is a GUI for Linux-PHC.
It will help us to test the voltages before setting them permanently.

Code: Select all

cd Downloads
cp cpuinfo.py 0.5.2-2/phctool/inc/libs/
cd 0.5.2-2/phctool
sudo apt install python-gtk2-dev
sudo ./install.sh       # (Answer "y")

sudo modprobe msr
sudo ./phctool.sh &
Do not modify/set something, we have not finished...
You should have "Name", "CPU Model", "Frequencies" fullfilled.
And Throttling = not available # (for this option, available or not, it is not a problem)
PHC extensions = available
PHC version = 0.3.2:3
MSR extensions = available
Vcc calculation = CPU recognized, calculation available

If everything is ok, close the phctool window, elsewhere something does not work...


So now, we have Linux-PHC et PHCtool GUI installed.
We are going to determine the lowest voltage values.
Open 2 "terminal" windows.
In the first one :

Code: Select all

cd Downloads/0.5.2-2/phctool
sudo modprobe msr       # Before running phctool, you must load the msr module (one time only is needed).
sudo ./phctool.sh &
In the PHCTool window, select "Voltages" tab.

Code: Select all

more /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
We will test the best VIDs for each speedstep. For my configuration (intel P9600), I have
2667000 2666000 2133000 1600000 800000
We begin to test the best VID for the first frequency, for me : 2667000
My cpu P9600 has 2 core, so I have to change frequency for both (if yours has not 2 core, you have to
rewrite the following commands)

Code: Select all

sudo bash -c 'for i in {0..1}; do sudo cpufreq-set -c $i -u 2667000 -d 2667000; done'
more /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq      # For me, the max frequency is set to 2667000, it is ok
In the second "terminal" window, run a cpu stress test :

Code: Select all

stress-ng --cpu 2 --cpu-method matrixprod  --metrics-brief --perf -t 500
The stress test is running, in the other terminal window, we check the current frequency, it should be to max (for me 2667000)

Code: Select all

sudo more /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Now, in PHCTool GUI, we decrease slowly the VID value for the frequency (for me 2667Mhz) and "save",
until it freezes...
Note : the bios defines a minimal VID. If you try to set a VID below, this minimal VID will be used.
To know if your VID >= minimal VID, select "Analysis" tab in the PHCTool GUI and check

When you know the lowest VID to work for a frequency, you repeat A) for the others
(for me 2666000 2133000 1600000)

At the end, do not forget to set the correct min max frequency (for me 2667000 - 800000)

Code: Select all

sudo bash -c 'for i in {0..1}; do sudo cpufreq-set -c $i -u 2667000 -d 800000; done'
more /sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
more /sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
Result for Lenovo R500 with intel P9600:

2667000 2666000 2133000 1600000 800000
Default VID 40 32 28 23 17
Minimum VID 27 24 ?? ?? ??
VID used(*) 31 28 21 19 17

Consumption with wattmeter (stress-ng) : Default VID = 43w VID used = 39w

Result for Lenovo T61 with intel T8300:

2401000 2400000 2000000 1600000 1200000 800000
Default VID 40 34 31 27 23 15
Minimum VID 24 24 ?? ?? ?? ??
VID used 28 28 26 23 20 15

Consumption with wattmeter (stress-ng) : Default VID = 48w VID used = 42w

Result for DEll E6400 with intel T9550:

2668000 2667000 2134000 1600000 800000
Default VID 44 38 31 23 15
Minimum VID 28 ?? ?? ?? ??
VID used 32 32 27 19 15

Consumption with wattmeter (stress-ng) : Default VID = 47w VID used = 42w
Firefox 57, video youtube 1080p : Default VID = 23.5w VID used = 22w

VID used = Minimum VID + 4 (security)

Make permanently
If you reboot, your settings are cancelled. You can see that with

Code: Select all

more /sys/devices/system/cpu/cpu*/cpufreq/phc_vids
So, download in your $HOME directory the file joined : .cpu_vid.sh
Open it and set your "VID used" (for me : "31 28 21 19 17 " (space at the end is necessary))

Code: Select all

chmod 700 .cpu_vid.sh
In the Xubuntu menu, select "Settings" => "Session and Startup"
In "Application Autostart" add a new item :
Name : CPU-vid
Description : Customized cpu VIDs
Command : bash -c 'sudo -S -s $HOME/.cpu_vid.sh >/dev/null 2>&1 <<< your_sudo_password'
( Replace "your_sudo_password" by your linux password )
For security, you can do

Code: Select all

chmod 600 $HOME/.config/autostart/CPU-vid.desktop

Check if it works...
Open a "terminal" window and after 20 seconds (delay in .cpu_vid.sh)

Code: Select all

more /sys/devices/system/cpu/cpu*/cpufreq/phc_vids
Issue : when the computer come back from a "suspend mode",
sometimes your cpu VIDs are cancelled and the default ones are used
Workaround : download the file (joined) 93phc_vids, open it and set your VIDs.
Then :

Code: Select all

sudo sh -c 'cp 93phc_vids /lib/systemd/system-sleep'
sudo sh -c 'chmod a+rwx /lib/systemd/system-sleep/93phc_vids'
(234 Bytes) Downloaded 93 times
(2.19 KiB) Downloaded 107 times
(291 Bytes) Downloaded 95 times

Post Reply