[HowTo] Power savings setup| 2020-06-02

Difficulty: ★★★☆☆

Important things

  • Make sure that you have installed working fine for your hardware LTS kernel or lastest stable kernel
  • Since 4.12 kernel you have to create a /etc/udev/rules.d/60-ioschedulers.rules with setup about I/O schedulers for different types storage. HowTo is described in this article.
  • Make sure that you have installed for your CPU Microcode
  • Make sure that you have added the appropriate entries in the GRUB configuration file
  • Make sure you have installed all of the updates

Kernel

In default Manjaro ISOs provides lastest stable kernel release. If you have any issues/regressions hardware, you can simply change kernel to previous version. Please check official announcements forum threads to find out.

Check out https://www.kernel.org/category/releases.html for list of currently at the moment supported and maintained official kernel list.

You can simply use Manjaro Settings Manager for switch to another kernel branch OR using mhwd-kernel tool in terminal as root .

Current available list of kernel parameters is always available on https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html

CPUs Microcode

AMD CPU’s users should have installed lastest amd-ucode package.
Intel CPU’s users should have installed lastest intel-ucode package.

Adding advanced flags to the GRUB configuration file

This section IS NOT FOR NEWBIES. You need to know what hardware you’ve and set properly setup.
You can check what exactly flags are available for your hardware via command modinfo $MODULE_NAME | grep '^parm:' .
Example modinfo i915 | grep ‘^parm:’ results:

Make backup a default grub file:

sudo cp /etc/default/grub /etc/default/grub.bak

Edit grub file in Your favorite text editor. For this HowTo I used nano.

sudo nano /etc/default/grub

Find line:

GRUB_CMDLINE_LINUX=""

Paste the appropriate flags ‘‘between the quotation marks’’ as described below.

For more information on what these flags do, please read The Arch Wiki .

The story of _OSI(Linux)

ACPI OSI Linux Obsolete/legacy for OLDER devices with mostly BIOS FW.

acpi_osi="Linux"

From pre-history through Linux-2.6.22, Linux responded TRUE upon a BIOS OSI(Linux) query. Unfortunately, reference BIOS writers got wind of this and put OSI(Linux) in their example code, quickly exposing this string as ill-conceived and opening the door to an un-bounded number of BIOS incompatibilities.
For example, OSI(Linux) was used on resume to re-POST a video card on one system, because Linux at that time could not do a speedy restore in its native driver. But then upon gaining quick native restore capability, Linux has no way to tell the BIOS to skip the time-consuming POST – putting Linux at a permanent performance disadvantage.
On another system, the BIOS writer used OSI(Linux) to infer native OS support for IPMI! On other systems, OSI(Linux) simply got in the way of Linux claiming to be compatible with other operating systems, exposing BIOS issues such as skipped device initialization.

So “Linux” turned out to be a really poor chose of
OSI string, and from Linux-2.6.23 onward we respond FALSE.

BIOS writers should NOT query _OSI(Linux) on future systems.
Linux will complain on the console when it sees it, and return FALSE.
To get Linux to return TRUE for your system will require
a kernel source update to add a DMI entry,
or boot with “acpi_osi=Linux”.

Source

More explain about OSI

STRONGLY PLEASE READ this before going forward: How to Choose the Proper ACPI Kernel Argument made by @linesma

GRUB Flags

ACPI LM SENSORS Issues

WARNING : Users with modern devices (FW UEFI based) should not using ANY of additional flags EXCEPT really need them for resolving issues with lm-sensors, heating for example.
HP users should not use acpi=force acpi_enforce_resources=lax against ELAN Touchpad can missed from available devices.
See thread: https://archived.forum.manjaro.org/t/solved-touchpad-suddenly-not-recognised/142053/19

acpi=force acpi_enforce_resources=lax

When not working backlight control function keys

acpi=force acpi_enforce_resources=lax drm.vblankoffdelay=1 acpi_backlight=vendor

ACPI - for the modern models of laptops with UEFI (2011 year production or newer) please adding after acpi_osi=Linux :

acpi_osi='!Windows 2012'

ACPI - for the modern models of laptops with UEFI (2014 year production or newer) please using:

This workaround is dedicated for Intel Skylike Laptops with NVIDIA Optimus freezes issue. See: Bumblebee GH-764 :

acpi_osi=! acpi_osi="Windows 2009"

or

acpi_osi=! acpi_osi='Windows 2015'

On some laptops, when Fn keys or display backlight Fn keys does not works at all use blank acpi_osi value:

acpi_osi=

AMD - enable DPM for the graphics cards AMD Radeon. Flag Only for Linux Kernel built-in radeon module driver. [legacy]

radeon.dpm=1

AMD - enable HDMI Audio for the graphics cards AMD Radeon. Flag Only for Linux Kernel built-in radeon module driver. [legacy]

radeon.audio=1

INTEL - Enable Early Kernel Mode Setting for i915 module.

  • Edit /etc/mkinitcpio.conf file and in MODULES section add i915 .
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(piix ide_disk reiserfs)
MODULES=(i915)
  • Regenerate boot images:
sudo mkinitcpio -P
  • Add to GRUB_CMDLINE_LINUX in grub conf file and update grub configuration:
i915.modeset=1

Install X.org framebuffer video driver package:

sudo pacman -S xf86-video-fbdev --noconfirm --needed

Reboot for apply changes.

Disable IPv6 - don’t load required kernel modules for IPv6 working

NOTE: be sure you have disabled IPv6 support for external network apps and services like ufw firewall tool, ntpd Netwok Time Sync Daemon or dhcpd . Otherwise app services will not working properly. You have been warned.

More details and samples are available in this ArchWiki article .

For disable whole IPv6 stack add this setting to grub command line:

ipv6.disable=1

Disabling Consistent Network Device Naming

Simplify this setting restore legacy network interfaces names like ath0 wlan1 and so on.

net.ifnames=0

Don’t print systemd version during boot

rd.udev.log-priority=3

Disabling audit

audit=0

Disabling PCIE ASPM Power Savings against issues

pcie_aspm=off

Disabling Watchdog feautre

nowatchdog

NOTE: blacklist Watchdogs modules too:
/etc/modprobe.d/blacklist.conf

blacklist iTCO_wdt

blacklist iTCO_vendor_support

Forcing enable power saving mode for Atheros WLAN devices

In default ath9k module don’t switch to power saving mode under battery power mode.

ath9k.ps_enable=1

Disable all current mitigations to regain the maximum possible lost performance

UPDATE NOTICE 2020-04-09 from @FadeMind

Since discovering a lot of FW Intel Microcode CVE’s Linux kernel slowed down a lot (multicore 15% down, single core 25% down).
See https://www.reddit.com/r/linux/comments/b1ltnr/disabling_kernel_cpu_vulnerabilities_mitigations/

On site https://make-linux-fast-again.com/ they are available flags for disabling ALL of fixes maded in lastest kernel.

mitigations=off does not disabling all of them.

THERE IS a flag sentence.

mitigations=off noibrs noibpb no_stf_barrier tsx=on

After applying changes in grub AND REBOOT you can check status of mitigations via command:

sudo spectre-meltdown-checker

Disable Synaptics RMI4 spam in some Lenovo ThinkPads.

If you have spam message rmi4_phisical rmi4-00: Failed to read irqs, code=-6 or similar you can disable it via grub flag:

psmouse.synaptics_intertouch=0

Save applied changes to a file. Execute the command in a terminal:

 sudo update-grub

Installing additionals for TLP

TLP is installed, customized and enabled in Manjaro ISOs. You can install additional recommended tools for boost/extend power saving.

In a terminal, run the following command:

sudo pacman -S --needed tlp tlp-rdw iw smartmontools ethtool x86_energy_perf_policy

Disable RFKILL services:

sudo systemctl mask systemd-rfkill.socket systemd-rfkill.service

Reboot.

Check current settings of TLP via

sudo tlp-stat
# /etc/tlp.conf - TLP user configuration
# See full explanation: https://linrunner.de/en/tlp/docs/tlp-configuration.html
#
# New configuration scheme (TLP 1.3). Settings are read in the following order:

# 1. Intrinsic defaults
# 2. /etc/tlp.d/*.conf - Drop-in customization snippets
# 3. /etc/tlp.conf     - User configuration (this file)
#
# Notes:
# - In case of identical parameters, the last occurence has precedence
# - This also means, parameters enabled here will override anything else
# - IMPORTANT: all parameters here are disabled, remove the leading '#'
#   to enable them; shown values may be suggestions rather than defaults
# - Default *: intrinsic default that is effective when the parameter is missing
#     or disabled by a leading '#'; use PARAM="" to disable an intrinsic default
# - Default <none>: do nothing or use kernel/hardware defaults

WARNING :
After made changes in /etc/tlp.conf file restart systemd tlp service sudo systemctl restart tlp

Installing Linux Thermal Daemon

NOTE: thermald working only with Intel CPUs with P-State govenor

Before install thermald please install and configure propertly lm_sensors by command sudo pacman -S lm_sensors && sudo sensors-detect

Install, enable and run thermald daemon by following command:

NOTE - for now, the package thermald is in the AUR. We will use yay as an example here

yay -S thermald --needed

Manually enable and launch thermald systemd service:

sudo systemctl enable thermald && \
sudo systemctl start thermald

REQUIRED FOR 4.12 and NEWER. Dynamically changing the scheduler I/O disks.

Manjaro using in default mq-deadline . For customize I/O scheduler since 4.12 kernel YOU HAVE TO create a 60-ioschedulers.rules UDEV rule file. They are available new optionals schedulers.
Higher read/write performance for the solid state drives (SSD) have mq-deadline scheduler. You can automate the process of change scheduler disk I/O, depending on whether the disk is rotating (HDD) or not (SSD).

Create a new file:

sudo nano /etc/udev/rules.d/60-ioschedulers.rules

Paste this code into it:

# set scheduler for NVMe
ACTION=="add|change", KERNEL=="nvme[0-9]*", ATTR{queue/scheduler}="none"
# set scheduler for SSD and eMMC
ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"
# set scheduler for rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"

Update grub via sudo update-grub and restart the computer.

You can check current using scheduler for all connected disks by command:

 cat /sys/block/sd*/queue/scheduler

Summary

This topic is just BASIC guide for tweaks and improving performance. Since lastest major update this topic a lot were changed in hardware and software code self.
I encourage you to read the documentation TLP. You can customize the service to suit your needs. This topic contains the basic configuration to work properly.

See Also

7 Likes

Probably the announcement link should point to this forum and not the archived forum one ? And eventually add/edit the other topics that point still to the archived forum, so we have them here.

First I want copy all my own tutos, next will be reviewed in few days IMHO. Be patient :wink: Thanks for TIP!

1 Like

Just made the ACPI one and changed the link to point to it. Provided the credits too @linesma :slight_smile:

Feel free review and apply changes if needed. Thank you <3

1 Like