Instruction to disable power throttling on Librem 15 v3


#1

Hi. I notice that my Librem v15 is throttling. But it don’t reach high temperatures, just throttle and all. To disable power throttling, we will use msr-tools package and devmem2 utility to rewrite throttling parameters.
But without power limit we can damage our processor, because it can easily reach 85 degrees Celsius. To avoid damage, we will set thermal throttling to 65 Celsius degree. You can set your own target for thermal throttling with instructions below.

  1. Download msr-tools
    $ sudo apt-get install msr-tools

  2. Add msr module to /etc/modules-load.d/modules.conf

# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

msr
  1. Download and compile devmem2
$ wget https://raw.githubusercontent.com/hackndev/tools/master/devmem2.c
$ gcc devmem2.c -o devmem2
# mv devmem2 /usr/bin/
  1. Create script in this file: /usr/local/sbin/power-setup.sh
#! /bin/sh
wrmsr 0x1a2 0x23640000
wrmsr 0x610 0x42016000dd8160
devmem2 0xFED159A0 w 0xDD8160

First line is target for thermal throttling to 65 Celsius degree. Other lines is disabling power throttling. To create your own target to thermal throttling, use undervolt tool, read MSR value with rdmsr 0x1a2 and replace line in sctipt. Don’t forget 0x in start of value.

  1. Create systemd service in this file /etc/systemd/system/power-setup.service
[Unit]
Description=Power setup
DefaultDependencies=no
After=systemd-modules-load.service

[Service]
Type=simple
ExecStart=/usr/local/sbin/power-setup.sh

But you can ask: “We replace power throttling to thermal throttling. Why?” Answer is because with thermal throttling your fans spin less agressive when your CPU frequency boost to 3.1 GHz for short period of time and drop frequency on sustained state. Because your boost will turn off because of temperature, not because turboboost period was finished.

Sources:



Fan full blast after sleep, coreboot and Intel ME
Are there any plans to feature gradual fan speed (if it hasn't been already)?
#2

This sounds interesting!!

How safe is this?

Have you / has anyone tried whether these commands help when the “fan full blast” issue hit after waking up from sleep??

Thanks,
Stefan


#3

It safe while your temperatures under control. Also, CPU have some technoligies, which allow to safe processor if it overheating, like thermal throttling (standart target is 95 C), automatical power off.

About “fan full blast” after waking up, i got this issue today, but it first time when i catch this issue after 1.5 years of using. Usually, fan spin at fine speed.


#4

Thanks for the reply!

I agree and confirm that the “fan full blast” issue is now happening quite rarely. However, when I tried working around the issue and when (for whatever reason) it ‘hit’ me more frequently, none of the documented tricks to influence the processor frequency had any effect.

Hence my question whether the ‘wrmsr’ commands you show in your original post would be able to get the system unstuck from 400MHz. This would then be a real workaround rather than having to close the lid, wait, try again … Rest assured, great fun for you colleagues who have a Mac

Thanks,
Stefan


#5

You tried “turbostat” utility? It can show all limit values and more. To control CPU frequency, i usually use “cpupower” utility (all utilities included in “linux-cpupower” package). Probably it can help you to find, what limit you to 400 MHz.

turbostat version 18.07.27 - Len Brown <lenb@kernel.org>
CPUID(0): GenuineIntel 22 CPUID levels; family:model:stepping 0x6:4e:3 (6:78:3)
CPUID(1): SSE3 MONITOR - EIST TM2 TSC MSR ACPI-TM HT TM
CPUID(6): APERF, TURBO, DTS, PTM, HWP, HWPnotify, HWPwindow, HWPepp, No-HWPpkg, No-EPB
cpu3: MSR_IA32_MISC_ENABLE: 0x00850089 (TCC EIST MWAIT PREFETCH TURBO)
CPUID(7): SGX
cpu3: MSR_IA32_FEATURE_CONTROL: 0x00000004 (UN-Locked )
CPUID(0x15): eax_crystal: 2 ebx_tsc: 216 ecx_crystal_hz: 0
TSC: 2592 MHz (24000000 Hz * 216 / 2 / 1000000)
CPUID(0x16): base_mhz: 2600 max_mhz: 3100 bus_mhz: 100
cpu3: MSR_MISC_PWR_MGMT: 0x00001cc0 (ENable-EIST_Coordination DISable-EPB DISable-OOB)
RAPL: 17476 sec. Joule Counter Range, at 15 Watts
cpu3: MSR_PLATFORM_INFO: 0x4043df1011a00
4 * 100.0 = 400.0 MHz max efficiency frequency
26 * 100.0 = 2600.0 MHz base frequency
cpu3: MSR_IA32_POWER_CTL: 0x0080005d (C1E auto-promotion: DISabled)
cpu3: MSR_TURBO_RATIO_LIMIT: 0x1e1e1e1f
30 * 100.0 = 3000.0 MHz max turbo 4 active cores
30 * 100.0 = 3000.0 MHz max turbo 3 active cores
30 * 100.0 = 3000.0 MHz max turbo 2 active cores
31 * 100.0 = 3100.0 MHz max turbo 1 active cores
cpu3: MSR_CONFIG_TDP_NOMINAL: 0x00000019 (base_ratio=25)
cpu3: MSR_CONFIG_TDP_LEVEL_1: 0x0008003c (PKG_MIN_PWR_LVL1=0 PKG_MAX_PWR_LVL1=0 LVL1_RATIO=8 PKG_TDP_LVL1=60)
cpu3: MSR_CONFIG_TDP_LEVEL_2: 0x001a00c8 (PKG_MIN_PWR_LVL2=0 PKG_MAX_PWR_LVL2=0 LVL2_RATIO=26 PKG_TDP_LVL2=200)
cpu3: MSR_CONFIG_TDP_CONTROL: 0x00000000 ( lock=0)
cpu3: MSR_TURBO_ACTIVATION_RATIO: 0x00000019 (MAX_NON_TURBO_RATIO=25 lock=0)
cpu3: MSR_PKG_CST_CONFIG_CONTROL: 0x00000008 (UNlocked, pkg-cstate-limit=8 (unlimited))
cpu3: POLL: CPUIDLE CORE POLL IDLE
cpu3: C1: MWAIT 0x00
cpu3: C1E: MWAIT 0x01
cpu3: C3: MWAIT 0x10
cpu3: C6: MWAIT 0x20
cpu3: C7s: MWAIT 0x33
cpu3: C8: MWAIT 0x40
cpu3: C9: MWAIT 0x50
cpu3: C10: MWAIT 0x60
cpu3: cpufreq driver: intel_pstate
cpu3: cpufreq governor: powersave
cpufreq intel_pstate no_turbo: 0
cpu3: MSR_MISC_FEATURE_CONTROL: 0x00000000 (L2-Prefetch L2-Prefetch-pair L1-Prefetch L1-IP-Prefetch)
cpu0: MSR_PM_ENABLE: 0x00000001 (HWP)
cpu0: MSR_HWP_CAPABILITIES: 0x0105191f (high 31 guar 25 eff 5 low 1)
cpu0: MSR_HWP_REQUEST: 0x80001f04 (min 4 max 31 des 0 epp 0x80 window 0x0 pkg 0x0)
cpu0: MSR_HWP_INTERRUPT: 0x00000000 (Dis_Guaranteed_Perf_Change, Dis_Excursion_Min)
cpu0: MSR_HWP_STATUS: 0x00000000 (No-Guaranteed_Perf_Change, No-Excursion_Min)
cpu0: MSR_RAPL_POWER_UNIT: 0x000a0e03 (0.125000 Watts, 0.000061 Joules, 0.000977 sec.)
cpu0: MSR_PKG_POWER_INFO: 0x00000078 (15 W TDP, RAPL 0 - 0 W, 0.000000 sec.)
cpu0: MSR_PKG_POWER_LIMIT: 0x42016000dd8160 (UNlocked)
cpu0: PKG Limit #1: ENabled (44.000000 Watts, 28.000000 sec, clamp ENabled)
cpu0: PKG Limit #2: DISabled (44.000000 Watts, 0.002441* sec, clamp DISabled)
cpu0: MSR_DRAM_POWER_LIMIT: 0x00000000 (UNlocked)
cpu0: DRAM Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
cpu0: MSR_PP0_POLICY: 0
cpu0: MSR_PP0_POWER_LIMIT: 0x00000000 (UNlocked)
cpu0: Cores Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
cpu0: MSR_PP1_POLICY: 0
cpu0: MSR_PP1_POWER_LIMIT: 0x00000000 (UNlocked)
cpu0: GFX Limit: DISabled (0.000000 Watts, 0.000977 sec, clamp DISabled)
cpu0: MSR_IA32_TEMPERATURE_TARGET: 0x23640000 (100 C)
cpu0: MSR_IA32_PACKAGE_THERM_STATUS: 0x883d0802 (39 C)
cpu0: MSR_IA32_PACKAGE_THERM_INTERRUPT: 0x00000013 (100 C, 100 C)
cpu3: MSR_PKGC3_IRTL: 0x0000884e (valid, 79872 ns)
cpu3: MSR_PKGC6_IRTL: 0x00008876 (valid, 120832 ns)
cpu3: MSR_PKGC7_IRTL: 0x00008894 (valid, 151552 ns)
cpu3: MSR_PKGC8_IRTL: 0x000088fa (valid, 256000 ns)
cpu3: MSR_PKGC9_IRTL: 0x0000894c (valid, 339968 ns)
cpu3: MSR_PKGC10_IRTL: 0x00008bf2 (valid, 1034240 ns)

#6

Thanks!!! It’ a long time that I tried, but I believe I tried cpupower-frequency-set in vain … The tools are installed on my Librem, and once I encounter the next ‘fan full blast’ incident (and have time), I will try (again).


#7

Also, try “undervolt” utility. It have option to read and write some CPU limits and offsets. By default, all offsets is zero:

# ./undervolt.py -r
temperature target: -5 (95C)
core: 0.0 mV
gpu: 0.0 mV
cache: 0.0 mV
uncore: 0.0 mV
analogio: 0.0 mV

But in your case, it can be different. I don’t notice that “turbostat” show this values.