erpalma / throttled Goto Github PK
View Code? Open in Web Editor NEWWorkaround for Intel throttling issues in Linux.
License: MIT License
Workaround for Intel throttling issues in Linux.
License: MIT License
Hi, thanks very much for your code.
i have a question, i setup my t480s, use ~ -90mv undervoltage, and ~92oC temp wall.
it can run stress(in s-tui) very long time, but crash after stress stop immediately, i can watch CPU freq down from 3.xG to 800Mhz in seconds, then system crash..
some suggestion?
Not sure if this is known or useful to you guys, but --debug
now and then spits out the following:
/usr/lib/lenovo-throttling-fix/lenovo_fix.py:420: PyGIDeprecationWarning: Since version 3.11, calling threads_init is no longer needed. See: https://wiki.gnome.org/PyGObject/Threading
GObject.threads_init()
/usr/lib/lenovo-throttling-fix/lenovo_fix.py:421: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead
loop = GObject.MainLoop()
Some systeminfo:
λ python --version
Python 3.7.0
λ yay -Q |grep Pyg
pygmentize 2.2.0-2
pygobject-devel 3.28.3-2
python-pygments 2.2.0-2
Seems harmless, still I wanted to report this.
Instead of writing to the registers every X seconds, I believe it should be enough to just write to them at specific events, ie. after boot and after waking from sleep. Am I missing something?
SSIA
If I am correct this is MSR 0x64b.
0 is normal.
1 is the low profile.
2 is the high profile.
see my comment in my other ticket
Does the GPU
setting in the conf still apply to the integrated GPU if have the MX150 installed?
Any other considerations for if I have the MX150 installed?
Hey guys, nice tool you've got here, works on my X1C5. I was just playing with it and discovered that this does not work with linux-hardened
kernel (I am on ArchLinux). Running it with --debug
will log an error related to /dev/mem
. Perhaps it would be great to update README...
Thanks for your work on this. I just wanted to let you know that it also works on laptops from other manufacturers, e.g. Dell XPS 9370 with the same cpu. Perhaps the documentation could be updated to include this? I am also interested to know if the undervolting would work (I felt it best not to try it)?
On my XPS it now manages to sustain between 2.8 and 3.0 Ghz with temp between 97-99C depending on ambient. It no longer scales back to 2.2-2.4 Ghz with temps of 80C.
However I did note that the service fails if a temp of more than 97C is specified. In my case, although pushing the limits, it seems to be OK with the value manually set at 98 using wrmsr and it eeks out a further 50-100Mhz.
The scripts is now running with Python3 by default (tested w/ 3.6) and a virtualenv is automatically created in /opt/lenovo_fix. Python2 should probably still work.
Installed using:
yaourt -S lenovo-throttling-fix-git
virtualenv location was /usr/bin/env, not in /opt/
Also had module import error (ModuleNotFoundError: No module named 'dbus') for dbus, python-dbus was installed.
Changed the script to use my python install instead of the virtualenv and had no issues.
From:
#!/usr/bin/env python
To:
#!/usr/bin/python3
97'C thermal limit may get uncomfortable on the lap.
Something like 29w / 90'C might be a good compromise,
Or maybe even read in arbitrary values from a variable set in script for the brave. ex. if someone wants a 4.5w cTDP
Hi, i needed some time to figure out why the script was not working for me. Turns out it uses python2, maybe you could mention that somewhere in the readme. Afaik python3 is default on basically all distros nowadays.
The script has quite some dependencies beside python3. I am quite sure we could get rid of some by getting the information a bit differently.
When trying to run this fix on an X1 Carbon 6th gen I get the following error:
Traceback (most recent call last):
File "/usr/lib/lenovo-throttling-fix/lenovo_fix.py", line 245, in
main()
File "/usr/lib/lenovo-throttling-fix/lenovo_fix.py", line 205, in main
undervolt(config)
File "/usr/lib/lenovo-throttling-fix/lenovo_fix.py", line 78, in undervolt
writemsr(0x150, calc_undervolt_msr(plane, config.getfloat('UNDERVOLT', plane)))
File "/usr/lib/lenovo-throttling-fix/lenovo_fix.py", line 60, in writemsr
raise e
File "/usr/lib/lenovo-throttling-fix/lenovo_fix.py", line 51, in writemsr
f = os.open(c, os.O_WRONLY)
OSError: [Errno 6] No such device or address: '/dev/cpu/15/msr'
The skript was installed from the AUR and I am running it on an X1 Carbon i7-8550U
, Manjaro Kernel 4.17.9-1-MANJARO
It seems like the skript tries to access the msr register for cpu core number 15, which should not exist on a 8 core machine.
If I can help in any way, please let me know!
System was stable and I ran some benchmark, then I rebooted, still stable, Suddenly GPU started to show artifacts in very specific scenarios (some shaders in opengl) and then system became unstable, lagging for seconds every 30 seconds or so. I tried editing the config but filesystem became readonly, I forced a reboot and the system is now unbootable completely, shows only initramfs sheel at boot. Well I guess I should have made a backup :)
Is this compatible/needed with/at the X280?
this is a followup to #24
In archlinux,
from mmio import MMIO
must be change to
from periphery import MMIO
The tool is more targeting general cpu settings and is not related to lenovo in any other way beside their BIOS defaults are bad.
I think we should think about a new name for it which reflects this better.
First of all: thanks for the great work and the awesome tool! Filling one of the gaps that the multi million dollar company that claims to be linux friendly should not have left open ;)
First question is regarding undervolting differences between windows and linux: is it normal to find a (big) difference in possible undervolting settings between the two OS's? In windows I can run prime95 a day with -120mV on core and cache. In linux (using this script) -100mV is unstable (many firefox crashes). Theoretically this should not be the case I assume? How is your experience regarding this difference?
Second question is regarding undervolting differences between running plugged-in vs on battery. I found that I can run stable with a certain undervolt setting on AC, but this crashes the desktop (regardless the OS) when running on battery. I assume this has to do with the lowering of the default voltage bsy energy saving processes when on battery. The threshold is now too low and the system becomes unstable. Does this make sense? And in this case: would it be an idea to add different undervolting settings for plugged-in and on battery?
Thanks.
Sorry to use issues for this - i cant find how to message on github
I'm new to linux in genereal and I'd like to know what this fix actually performs.
I tried to make sense of the code and installer ... Does this fix keep an instance of python running continually to set the values every couple of seconds? or does it kill it and restarts it ? or is it a cron job or something else?
sorry if this is innapropriate...
thank in advance
Hi,
I own a Lenovo Thinkpad X1 witbh Intel i7 8550u. Running Kubuntu with kernel 4.17.2-041702-generic #201806160433.
I installed the fixapparently without issues and tried to play a bit the configuration file. However, no matter what i change I always get message about CPU throttling:
> [ 5285.052945] CPU2: Core temperature above threshold, cpu clock throttled (total events = 8)
> [ 5285.052945] CPU6: Core temperature above threshold, cpu clock throttled (total events = 8)
> [ 5285.052947] CPU3: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052948] CPU5: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052949] CPU4: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052950] CPU7: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052951] CPU0: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052951] CPU1: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052953] CPU6: Package temperature above threshold, cpu clock throttled (total events = 72)
> [ 5285.052959] CPU2: Package temperature above threshold, cpu clock throttled (total events = 72)
Moreover when running command rdmsr -f 29:24 -d 0x1a2
I cannot get better values than 10 when plugged in AC and 20 when using battery.
Do you think there could be something wrong with my setup or anything I can do to improve?
Thanks
There were several throttling warnings during boot before I installed the script and gone once after the installation. However, those warnings re-appeared after I boot my laptop again, any idea what might be the problem?
My laptop is T480 with i7-8650u
System: Arch Linux
Systemd version: 238
Thanks!
I tried using the lenovo_fix
service on T480s running Ubuntu 18.04 (Linux kernel 4.15) but it fails when starting:
user@t480s:~$ systemctl status lenovo_fix.service
● lenovo_fix.service - Fix Lenovo T480/T480s/X1C6 throttling on Linux
Loaded: loaded (/etc/systemd/system/lenovo_fix.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2018-05-13 14:35:56 CEST; 7min ago
Process: 1399 ExecStart=/opt/lenovo_fix/venv/bin/python3 /opt/lenovo_fix/lenovo_fix.py (code=exited, status=1/FAILURE)
Main PID: 1399 (code=exited, status=1/FAILURE)
May 13 14:35:56 t480s python3[1399]: main()
May 13 14:35:56 t480s python3[1399]: File "/opt/lenovo_fix/lenovo_fix.py", line 141, in main
May 13 14:35:56 t480s python3[1399]: undervolt(config)
May 13 14:35:56 t480s python3[1399]: File "/opt/lenovo_fix/lenovo_fix.py", line 61, in undervolt
May 13 14:35:56 t480s python3[1399]: writemsr(0x150, calc_undervolt_msr(plane, config.getfloat('UNDERVOLT', plane)))
May 13 14:35:56 t480s python3[1399]: File "/opt/lenovo_fix/lenovo_fix.py", line 37, in writemsr
May 13 14:35:56 t480s python3[1399]: os.write(f, struct.pack('Q', val))
May 13 14:35:56 t480s python3[1399]: PermissionError: [Errno 1] Operation not permitted
May 13 14:35:56 t480s systemd[1]: lenovo_fix.service: Main process exited, code=exited, status=1/FAILURE
May 13 14:35:56 t480s systemd[1]: lenovo_fix.service: Failed with result 'exit-code'.
The full error messages is as follows:
root@t480s:~# source /opt/lenovo_fix/venv/bin/activate
(venv) root@t480s:~# /opt/lenovo_fix/venv/bin/python3 /opt/lenovo_fix/lenovo_fix.py
Traceback (most recent call last):
File "/opt/lenovo_fix/lenovo_fix.py", line 169, in <module>
main()
File "/opt/lenovo_fix/lenovo_fix.py", line 141, in main
undervolt(config)
File "/opt/lenovo_fix/lenovo_fix.py", line 61, in undervolt
writemsr(0x150, calc_undervolt_msr(plane, config.getfloat('UNDERVOLT', plane)))
File "/opt/lenovo_fix/lenovo_fix.py", line 37, in writemsr
os.write(f, struct.pack('Q', val))
PermissionError: [Errno 1] Operation not permitted
Exception in thread Thread-1:
Traceback (most recent call last):
File "/opt/lenovo_fix/venv/lib/python3.6/site-packages/periphery/mmio.py", line 61, in _open
fd = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
PermissionError: [Errno 1] Operation not permitted: '/dev/mem'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/opt/lenovo_fix/lenovo_fix.py", line 113, in power_thread
mchbar_mmio = MMIO(0xfed159a0, 8)
File "/opt/lenovo_fix/venv/lib/python3.6/site-packages/periphery/mmio.py", line 36, in __init__
self._open(physaddr, size)
File "/opt/lenovo_fix/venv/lib/python3.6/site-packages/periphery/mmio.py", line 63, in _open
raise MMIOError(e.errno, "Opening /dev/mem: " + e.strerror)
periphery.mmio.MMIOError: [Errno 1] Opening /dev/mem: Operation not permitted
I have an L480 with a i7-8550U. (latest bios)
The script improves the situation (due to the thermal limits) but there is still something throtteling the CPU without need and limiting the potential. When I start stress with c of 1,2 or 8 I first get a period of high CPU performance (like I would expect it) of about 14 to 28 secodns. Then it gos with the following pattern: it drops very drastically for about 3 seconds followed by a higher (but not as high as at the beginning) utilisation for about 3 seconds. This pattern then repeats as long as cpu stress is there. Even if the temperature is 10°C below the thermal threshold (stress with c of 1 or 2) the performance goes down every 3 seconds for 3 seconds. When it goes down the temperature drops imeadiately to about 55 to 63°C. As I understand it there should be no need to throttle that long, much and offten. I guess there is some other magic register in the CPU involved.
I can see similar patterns on the machines of colleges using the s version.
Beside that lenovo does let the fan only run 2/3 of its max speed (which gets quit loud). Thinkfan solves this for me but the effect on performance is low anyway. Seems like lenovo did not design the laptops properly to get the heat away.
Let me know if I should send you some MSR values.
So, I tried running this script on my Kubuntu 17.10 install (ThinkPad T480) and was met with failure when the script failed to source the python venv. Here is the output:
$ sudo ./install.sh
Copying config file...
Copying systemd service file...
Building virtualenv...
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /opt/lenovo_fix/venv/bin/python3
Also creating executable in /opt/lenovo_fix/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
./install.sh: 26: ./install.sh: source: not found
The reason for this is pretty trivial, though it took me some time to figure it out: On Ubuntu-based systems /bin/sh
is a symlink to /bin/dash
, which doesn't understand the source
command. source
is a bashism, so there is no guarantee that other shells such as sh or dash support it.
Solution:
#!/bin/sh
to #!/bin/bash
to explicitly call bash instead of a similar shell (dash, ksh, zsh, whatever).
command instead of source
. This should allow the script to work on almost any other shell. For your referenceOh, and thanks for the script - now that everything is set up things are working wonderfully :)
This isn't a bug with the repo, but might be useful information to have for anyone passing by.
On my XPS 9370, I've been seeing a lot of kernel messages complaining about thermal throttling (package/core above temperature), despite it being only 40-50 degrees. One of the widgets in my window manager was reporting the CPU temperature as 90 degrees even though it wasn't.
For some reason, disabling C-states in the UEFI fixes this. I'm inclined to say it's a firmware bug.
install.sh script doesn't install dependencies via pip (log) on Fedora 28. I've installed all dependencies using dnf command and added —system-site-packages to virtualenv command in order to complete installation.
Is it possible to comment out values, not wanted to be set?
If not, would be a nice to have :-)
Just a short question regarding script updates to a newer version. Is it sufficient to just do a git pull of the script repo and then probably re-run the script? Or do I have to do something else like maybe first stop the service an/or uninstall a previous version of the script?
First of all, thank you for this fix :-)
Unfortunately the installation according to readme failed on my system:
`
configure: error: Package requirements (dbus-1 >= 1.6) were not met:
No package 'dbus-1' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables DBUS_CFLAGS
and DBUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-va9i90_i/dbus-python/setup.py", line 106, in <module>
'build_ext': BuildExt,
File "/opt/lenovo_fix/venv/lib/python3.6/site-packages/setuptools/__init__.py", line 129, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
dist.run_commands()
File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
self.run_command(cmd)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/opt/lenovo_fix/venv/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
return orig.install.run(self)
File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
self.run_command('build')
File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
cmd_obj.run()
File "/tmp/pip-install-va9i90_i/dbus-python/setup.py", line 62, in run
cwd=builddir)
File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/tmp/pip-install-va9i90_i/dbus-python/configure', '--disable-maintainer-mode', 'PYTHON=/opt/lenovo_fix/venv/bin/python3', '--prefix=/tmp/pip-install-va9i90_i/dbus-python/build/temp.linux-x86_64-3.6/prefix']' returned non-zero exit status 1.
`
---------------------------------------- Command "/opt/lenovo_fix/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-va9i90_i/dbus-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-jp1pmzfa/install-record.txt --single-version-externally-managed --compile --install-headers /opt/lenovo_fix/venv/include/site/python3.6/dbus-python" failed with error code 1 in /tmp/pip-install-va9i90_i/dbus-python/
Can you help me?
Attempted install on a brand new Fedora 28 system (Thinkpad T480s) after installing all listed dependencies. Installation failed sighting "No module named 'cairo'. Adding the python3-cairo-devel package resolved this issue.
Hello and good day,
this is not an issue but a question about the BATTERY value of PL2_Tdp_W.
On default it's also set to 44. Shouldn't this also be set to 29 like PL1_Tdp_W?
And another question in general:
When I have an i7-8550U the normal TLP is 15 watts right? So it's still lower than the default battery value of 29 here?
Is it possible to set the BATTERY values of PL1_Tdp_W and PL2_Tdp_W to 15 to even save more juice?
Thank you in advance and all the best
Hey, just wanted to confirm that it works for X1 C6 and I've used it for my tutorial: https://mensfeld.pl/2018/05/lenovo-thinkpad-x1-carbon-6th-gen-2018-ubuntu-18-04-tweaks/
Undervolting seems to work as well (so will update the art with that as well).
Since there isn't an installation guide for openSUSE systems, I have made a list of the required packages and attached them at the bottom. I don't know if all of the packages are necessary (going off guess and check), but having them all installed worked on my system.
deps.txt
Hi there,
thx so much for the fix it helped me to avoid to run into a total throttling where the CPU get stuck with 0.2 Ghz until a reboot.
Two particular issues I saw now with the default config of the lenovo-throttling-fix
.
Any comments on that or how I can measure or monitor my observation to have some objective evidence?
Regards
Valentin
Where does the 44W default come from? If I read your posts correctly you said you have a 8550U, but according to the 8550U Intel website its maximum TDP-up is 25W. Or am I misreading it?
I own a T460P with i7-6700HQ 3.5 GHz CPU and a GTX 940MX GPU.
Using this tool to undervolt my cpu and its cache by -150mV lowers the max temp from 90 to 80°C
But the throttling issue still exists.
Even if only one core reaches 100% while the others are doing nothing the throttling will be activated.
But it won't be deactivated after the ThinkPad is getting colder.
Means my OS lags and stutters every 2-3 Seconds (Video/Mouse Movement/Windows/Animations).
But not the sound.
PS:
It is weird that the max clock is 3.2GHz on only one Core instead of 3.5GHz turbo.
The s-tui tool is telling me, that power limit is 28 Watt without throttling and 25, 20 or 15 Watt after throttling.
I couldn't find a way to verify whether my CPU has been undervolted or not . Any way to test if the package works completely?
This great little program doesn't work in its current version on Ubuntu 18.04 and T480. It seems the script is unable to write voltage configuration.
I'm not interested in undervolt so I commented out the call to undervolt
, so the rest of the script works fine.
Relevant log below, kernel is 4.15.0-23-generic
.
ul 19 18:32:05 steve-ThinkPad-T480 kernel: [ 2115.556629] msr: Direct access to MSR 150
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: Traceback (most recent call last):
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/lenovo_fix.py", line 226, in <module>
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: main()
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/lenovo_fix.py", line 186, in main
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: Exception in thread Thread-1:
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: Traceback (most recent call last):
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/mmio.py", line 58, in _open
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: fd = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: PermissionError: [Errno 1] Operation not permitted: '/dev/mem'
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: During handling of the above exception, another exception occurred:
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: Traceback (most recent call last):
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: self.run()
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/usr/lib/python3.6/threading.py", line 864, in run
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: self._target(*self._args, **self._kwargs)
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/lenovo_fix.py", line 143, in power_thread
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: mchbar_mmio = MMIO(0xfed159a0, 8)
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/mmio.py", line 33, in __init__
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: self._open(physaddr, size)
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/mmio.py", line 60, in _open
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: raise MMIOError(e.errno, "Opening /dev/mem: " + e.strerror)
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: mmio.MMIOError: [Errno 1] Opening /dev/mem: Operation not permitted
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: undervolt(config)
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/lenovo_fix.py", line 67, in undervolt
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: writemsr(0x150, calc_undervolt_msr(plane, config.getfloat('UNDERVOLT', plane)))
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: File "/opt/lenovo_fix/lenovo_fix.py", line 43, in writemsr
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: os.write(f, struct.pack('Q', val))
Jul 19 18:32:05 steve-ThinkPad-T480 python3[23214]: PermissionError: [Errno 1] Operation not permitted
Jul 19 18:32:05 steve-ThinkPad-T480 systemd[1]: lenovo_fix.service: Main process exited, code=exited, status=1/FAILURE
Jul 19 18:32:05 steve-ThinkPad-T480 systemd[1]: lenovo_fix.service: Failed with result 'exit-code'.
I.e. is there a chance that the writes to MSR are detected by the BIOS/Firmware and
"noted down" leading to lenovos customer service rejecting repairs...?
If you buy a T480s through lenovo campus you get 36M VOS and adding
accident protection isn't expensive either. It would be sad to lose this
by "fixing" something which could be said to be a firmware bug...
Working on Asus UX430UN(R).
Os info: 4.18.5-arch1-1-ARCH #1 SMP PREEMPT Fri Aug 24 12:48:58 UTC 2018 x86_64 GNU/Linux
SYSFS_POWER_PATH
should be parametric and should be read from the config file. In my laptop this path is /sys/class/power_supply/AC0/online
.virtualenv
command in install.sh script is not necessary. I don't have it installed on my laptop and calling pip directly with python such as python3 -m pip install -r requirements.txt
/opt/lenovo_fix/venv/bin/python3
is a bit odd in service file. Can be replaced with /usr/bin/python3
without hesitation.The instructions could use
cd lenovo-throttling-fix
Also, the pip install
could perhaps use a -H
.
I'm using Linux Mint 19 on one of my laptop (X1C6) and after going through all steps and uninstalling thermald, laptop hangs spontaneous during first 2-3 mins after starting, deinstalling throttling fix helps to fix it.
Is it a known issue with Mint?
I got a T580 and I tried this script but it doesn't seem to fix the symptoms that I currently see. Is this supposed to work with T580?
Hello,
anyone has successfully used this fix on Qubes?
Thanks
Hi there,
firstly let me thank you for your work on this regard!
I've got multiple questions and some problems, you could help me with:
1.) If I disable systemd service, it seems the PL1/2 settings aren't reverted to the original values, correct?
Even after stopping the service and rebooting, turbostat reports them still as what I last have set them with lenovo-fix?
Ok, tested again. I explicitly set PL1_Tdp=17 and after disable systemd service and rebooting, this is what turbostat reports:
cpu0: PKG Limit #1: ENabled (29.000000 Watts, 28.000000 sec, clamp ENabled)
cpu0: PKG Limit #2: ENabled (44.000000 Watts, 0.002441* sec, clamp DISabled)
Setting anything with lenovo-fix then, shows up with turbostat then. Stopping lenovo-fix again, does not reset the values!
Btw, from the above:
So 29 & 44 are system's defaults and safe to be set in conf as these are system's defaults?
2.) As my Laptop has a dedicated Nvidia GPU, too, there's a heat problem, when using your script with installation standards. The system is running stable and fast, but the dGPU has a fall-off temperature of 76°C. As soon as the GPU reaches this value, it gets throttled to a 3rd of it's frequency (around 400MHz, instead of 1600). Strange thing here is, the GPU only levels its frequency within a range of 100MHz (1600-1700) when running glxspheres64 for instance.
So, what happens is, the GPU (as not able to throttle itself down more in multiple steps) reaches the 76° quite fast, as the machine's cooling system isn't able to vent off the heat resulting from higher performance with lenovo-fix.
I stumble upon this, as phoronix/openarena gets from app. 120FPS to app. 35FPS.
The GPU is clocked with around 400MHz until it gets down below 60° again, which doesn't happenm when CPU is producing heat.
So, the installation standards do not fit this machine when used with dGPU.
I tried undervolting, which makes the system last longer until the GPU's fall-off is reached, but system still gets too hot!
Using this config:
[GENERAL]
Enabled: True
## Settings to apply while connected to AC power
[AC]
# Update the registers every this many seconds
Update_Rate_s: 5
# Max package power for time window #1
PL1_Tdp_W: 15
# Time window #1 duration
PL1_Duration_s: 28
# Max package power for time window #2
PL2_Tdp_W: 44
# Time window #2 duration
PL2_Duration_S: 0.002
# Max allowed temperature before throttling
Trip_Temp_C: 93
# Set HWP energy performance hints to 'performance' on high load (EXPERIMENTAL)
HWP_Mode: False
# Set cTDP to normal=0, down=1 or up=2 (EXPERIMENTAL)
cTDP: 0
[UNDERVOLT]
# CPU core voltage offset (mV)
CORE: -120
# Integrated GPU voltage offset (mV)
GPU: -100
# CPU cache voltage offset (mV)
CACHE: -120
# System Agent voltage offset (mV)
UNCORE: -120
# Analog I/O voltage offset (mV)
ANALOGIO: 0
With glxspehere64 CPU is running around 3800MHz, 15W & 80°, which is nice. But dGPU is constantly heating up, as not clocked further down than 1657MHz and reached it's thermal limit of 76° with hard fall-off.
So, I somehow need a way, to solve this, as once I bring in the dGPU into the mix, I need less power, for to to overpower the cooling system, whereas performance withou dGPU heavy working, is nice'n stable...
2a)
When heating up, the touchpad gets irresponsive until I end glxsphere!? No entries in journal about that!?
3.) Is my following assumption correct?
The I7-8550U is declared with 15W TDP. cTDP_up would be 25W. So if setting PL1_Tdp=25, I need to set cTDP=2?
And, with having a TDP of 15W, setting 44W in conf is quite high above the TDP? Or am I missing something?
Tests with s-tui & mprime -t showed, that even when setting cTDP=1, system is using app. 30W while around 3.300MHz and around 88° with s-tui stress test. So that's double the TDP and 3 times cTDP (10W when down).
4.) I need a little help regarding PL1/2. If I set 29/44W PL1/2, using stress from s-tui, I get 3700MHz for about haf a minute, then Power drops to around 3400MHz and 28W Power. Expected, as PL1 is 29W. The stress is running continously with this power and frequency then. No further throttling to 15W is experienced?!
System is undervolted:
[UNDERVOLT]
# CPU core voltage offset (mV)
CORE: -120
# Integrated GPU voltage offset (mV)
GPU: -100
# CPU cache voltage offset (mV)
CACHE: -120
# System Agent voltage offset (mV)
UNCORE: -120
# Analog I/O voltage offset (mV)
ANALOGIO: 0
My system is: T580, I7-8550U, dGPU, 16GB Ram, Bionic 18.04, nvidia-396
I've got a T470 with an i7-7600U CPU. Right after bootup, it goes frequently into throttling so I decided to give this fix a try.
What I observed using s-tui is that it can stay way longer in Turbo Boost with the fix applied. The temperature raises to 96C and Power to about 23W (it stays at 19W without the fix).
I'm currently experimenting whether the EC resets the values periodically as well...
It looks like the install script needs the i386 version of the dependencies. I was able to install most of them by appending :i386
to the apt-get command from the readme. But Ubuntu won't install libgirepository1.0-dev:i386
at the moment.
sudo apt install libgirepository1.0-dev:i386
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Einige Pakete konnten nicht installiert werden. Das kann bedeuten, dass
Sie eine unmögliche Situation angefordert haben oder, wenn Sie die
Unstable-Distribution verwenden, dass einige erforderliche Pakete noch
nicht erstellt wurden oder Incoming noch nicht verlassen haben.
Die folgenden Informationen helfen Ihnen vielleicht, die Situation zu lösen:
Die folgenden Pakete haben unerfüllte Abhängigkeiten:
libgirepository1.0-dev:i386 : Hängt ab von: gobject-introspection:i386 (= 1.56.1-1) soll aber nicht installiert werden
E: Probleme können nicht korrigiert werden, Sie haben zurückgehaltene defekte Pakete.
This is the output of the install script:
Copying config file...
Config file already exists, skipping.
Copying systemd service file...
Building virtualenv...
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /opt/lenovo_fix/venv/bin/python3
Not overwriting existing python script /opt/lenovo_fix/venv/bin/python (you must use /opt/lenovo_fix/venv/bin/python3)
Installing setuptools, pkg_resources, pip, wheel...done.
Requirement already satisfied: configparser==3.5.0 in ./venv/lib/python3.6/site-packages (from -r requirements.txt (line 1)) (3.5.0)
Requirement already satisfied: dbus-python==1.2.8 in ./venv/lib/python3.6/site-packages (from -r requirements.txt (line 2)) (1.2.8)
Requirement already satisfied: psutil==5.4.7 in ./venv/lib/python3.6/site-packages (from -r requirements.txt (line 3)) (5.4.7)
Collecting PyGObject==3.30.0 (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/40/12/071e113583e826c9c06b06779730f2b5c3aae1d1a2cf715f25daa8f62ec6/PyGObject-3.30.0.tar.gz
Requirement already satisfied: pycairo>=1.11.1 in ./venv/lib/python3.6/site-packages (from PyGObject==3.30.0->-r requirements.txt (line 4)) (1.17.1)
Building wheels for collected packages: PyGObject
Running setup.py bdist_wheel for PyGObject ... error
Complete output from command /opt/lenovo_fix/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hfnpk6p1/PyGObject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-aca1qxbq --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pygtkcompat
copying pygtkcompat/__init__.py -> build/lib.linux-x86_64-3.6/pygtkcompat
copying pygtkcompat/generictreemodel.py -> build/lib.linux-x86_64-3.6/pygtkcompat
copying pygtkcompat/pygtkcompat.py -> build/lib.linux-x86_64-3.6/pygtkcompat
creating build/lib.linux-x86_64-3.6/gi
copying gi/_propertyhelper.py -> build/lib.linux-x86_64-3.6/gi
copying gi/__init__.py -> build/lib.linux-x86_64-3.6/gi
copying gi/types.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_signalhelper.py -> build/lib.linux-x86_64-3.6/gi
copying gi/importer.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_constants.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_gtktemplate.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_option.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_compat.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_ossighelper.py -> build/lib.linux-x86_64-3.6/gi
copying gi/pygtkcompat.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_error.py -> build/lib.linux-x86_64-3.6/gi
copying gi/docstring.py -> build/lib.linux-x86_64-3.6/gi
copying gi/module.py -> build/lib.linux-x86_64-3.6/gi
creating build/lib.linux-x86_64-3.6/gi/repository
copying gi/repository/__init__.py -> build/lib.linux-x86_64-3.6/gi/repository
creating build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/__init__.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Gdk.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GObject.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/keysyms.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Gtk.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GIMarshallingTests.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GLib.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Pango.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GdkPixbuf.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Gio.py -> build/lib.linux-x86_64-3.6/gi/overrides
running build_ext
Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gobject-introspection-1.0', required by 'world', not found
Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.
Try installing it with: 'sudo apt install libgirepository1.0-dev'
----------------------------------------
Failed building wheel for PyGObject
Running setup.py clean for PyGObject
Failed to build PyGObject
Installing collected packages: PyGObject
Running setup.py install for PyGObject ... error
Complete output from command /opt/lenovo_fix/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hfnpk6p1/PyGObject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-p64nygsx/install-record.txt --single-version-externally-managed --compile --install-headers /opt/lenovo_fix/venv/include/site/python3.6/PyGObject:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/pygtkcompat
copying pygtkcompat/__init__.py -> build/lib.linux-x86_64-3.6/pygtkcompat
copying pygtkcompat/generictreemodel.py -> build/lib.linux-x86_64-3.6/pygtkcompat
copying pygtkcompat/pygtkcompat.py -> build/lib.linux-x86_64-3.6/pygtkcompat
creating build/lib.linux-x86_64-3.6/gi
copying gi/_propertyhelper.py -> build/lib.linux-x86_64-3.6/gi
copying gi/__init__.py -> build/lib.linux-x86_64-3.6/gi
copying gi/types.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_signalhelper.py -> build/lib.linux-x86_64-3.6/gi
copying gi/importer.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_constants.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_gtktemplate.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_option.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_compat.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_ossighelper.py -> build/lib.linux-x86_64-3.6/gi
copying gi/pygtkcompat.py -> build/lib.linux-x86_64-3.6/gi
copying gi/_error.py -> build/lib.linux-x86_64-3.6/gi
copying gi/docstring.py -> build/lib.linux-x86_64-3.6/gi
copying gi/module.py -> build/lib.linux-x86_64-3.6/gi
creating build/lib.linux-x86_64-3.6/gi/repository
copying gi/repository/__init__.py -> build/lib.linux-x86_64-3.6/gi/repository
creating build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/__init__.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Gdk.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GObject.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/keysyms.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Gtk.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GIMarshallingTests.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GLib.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Pango.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/GdkPixbuf.py -> build/lib.linux-x86_64-3.6/gi/overrides
copying gi/overrides/Gio.py -> build/lib.linux-x86_64-3.6/gi/overrides
running build_ext
Package gobject-introspection-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gobject-introspection-1.0.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gobject-introspection-1.0', required by 'world', not found
Command '('pkg-config', '--print-errors', '--exists', 'gobject-introspection-1.0 >= 1.46.0')' returned non-zero exit status 1.
Try installing it with: 'sudo apt install libgirepository1.0-dev'
----------------------------------------
Command "/opt/lenovo_fix/venv/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-hfnpk6p1/PyGObject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-p64nygsx/install-record.txt --single-version-externally-managed --compile --install-headers /opt/lenovo_fix/venv/include/site/python3.6/PyGObject" failed with error code 1 in /tmp/pip-install-hfnpk6p1/PyGObject/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.