GithubHelp home page GithubHelp logo

undervolt's Introduction

Warning! This program is untested (apart from by myself) and it may damage your hardware! Use at your own risk.

undervolt Build Status

undervolt is a program for undervolting Intel CPUs under Linux. It works in a similar manner to the Windows program ThrottleStop (i.e, MSR 0x150). You can apply a fixed voltage offset to one of 5 voltage planes, override your systems temperature target (CPU will throttle when this temperature is reached), and adjust the system's short and long power budgets (clocks and thus voltages will be altered in order to keep total power usage in these periods under the configured limits).

For more information, read here.

Installing

From PyPi:

$ pip install undervolt

From source:

$ pip install git+https://github.com/georgewhewell/undervolt.git    

Note for custom kernel users: the module 'msr' ("CONFIG_X86_MSR") must be enabled in the kernel options (Processor type & features -> Model-specific register support)

Examples

Read current offsets:

$ undervolt --read
temperature target: -25 (75C)
core: -110.35 mV
gpu: -49.8 mV
cache: -110.35 mV
uncore: -59.57 mV
analogio: -59.57 mV
powerlimit: 35.0W (short: 1.0s - enabled) / 35.0W (long: 1.0s - enabled)
turbo: enabled

Apply -100mV offset to CPU Core and Cache:

$ undervolt --core -100 --cache -100

Apply -75mV offset to GPU, -100mV to all other planes:

$ undervolt --gpu -75 --core -100 --cache -100 --uncore -100 --analogio -100

Set temperature target to 97C:

$ undervolt --temp 97

Set powerlimit 1 to 35W, 10s:

$ undervolt -p1 35 10

Set Intel Turbo disabled:

$ undervolt --turbo 1

Generated the command to run to recreate your Throttlestop settings:

$ undervolt --throttlestop ThrottleStop.ini --tsindex 3
undervolt --core -100.5859375
$ undervolt --throttlestop ThrottleStop.ini
undervolt --core -125.0 --gpu -125.0 --cache -125.0

Usage

$ undervolt -h
usage: undervolt.py [-h] [--version] [-v] [-f] [-r] [-t TEMP]
                    [--temp-bat TEMP_BAT] [--throttlestop THROTTLESTOP]
                    [--tsindex TSINDEX] [-p1 POWER_LIMIT TIME_WINDOW]
                    [-p2 POWER_LIMIT TIME_WINDOW] [--lock-power-limit]
                    [--core CORE] [--gpu GPU] [--cache CACHE]
                    [--uncore UNCORE] [--analogio ANALOGIO]

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  -v, --verbose         print debug info
  -f, --force           allow setting positive offsets
  -r, --read            read existing values
  --turbo               Changes the Intel Turbo feature status (1 is disabled and 0 is enabled)
  -t TEMP, --temp TEMP  set temperature target on AC (and battery power if
                        --temp-bat is not used)
  --temp-bat TEMP_BAT   set temperature target on battery power
  --throttlestop THROTTLESTOP
                        extract values from ThrottleStop
  --tsindex TSINDEX     ThrottleStop profile index
  -p1 POWER_LIMIT TIME_WINDOW, --power-limit-long POWER_LIMIT TIME_WINDOW
                        P1 Power Limit (W) and Time Window (s)
  -p2 POWER_LIMIT TIME_WINDOW, --power-limit-short POWER_LIMIT TIME_WINDOW
                        P2 Power Limit (W) and Time Window (s)
  --lock-power-limit    Locks the set power limit. Once they are locked, they
                        can not be modified until next RESET (e.g., Reboot).
  --core CORE           offset (mV)
  --gpu GPU             offset (mV)
  --cache CACHE         offset (mV)
  --uncore UNCORE       offset (mV)
  --analogio ANALOGIO   offset (mV)

Running automatically on boot (systemd)

First, create a unit file /etc/systemd/system/undervolt.service with following contents, replacing the arguments with your own offsets:

[Unit]
Description=undervolt
After=suspend.target
After=hibernate.target
After=hybrid-sleep.target

[Service]
Type=oneshot
# If you have installed undervolt globally (via sudo pip install):
ExecStart=/usr/local/bin/undervolt -v --core -150 --cache -150 --gpu -100
# If you want to run from source:
# ExecStart=/path/to/undervolt.py -v --core -150 --cache -150 --gpu -100

[Install]
WantedBy=multi-user.target
WantedBy=suspend.target
WantedBy=hibernate.target
WantedBy=hybrid-sleep.target

Check that your script works:

$ systemctl start undervolt

Now you may enable undervolt service:

$ systemctl enable undervolt

Or, if you have issue with settings persistence, create a timer /etc/systemd/system/undervolt.timer to trigger the task periodically: :

[Unit]
Description=Apply undervolt settings

[Timer]
Unit=undervolt.service
# Wait 2 minutes after boot before first applying
OnBootSec=2min
# Run every 30 seconds
OnUnitActiveSec=30

[Install]
WantedBy=multi-user.target

Now enable and start the timer:

$ systemctl enable undervolt.timer
$ systemctl start undervolt.timer

By including the OnBootSec command, settings will not be immediately applied. If you have set overly-aggressive offsets, you will have a short period to disable the timer before it crashes your system:

$ systemctl stop undervolt.timer

Now you can edit your undervolt.service before re-starting the timer.

Running automatically on boot (runit)

First, create a 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/

Hardware support

Undervolting should work on any CPU later than Haswell.

System CPU Working?
Acer Aspire 7 (A715-71G) i5-7300HQ Yes
Acer Aspire E 15 (E5-575G) i5-7200U Yes
Acer Nitro 5 i5-7300HQ Yes
Acer Nitro 5 (An515-52) i5-8300H Yes
Acer Predator (PH315-51) i7-8750H Yes
Acer Swift 7 (SF714) i5-8200Y Yes
Asus FX504GE i7-8750H Yes
Asus GL703GE i7-8750H Yes
Dell G5 i7-8750H Yes
Dell G5 5590 i7-9750H Yes
Dell Inspiron 5577 i7-7700HQ

Yes

Dell Inspiron 7560 i7-7500U Yes
Dell Latitude 3301 i5-8265U Yes
Dell Latitude 5400 i7-8665U Yes
Dell Latitude 5480 i5-6300U Yes
Dell Latitude 7390 i7-8650U Yes
Dell Precision 5530 i9-8950HK Yes
Dell Precision 7530 i9-8950HK Yes
Dell Precision 7730 E-2176M Yes
Dell Precision 7740 E-2286M Yes
Dell Precision M3800 i7-4712HQ Yes
Dell XPS 13 9343 i5-5200U Yes
Dell XPS 13 9350 i7-6560U Yes
Dell XPS 13 9360 i7-7560U Yes
Dell XPS 15 7590 i7-9750H Yes
Dell XPS 15 7590 i9-9980HK Yes
Dell XPS 15 9530 i7-4712HQ Yes
Dell XPS 15 9550 i7-6700HQ Yes
Dell XPS 15 9560 i7-7700HQ Yes
Dell XPS 15 9570 i9-8950HK Yes
Dell XPS 15 9575 i7-8705G Yes
HP Omen 17-an061ur i7-7700HQ Yes
HP Spectre X360 i7-8809G Yes
HP Zbook Studio G5 i7-8750H Yes
Intel NUC7i3BNK i3-7100U Yes
Lenovo AIO Y910 27ISH i7-6700 Yes
Lenovo IdeaCentre Q190 1017U No
Lenovo Thinkpad T430 i7-3610QM No
Lenovo Thinkpad T440p i5-4300M Yes
Lenovo Thinkpad T470p i7-7700HQ Yes
Lenovo Thinkpad T470p i7-7820HQ Yes
Lenovo Thinkpad T470s i5-7300U Yes
Lenovo Thinkpad T480s i5-8250U Yes
Lenovo Thinkpad T490 i5-8265U Yes
Lenovo Thinkpad X1 Carbon i7-6600U Yes
Lenovo Thinkpad X1 Extreme i7-8750H Yes
Lenovo Thinkpad X1 Extreme Gen 2 i7-9750H Yes
Lenovo Thinkpad x250 i7-5600U Yes
Lenovo X1 Gen 5 i7-7500U Yes
Lenovo X1 Yoga Gen 2 i7-7600U Yes
Lenovo Yoga 920 i7-8550U Yes
MSI GE60 2QD Apache i7-4720HQ Yes
MSI GP73 Leopard 8RF i7-8750H Yes
MacBook Air Late 2015 i5-5250U Yes
MacBook Air Mid 2013 i5-4250U Yes
Toshiba Chromebook 2 N2840 No

Troubleshooting

  • Core or Cache offsets have no effect. It is not possible to set different offsets for CPU Core and Cache. The CPU will take the smaller of the two offsets, and apply that to both CPU and Cache. A warning message will be displayed if you attempt to set different offsets.
  • OSError: [Errno 1] Operation not permitted First try running with sudo. If the error persists, your system is probably booted in Secure Boot mode. In this case, the Linux kernel will prevent userspace programs (even as root) from writing to the CPU's model-specific registers. Disable UEFI Secure Boot in your system's BIOS and the error should go away.
  • Undervolt has no effect - Your device BIOS might be blocking it. Check the wiki (https://github.com/georgewhewell/undervolt/wiki) to find notes for your hardware

GUI

There is also a small gui written in Java avaiable here: https://github.com/zmalrobot/JavaLinuxUndervolt

It will allow you to set each value core, gpu, cache, uncore, analogio (temperature target isn't implemented yet),save a profile, load a profile and reset the value.

Credit

This project is a trivial wrapper around the work of others from the following resources:

Many thanks to all who contributed.

undervolt's People

Contributors

ace4896 avatar alexistm avatar anaveragehuman avatar auyer avatar axnes avatar carlthome avatar dennisvanderpool avatar dieguitins avatar dmitry-borodin avatar dsankouski avatar georgewhewell avatar glitchwitch avatar gunchev avatar hmaarrfk avatar jonathancoe avatar koder-ua avatar kylebakerio avatar ldaws011 avatar makreft avatar martinhuszti avatar maxiberta avatar mensfeld avatar mrcuve0 avatar mroyme avatar mthomos avatar nmustaki avatar nyaaawhatsupdoc avatar oliph avatar oscardssmith avatar superstructor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

undervolt's Issues

Undervolt values read at start up does not reset

Thank you for the tool!

I have set up the undervolt service and the timer as instructed. I expect after reboot the voltage offsets should be gone (i.e., back to zero). However, when I use the read command (undervolt -r), the values returned are exactly the same as the most recent offset values.

I know that before reading msr some values must be written. That said, is there anyway to check if the voltage offsets are reset after rebooting?

I am assuming rebooting is the same as crashing due to extreme offsets.

LENOVO ThinkPad X1 Extreme 20MFCTO1WW i7-8750H CPU

I can confirm undervolt works awesome on above configuration. I could use below and get more than 10 hours (sometimes 12).

$ sudo undervolt --read
temperature target: -37 (63C)
core: -155.27 mV
cache: -155.27 mV
analogio: 0.0 mV
uncore: -155.27 mV
gpu: -155.27 mV

Unable to set it to start on boot

Undervolt is installed for root. Would that cause an issue? (I had to install it as root, otherwise it was not getting the appropriate permissions)

root@pratyush-GS65-Stealth-Thin-8RF:~# which undervolt
/usr/local/bin/undervolt

Here is my undervolt.service

pratyush@pratyush-GS65-Stealth-Thin-8RF:~$ cat /etc/systemd/system/undervolt.service
[Unit]
Description=undervolt

[Service]
Type=oneshot
# If you want to run from source:
ExecStart=/usr/local/bin/undervolt -v --core -180 --cache -180 --gpu -70

Error -

root@pratyush-GS65-Stealth-Thin-8RF:~# systemctl start undervolt
Job for undervolt.service failed because the control process exited with error code.
See "systemctl status undervolt.service" and "journalctl -xe" for details.

Cannot undervolt iGPU of i7-8705G

The CPU part of the i7-8705G can be successfully undervolted using undervolt, however the --gpu option does not seem to have any effect (although undervolt --read reports a non-zero offset).

Steps to reproduce:

  1. Undervolt the GPU with a sufficiently large (negative) offset:
    $ sudo undervolt --core -0 --cache -0 --uncore -0 --analogio -0 --gpu -500 --temp
    $ sudo undervolt --read
    
    Output:
    temperature target: -0 (100C)
    core: 0.0 mV
    cache: 0.0 mV
    analogio: 0.0 mV
    uncore: 0.0 mV
    gpu: -500.0 mV
    
  2. Stress the GPU (e.g. run Unigine Superposition)

Expected behaviour:

  • The GPU will likely crash immediately at step 1, and in any case the stress test should crash it.

Observed behaviour:

  • Nothing happens. The stress test completes successfully. Temperature is not affected so the iGPU is probably drawing as much power as before.

System info:

  • CPU: Intel® Core™ i7-8705G CPU @ 3.10GHz × 8
  • iGPU: Intel® HD Graphics 630 (Kaby Lake GT2)
  • Laptop: Dell XPS 9575
  • Distribution: Fedora 28 (64 bit)
  • Secure boot: off
  • Kernel: 4.18.13-200.fc28.x86_64

multiprocessing.cpu_count() returns wrong CPU count

if you disable hyperthreading via kernel boot parameters, multiprocessing.cpu_count() returns the total number of CPU cores available as if hyperthreading were still enabled, so write_msr() functions fails as it can't find some of the cores it's expecting under /dev/cpu/*/msr

if you replace this logic with a new function cpu_count() to use in place of multiprocessing.cpu_count(), it fixes the issue:

def cpu_count():
    """
    Use 'lscpu' to get CPU count (takes into account hyperthreading)
    """
    lscpu = os.popen('lscpu').readlines()
    for line in lscpu:
        if line.startswith('NUMA node0'):
            cpus = line.split(':')[1].strip(' \n').split(',')
    for i in range(len(cpus)):
        cpus[i] = int(cpus[i])
    return cpus

then in write_msr() use:
for i in cpu_count():

OSError: [Errno 5] Input/output error

$ sudo python3 ~/Downloads/undervolt/undervolt.py --read
temperature target: -0 (100C)
Traceback (most recent call last):
File "/home/lolart/Downloads/undervolt/undervolt.py", line 289, in
main()
File "/home/lolart/Downloads/undervolt/undervolt.py", line 284, in main
voltage = read_offset(plane)
File "/home/lolart/Downloads/undervolt/undervolt.py", line 178, in read_offset
write_msr(value_to_write)
File "/home/lolart/Downloads/undervolt/undervolt.py", line 53, in write_msr
os.write(f, pack('Q', val))
OSError: [Errno 5] Input/output error

im using an ASUS A53S
sudo lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 36 bits physical, 48 bits virtual
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Model name: Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
Stepping: 7
CPU MHz: 1146.933
CPU max MHz: 3000.0000
CPU min MHz: 800.0000
BogoMIPS: 4789.58
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 3072K
NUMA node0 CPU(s): 0-3
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx lahf_lm epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid xsaveopt dtherm ida arat pln pts md_clear flush_l1d

sudo ls /dev/cpu/*/
/dev/cpu/0/:
msr

/dev/cpu/1/:
msr

/dev/cpu/2/:
msr

/dev/cpu/3/:
msr

thank you very much for your help

ExecStart

I get an error asking for absolute path for ExecStart=undervolt. Where is it placed?

Bad Line Start DRM_KMS_HELPER

I'm getting the following issue while doing: undervolt --read

libkmod: ERROR ../libkmod/libkmod-config.c:656 kmod_config_parse: /etc/modprobe.d/local.conf line 1: ignoring bad line starting with 'drm_kms_helper'
temperature target: -3 (97C)
core: 0.0 mV
cache: 0.0 mV
analogio: 0.0 mV
uncore: 0.0 mV
gpu: 0.0 mV

Can't get it to start on boot

Feb 21 01:11:29 idorobots sudo[15403]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/python3 /home/karam/.local/bin/undervolt -v --core -101 --cache -101 --gpu -75
Feb 21 01:11:29 idorobots sudo[15403]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 21 01:11:29 idorobots startupuv[15402]: Traceback (most recent call last):
Feb 21 01:11:29 idorobots startupuv[15402]: File "/home/karam/.local/bin/undervolt", line 7, in
Feb 21 01:11:29 idorobots startupuv[15402]: from undervolt import main
Feb 21 01:11:29 idorobots startupuv[15402]: ImportError: No module named 'undervolt'
Feb 21 01:11:29 idorobots sudo[15403]: pam_unix(sudo:session): session closed for user root

Intel i7-5500U reports large offsets for all except core

After a fresh boot, I'm seeing large offsets for everything except core.

$ sudo undervolt -v -r
INFO:root:Writing 0x8000001000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/0/msr
INFO:root:Read 0x0 from /dev/cpu/0/msr
core: 0.0 mV
INFO:root:Writing 0x8000011000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/0/msr
INFO:root:Read 0x10000000000 from /dev/cpu/0/msr
gpu: 510000.0 mV
INFO:root:Writing 0x8000021000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/0/msr
INFO:root:Read 0x20000000000 from /dev/cpu/0/msr
cache: 1022000.0 mV
INFO:root:Writing 0x8000031000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/0/msr
INFO:root:Read 0x30000000000 from /dev/cpu/0/msr
uncore: 1534000.0 mV
INFO:root:Writing 0x8000041000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/0/msr
INFO:root:Read 0x40000000000 from /dev/cpu/0/msr
analogio: 2046000.0 mV

Using linux-intel-undervolt-tool, I see everything set to 0.

$ sudo intel-undervolt read
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

Undervolting the core to -100 works as expected.

$ sudo undervolt -v --core -100
INFO:root:Setting core offset to -100mV
INFO:root:Writing 0x80000011f3400000 to /dev/cpu/3/msr
INFO:root:Writing 0x80000011f3400000 to /dev/cpu/2/msr
INFO:root:Writing 0x80000011f3400000 to /dev/cpu/1/msr
INFO:root:Writing 0x80000011f3400000 to /dev/cpu/0/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/0/msr
INFO:root:Read 0xf3400000 from /dev/cpu/0/msr

$ sudo undervolt -v -r
INFO:root:Writing 0x8000001000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/0/msr
INFO:root:Read 0xf3400000 from /dev/cpu/0/msr
core: -99.61 mV
INFO:root:Writing 0x8000011000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/0/msr
INFO:root:Read 0x10000000000 from /dev/cpu/0/msr
gpu: 510000.0 mV
INFO:root:Writing 0x8000021000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/0/msr
INFO:root:Read 0x20000000000 from /dev/cpu/0/msr
cache: 1022000.0 mV
INFO:root:Writing 0x8000031000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/0/msr
INFO:root:Read 0x30000000000 from /dev/cpu/0/msr
uncore: 1534000.0 mV
INFO:root:Writing 0x8000041000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/0/msr
INFO:root:Read 0x40000000000 from /dev/cpu/0/msr
analogio: 2046000.0 mV

$ sudo intel-undervolt read 
CPU (0): -99.61 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

Undervolting the gpu to -100 seems to work, but fails to report correctly.

$ sudo undervolt -v --gpu -100
INFO:root:Setting gpu offset to -100mV
INFO:root:Writing 0x80000111f3400000 to /dev/cpu/3/msr
INFO:root:Writing 0x80000111f3400000 to /dev/cpu/2/msr
INFO:root:Writing 0x80000111f3400000 to /dev/cpu/1/msr
INFO:root:Writing 0x80000111f3400000 to /dev/cpu/0/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/0/msr
INFO:root:Read 0x100f3400000 from /dev/cpu/0/msr
Traceback (most recent call last):
  File "/home/draje/env/bin/undervolt", line 11, in <module>
    sys.exit(main())
  File "/home/draje/env/lib/python3.6/site-packages/undervolt.py", line 208, in main
    set_offset(plane, offset)
  File "/home/draje/env/lib/python3.6/site-packages/undervolt.py", line 168, in set_offset
    p=plane, t=target, r=format(read, '08x')))
ValueError: Unknown format code 'x' for object of type 'str'

$ sudo undervolt -v -r
INFO:root:Writing 0x8000001000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000001000000000 to /dev/cpu/0/msr
INFO:root:Read 0xf3400000 from /dev/cpu/0/msr
core: -99.61 mV
INFO:root:Writing 0x8000011000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000011000000000 to /dev/cpu/0/msr
INFO:root:Read 0x100f3400000 from /dev/cpu/0/msr
gpu: 511900.39 mV
INFO:root:Writing 0x8000021000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000021000000000 to /dev/cpu/0/msr
INFO:root:Read 0x20000000000 from /dev/cpu/0/msr
cache: 1022000.0 mV
INFO:root:Writing 0x8000031000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000031000000000 to /dev/cpu/0/msr
INFO:root:Read 0x30000000000 from /dev/cpu/0/msr
uncore: 1534000.0 mV
INFO:root:Writing 0x8000041000000000 to /dev/cpu/3/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/2/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/1/msr
INFO:root:Writing 0x8000041000000000 to /dev/cpu/0/msr
INFO:root:Read 0x40000000000 from /dev/cpu/0/msr
analogio: 2046000.0 mV

$ sudo intel-undervolt read
CPU (0): -99.61 mV
GPU (1): -99.61 mV
CPU Cache (2): -0.00 mV
System Agent (3): -0.00 mV
Analog I/O (4): -0.00 mV

CPU: Intel i7-5500U
Machine: XPS 13 9343
OS: Arch Linux
Python: Python 3.6.5
Undervolt: 0.2.3

Works Dell G5 i7-8750H

Great work! Dell G5 Ubuntu 18.04, i7-8750H undervolting CPU/Core to -125mv lowers core temps 6-7 degrees Celsuis.

Error: could not insert 'msr'

So I tried to use this in order to undervolt my i7-8750H as it puts out a little too much heat for my liking. However, when i type:

undervolt -r

I get the following error:

modprobe: ERROR: could not insert 'msr': Operation not permitted Traceback (most recent call last): File "/home/stefan/anaconda3/bin/undervolt", line 11, in <module> sys.exit(main()) File "/home/stefan/anaconda3/lib/python3.7/site-packages/undervolt.py", line 231, in main subprocess.check_call(['modprobe', 'msr']) File "/home/stefan/anaconda3/lib/python3.7/subprocess.py", line 341, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['modprobe', 'msr']' returned non-zero exit status 1.

I installed msr-tools and when i type sudo undervolt -r it tells me sudo: undervolt: Command not found. Does anybody have any idea on how to fix this?
Any help is greatly appreciated.

XPS 9570 temperature target constant

Run sudo undervolt -t 95 (or any number) and expect sudo undervolt -r to output correct temperature target.

sudo undervolt -r

temperature target: -3 (97C)
core: -99.61 mV
gpu: -75.2 mV
cache: -99.61 mV
uncore: -99.61 mV
analogio: -99.61 mV

sudo undervolt -v -t 95

INFO:root:Writing 0x5000000 to /dev/cpu/0/msr
INFO:root:Writing 0x5000000 to /dev/cpu/1/msr
INFO:root:Writing 0x5000000 to /dev/cpu/2/msr
INFO:root:Writing 0x5000000 to /dev/cpu/3/msr
INFO:root:Writing 0x5000000 to /dev/cpu/4/msr
INFO:root:Writing 0x5000000 to /dev/cpu/5/msr
INFO:root:Writing 0x5000000 to /dev/cpu/6/msr
INFO:root:Writing 0x5000000 to /dev/cpu/7/msr
INFO:root:Writing 0x5000000 to /dev/cpu/8/msr
INFO:root:Writing 0x5000000 to /dev/cpu/9/msr
INFO:root:Writing 0x5000000 to /dev/cpu/10/msr
INFO:root:Writing 0x5000000 to /dev/cpu/11/msr

Also tried disabling service and running undervolt alone, sudo undervolt --core -100 --cache -100 --gpu -75 --uncore -100 --analogio -100 -t 95.

Confirm to work on Dell XPS-15 9560

Worked out of the box on Dell XPS-15 9560 with Ubuntu 19.07 and Nvidia. So far example values seem fine for me:

sudo /home/tom/.local/bin/undervolt --gpu -75 --core -100 --cache -100 --uncore -100 --analogio -100

Saving me it seems under load about 10C !

Great stuff. Thank you

XPS 15 9570 i9-8950HK - Weird CPU Temp Target

Seemed to report correct underclock voltages, just a werid temperature target:

temperature target: -131 (-31C)
core: -99.61 mV
cache: -99.61 mV
analogio: -99.61 mV
uncore: -99.61 mV
gpu: -75.2 mV

sensors shows this:

Package id 0:  +41.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +39.0°C  (high = +100.0°C, crit = +100.0°C)
Core 1:        +40.0°C  (high = +100.0°C, crit = +100.0°C)
Core 2:        +38.0°C  (high = +100.0°C, crit = +100.0°C)
Core 3:        +37.0°C  (high = +100.0°C, crit = +100.0°C)
Core 4:        +38.0°C  (high = +100.0°C, crit = +100.0°C)
Core 5:        +39.0°C  (high = +100.0°C, crit = +100.0°C)

Operation not permitted

Console log:

root@luog-X510UQR:/opt/undervolt# ./undervolt.py --read
temperature target: -5 (95C)
Traceback (most recent call last):
  File "./undervolt.py", line 257, in <module>
    main()
  File "./undervolt.py", line 252, in main
    voltage = read_offset(plane)
  File "./undervolt.py", line 167, in read_offset
    write_msr(value_to_write)
  File "./undervolt.py", line 40, in write_msr
    os.write(f, pack('Q', val))
OSError: [Errno 1] Operation not permitted

System:

  • ASUS K510U - i7 8550U
  • Linuxmint 19

Code not probably fully compatible with Python 2

Code might not be fully working on Python 2. (When loading from ThrottleStop.ini)
When using Python 2.7.15rc1 (default, Apr 15 2018, 21:51:34)
Getting following error:

nicce@nicce:$ sudo undervolt --throttlestop ThrottleStop.ini
Traceback (most recent call last):
  File "/usr/local/bin/undervolt", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/undervolt.py", line 225, in main
    ts = config['ThrottleStop']
AttributeError: ConfigParser instance has no attribute '__getitem__'

I switched to Python 3.6.5 (default, Apr 1 2018, 05:46:30)
Works great.

Using Thinkpad X1 Yoga Gen2, Ubuntu 18.04, Linux Kernel 4.17

Why run the timer every 30 seconds?

I really like your script and how simple and effective it is.
How ever, running it every 30 seconds makes me wonder.

Wouldn't it be enough to just run it after booting and after comming back from suspend?
Why would you run the script constantly every 30 seconds?

Remove cache option

since core and cache have to be set the same, why not just use core to set cache also?

undervolt --read command not found

I'm getting stuck on something easy, but hopefully answering this question will help the other noobs out there!

I've cloned the git repo, but I don't have access to the undervolt command in the way that the documentation suggests. When I run undervolt --read I get the following error:

undervolt: command not found.

I've also tried navigating to the ~/undervolt directory and tried python undervolt.py --read which produces a different error:

modprobe: ERROR: could not insert 'msr': Operation not permitted
Traceback (most recent call last):
  File "undervolt.py", line 283, in <module>
    main()
  File "undervolt.py", line 234, in main
    subprocess.check_call(['modprobe', 'msr'])
  File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['modprobe', 'msr']' returned non-zero exit status 1

Laptop Specs:

Dell XPS 15 9570
i7-8750H (12) @ 4.100GHz
Xubuntu 18.04 LTS
4.15.0-45-generic

Any insight is appreciated!

Add --version to the CLI interface

I think it would be a useful addition to the Command line interface.

__version__ = '0.3.1'
# ...
    parser.add_argument('--version', action='version', version='%(prog)s version}'.format(version=__version__))

The only downside is that you need to either update the version in both setup.py and undervolt.py or use one of the solutions mentioned here. FYI I've used bumpversion and it works out just fine

If you want, I can make a pull request.

Advantages over intel-undervolt

The Readme presents this project as a thin wrapper on top of Intel-undervolt. Apart from small differences in the cli, are there reasons to use this project over the other? Are there differences in the featureset?

undervolting the discreet gpu

Hi,
My laptop has a GTX1050Ti discreet GPU in addition to the intel GPU. When we undervolt the GPU, it seems to undervolt only the intel GPU. Is there a way to undervolt the discreet GPU as well?

Dell Precision 5530 i9-8950HK

You can add this model to the list. I just set it up, but so far so good.

Thanks for this. I was afraid my machine was going to meld down. Doing gradle builds with --parallel would just be steady 100C and throttling like mad.

OnUnitActiveSec not needed?

In documentation you mention:

# Run every 30 seconds
OnUnitActiveSec=30

But why is that? Once set, the undervolt should stay in place until reboot.. right?

MSI GP73 Leopard 8RF

I can confirm that this works with Ubuntu 18.04 on a MSI GP73 Leopard 8RF with an i7-8750H.
This and faking the TDP in the BIOS allows me to finally run this beast stable on 3.9-4GHz with all cores active. No more TDP or thermal throttling 😄

Gui

Hi!
I'm new here but i made a small interface gui for your script, may i publish it?

Screenshot 2019-04-20 14:04:34

Feature:

  1. Applying profile
  2. Reset all to 0
  3. Load and save profile
  4. Stess cpu after applying voltage

Missing:

  1. Temperature target, on my pc don't work so i have no way to test it...
  2. A lot of testing... i've made it for my personal use, so it will not cover all cases

Ps:
it i's made in java and it will not include your script but there is a script that download it from here ( i'm a lazy guy ;-) ) and i've mentioned you in the faq and in the source code (...obviously i'll upload that too ) !

Inpuut/Output error on --read

stjo@swanky undervolt $ ./undervolt.py -r     
Traceback (most recent call last):
  File "./undervolt.py", line 285, in <module>
    main()
  File "./undervolt.py", line 276, in main
    tjunc=read_temperature(),
  File "./undervolt.py", line 157, in read_temperature
    return read_msr(0x1a2) >> 24
  File "./undervolt.py", line 54, in read_msr
    f = os.open(n, os.O_RDONLY)
PermissionError: [Errno 13] Permission denied: '/dev/cpu/0/msr'
stjo@swanky undervolt $ sudo ./undervolt.py -r
temperature target: -0 (100C)
Traceback (most recent call last):
  File "./undervolt.py", line 285, in <module>
    main()
  File "./undervolt.py", line 280, in main
    voltage = read_offset(plane)
  File "./undervolt.py", line 170, in read_offset
    write_msr(value_to_write)
  File "./undervolt.py", line 45, in write_msr
    os.write(f, pack('Q', val))
OSError: [Errno 5] Input/output error

Here some (hopefully) useful info:
uname

stjo@swanky undervolt $ uname -a
Linux swanky 4.8.17-galliumos #1 SMP PREEMPT galliumos4 Thu Feb 23 02:27:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

/proc/cpuinfo

stjo@swanky undervolt $ cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 55
model name	: Intel(R) Celeron(R) CPU  N2840  @ 2.16GHz
stepping	: 8
microcode	: 0x816
cpu MHz		: 499.000
cache size	: 1024 KB
physical id	: 0
siblings	: 2
core id		: 0
cpu cores	: 2
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer rdrand lahf_lm 3dnowprefetch epb tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat
bugs		:
bogomips	: 4331.60
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

processor	: 1
vendor_id	: GenuineIntel
cpu family	: 6
model		: 55
model name	: Intel(R) Celeron(R) CPU  N2840  @ 2.16GHz
stepping	: 8
microcode	: 0x816
cpu MHz		: 833.000
cache size	: 1024 KB
physical id	: 0
siblings	: 2
core id		: 1
cpu cores	: 2
apicid		: 2
initial apicid	: 2
fpu		: yes
fpu_exception	: yes
cpuid level	: 11
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm sse4_1 sse4_2 movbe popcnt tsc_deadline_timer rdrand lahf_lm 3dnowprefetch epb tpr_shadow vnmi flexpriority ept vpid tsc_adjust smep erms dtherm ida arat
bugs		:
bogomips	: 4342.68
clflush size	: 64
cache_alignment	: 64
address sizes	: 36 bits physical, 48 bits virtual
power management:

I'm using a toshiba chromebook 2 (2014 edition, codename swanky), model CB35-B{4 numbers that I don't think anyone cares about}.

[RFE] Kaby Lake R support

Hi,
I just tried to run undervolt on Carbon X1 Gen 6 with i7-8650U. Doesn't seem to be working. Can we expect support for these cpu's in the future?

temperature target: -20 (80C)
core: 0.0 mV
cache: 0.0 mV
analogio: 0.0 mV
uncore: 0.0 mV
gpu: 0.0 mV

Problems on XPS 15 9550

Hi! I'm trying to use the undervolt but I keep getting errors. I'm on a XPS 15 9550 and I have disabled secure boot in BIOS.

When i run "undervolt --read" i get: OSError: [Errno 1] Operation not permitted: '/dev/cpu/0/msr'

I then try with "sudo undervolt --read" and get: sudo: undervolt: command not found

What else can i try?
Maybe I'm using it completely wrong?

Regards
Ejje

Stopped working after kernel upgrade 4.15.0-22-generic Ubuntu 18.04 LTS

First of all, thank you for this undervolt script. I've been using it to lower the temps on my thinkpad x1 c6 laptop. CPU is Intel(R) Core(TM) i7-8550U

With that said, I upgraded my linux kernel last week and it appears to have broken the undervolt script unfortunately.

Kernel is from Ubuntu 18.04 . 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018

Here's the error:

root@x1c6# ./undervolt.py -r
Traceback (most recent call last):
  File "./undervolt.py", line 243, in <module>
    main()
  File "./undervolt.py", line 238, in main
    voltage = read_offset(plane)
  File "./undervolt.py", line 159, in read_offset
    write_msr(value_to_write)
  File "./undervolt.py", line 38, in write_msr
    f = os.open(c, os.O_WRONLY)
OSError: [Errno 6] No such device or address: '/dev/cpu/15/msr'

Here's some text commands:

root@x1c6# ls -ltrh /dev/cpu/15/msr
crw------- 1 root root 202, 15 May 28 16:56 /dev/cpu/15/msr

root@x1c6# cat /dev/cpu/15/msr
cat: /dev/cpu/15/msr: No such device or address

If you need me to do some tests or need more info, let me know.

OSError: [Errno 13] Permission denied: '/dev/cpu/0/msr'

When I use "undervolt -r"
it outputs the error Traceback(most recent call last): File "/home/user/.local/bin/undervolt", line 11, in <module> sys.exit(main()) File "/home/user/.local/lib/python2.7/site-packages/undervolt.py", line 271, in main tjunc=read_temperature(), File "/home/user/.local/lib/python2.7/site-packages/undervolt.py", line 157, in read_temperature return (read_msr(0x1a2) & (127 << 24)) >> 24 File "/home/user/.local/lib/python2.7/site-packages/undervolt.py", line 54, in read_msr f = os.open(n, os.O_RDONLY) OSError: [Errno 13] Permission denied: '/dev/cpu/0/msr'
even after disabling secure boot, it still shows me this error

Dell Precision 7530 i9-8950HK

I can confirm that this works with Ubuntu 18.04 on a Dell Precision 7530 with i9-8950HK.

I'm so glad to have found this and really enjoy the extra 10-20% performance that can be had for free.

noob needs help

Hi, I did the installation but when I try running it said
"undervolt: command not found"
did I do something wrong?
it did said:
"Collecting undervolt
Installing collected packages: undervolt
Successfully installed undervolt-0.2.7"

Confirm to work on Dell Inspiron 15-7537

It works out of the box on a Dell Inspiron 15-7537 with Ubuntu 19.04, equipped with an Intel i7 4500U.

This config seems to be stable.

sudo undervolt --core -50 --cache -50 --gpu -75

Undervolting the CPU with a 100 mV offset leads to a CPU freeze.

Thank for the software.

Intel gpu not undervolting

I've tried undervolting a dell xps 15 9560 with an i7-7700HQ
The cpu undervolting is working cause by using -150mv or less the pc freezes.
The gpu undervolting however seems like to have no effect at all since i can set -500mv and everything works fine.

I also noticed that by setting more than a certain value like -2000mv and then reading the settings -2000 becomes positive, it doesn't show -2000 in the reading but 2000 without -

I'm sure i'm not using the nvidia gpu.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.