Powertop Auto Tune Startup

Posted on by
Powertop Auto Tune Startup Rating: 7,1/10 3700 votes

Preface

  1. Powertop Auto Tune
  2. Antares Auto-tune
  3. Powertop Auto Tune Startup Program
  4. Powertop Auto Tune On Boot

This post discusses a combined method to extend battery life of high-end laptops with 6-core or 9-core Intel CPUs while reducing the heat generation at the same time. The method sets CPU peformance differently depending on the power source (AC or battery) and uses TLP as a frontend for automation.

Summary

FS#43150 - powertop auto-tune crashes Attached to Project: Community Packages Opened by Heinrich Siebmanns (Harvey) - Thursday, 18 December 2014, 11:42 GMT. I think the wrong way use startup scripts is to do the opposite of what I just mentioned. For example, it's possible to run powertop -auto-tune at boot just by writing that line and saving it in rc.local. That's an example of a single-line command that's not included in a script.

  • Intel p_state driver
  • Completely software method (will not harm your hardware)
  • Intel processors with 6+ physical cores
  • Adjust perf for dynamic frequency downscaling, thus significantly reduce power consumption + heat
  • Disable unused CPU cores to maximize battery (not necessary for laptops with high-capacity battery)
  • Disable unused hardware in battery mode (ethernet/bluetooth.)
  • Can be used in tandem with other methods such as reducing CPU operating voltage (undervolt) or changing thermal conductivity substance (repaste)

Hi there:slightsmile: I'm newbie here. So i searched for it and found things like services and things like that Can someone explain in details how to run powertop on startup. Dec 30, 2016  Currently I use the systemd service provided from the Arch Wiki about powertop to do powertop -auto-tune at startup. Is there anyway that I will be able to make it so it does not auto-tune the GPU? - or perhaps make a script to do all the tunings manually? The service runs powertop -auto-tune which automatically sets most tunables to their 'Good' state, for maximum battery life. But sometimes it doesn't work well, especially with USB mice. USB Autosuspend. It perplexed me for a while why my USB mouse on a laptop would deactivate itself randomly (its LED turns off, and the mouse doesn't work until you click one of the buttons, and then it will. If running sudo powertop -auto-tune from a terminal and re-running sudo powertop, then all the auto-tunable settings correctly show up as Good. So, it looks like the service either fails to run, or errors while running in the service context. Phoronix: PowerTOP Still Worthwhile For Extending Linux Battery Life In 2018 Intel's open-source PowerTOP utility has been around for more than a decade now for aiming to extend the battery life of x86 Linux laptops.

Test Spec

Tested with Ubuntu 16.04.6 and Ubuntu 18.04.2 with latest kernel.

OS X: TinkerTool 5, v5.7. OS X: TinkerTool 5, v5.7. OS X: TinkerTool 4, v4.97. Tinkertool mac os sierra. OS X: TinkerTool 5, v5.7. macOS: TinkerTool 6, v6.5.

Battery:

Results:

powerstat is used to evaluate the battery discharge rate of different profiles.

MethodDischarge rateCPU Temp.LoadMethod Description
111.64W38-40CLight load: gnome-system-monitor, powerstat, powertop, background: Google Chrome (1 tab), psensorIntel GPU + this combined method + backlight display @ 15%
216.41W41-43CLight load: gnome-system-monitor, powerstat, powertop, background: Google Chrome (1 tab), psensorIntel GPU + TurboBoost disable + perf:19%-50% + original config + backlight display @ 15%
323.56W48-50CLight load: gnome-system-monitor, powerstat, powertop, background: Google Chrome (1 tab), psensornvidia GPU (GTX 1070 max-q) + TurboBoost disable + perf:19%-50% + original config + backlight display @ 15%
49.11W36CNo load (idle)Intel GPU + this combined method + backlight display @ 15%

Note: I used system76-power to disable the nvidia GPU.

While powertop reports the current recharge rate per process at the moment, it is not accurate to use it to measure the total power consumption. A tool that statistically measures the power consumption over a long period of time (7-10 minutes) will produce more reliable results. In this end, we use powerstat.

From the evaluation, method 1 can help oryx4 laptop last about 5 hours under light load (I often got 5h - 5.2h). While method 4 can prolong the laptop battery to 6 hours in idle (a convenient test case for different profiles, not practical use case).

Prerequisites

  • Intel p_state driver

Optional (but recommended)

  • TLP to automate the setting below.
  • powertop (one should not run powertop --auto-tune at start-up to avoid conflict with TLP).

Method Explained

To extend battery life, I use the following combined methods:

  • Enable dynamic frequency down-scaling based on performance profile in Intel p_state.
  • Disable unnecessary services/processes that adversely affect the battery life.
  • Automate the process with tlp.
  • Reduce the number of operational cores in battery mode. (manually run after startup)
  • Tuning with powertop.

Enable dynamic frequency down-scaling (runtime)

Instead of manual underclocking the CPU, I use a dynamic method to down-scale the CPU frequency by setting the maximum and minimum performance allowed in AC and battery.

Require: an active intel p_state driver (power governor = powersave(default))(to check: cat /sys/devices/system/cpu/intel_pstate/status)

Battery Mode:

Explain: Set the maximum performance allowed equal to 19% of the highest possible performance. The Intel p_state driver will down-scale the CPU frequency accordingly. This can be executed at run-time.

  • max-performance <- 20/100 is equivalent to set maximum CPU freq @ 800MHz (intel i7-8750H)
  • min-performance <- 20/100 is equivalent to set minimum CPU freq @ 800MHz (intel i7-8750H)
  • Turbo Boost <- disable

Note: You should experiment and try different max_perf_pct value and see what best suits your need. Suggest: if you are using in battery mode, try first with a value between 20-30%. If you are on AC, try a value between 70-90%.

AC Mode:

Explain: Set the maximum performance allowed equal to 80% of the highest possible performance. The Intel p_state driver will down-scale the CPU frequency accordingly. This can be executed at run-time.

  • max-performance <- 80/100 is equivalent to set maximum CPU freq @ 3400MHz (intel i7-8750H)
  • min-performance <- 20/100 is equivalent to set minimum CPU freq @ 800MHz (intel i7-8750H)
  • Turbo Boost <- enable

With these setting, the maximum CPU temperature is 40C (light load + no TurboBoost) on battery and 75-80C (high load + TurboBoost) with AC plugged in. Refer to this post for the relation between frequency and temperature.

To automate the process, I use TLP. You can find my TLP config here

Please read thru the config before applying. Also, I encourage you to peruse the tlp document here

Disable unnecessary processes

Disable Bluetooth (started with TLP at startup)

To disable bluetooth when on battery, change the following line in your TLP config:

DEVICES_TO_DISABLE_ON_STARTUP='bluetooth'

Disable Ethernet (runtime)

Voice changer

Ethernet consumes huge energy when it is used (12-14W) and considerable energy (0.5-1W) when it is not used/idle. To turn off your ethernet, refer to ifconfig for the ethernet interface name, then kill it

Note: ethernet could be on idle (i.e. no cable hooked up), but powertop would report it as in full utilization.

Refer to the bash script (execute after restart on battery): here

Powertop Auto Tune

Powertop Auto Tune Startup

Antares Auto-tune

Disable unused CPU cores (runtime)

I found out that I never utilized all my CPU cores in battery mode. Since my goal was to keep my laptop's battery from draining, I never ran any computationally expensive programs without an AC plugged. Therefore, it is helpful for me to disable few CPU cores on battery mode. It hasn't introduced any perceived performance drop since I only ran simple programs such as VI text editor, 4 or 5 Chrome tabs, LibreOffice, etc.

To disable 4/6 physical cores in i7-8750H (don't worry, they will become online if you explicitly enable them back on or after restart)

Replace echo 0 by echo 1 if you want to turn these CPU cores back on.

Refer to the bash script (execute after restart on battery) here.

Powertop Auto Tune Startup Program

Tuning with powertop (runtime)

  • Often it requires a calibration powertop --calibrate on battery for an extended period of time before you can start to tune.
  • Run powertop --auto-tune to let powertop tweak the bad processes that are eating your battery.
  • Refer to reference.
  • This should be done manually. Do not run powertop --auto-tune at startup to avoid conflict with TLP.

Powertop Auto Tune On Boot

Hope it helps.