Intel PState Tuning - lhl/linuxlaptops GitHub Wiki

https://linrunner.de/tlp/settings/processor.html

lhl@frame ~ [1]> cpupower frequency-info analyzing CPU 0: driver: intel_pstate CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: Cannot determine or is not supported. hardware limits: 400 MHz - 4.70 GHz available cpufreq governors: performance powersave current policy: frequency should be within 400 MHz and 4.70 GHz. The governor "powersave" may decide which speed to use within this range. current CPU frequency: Unable to call hardware current CPU frequency: 871 MHz (asserted by call to kernel) boost state support: Supported: yes Active: yes lhl@frame ~> tlp-stat -p Error: missing root privilege. lhl@frame ~ [1]> sudo tlp-stat -p [sudo] password for lhl: --- TLP 1.5.0 --------------------------------------------

+++ Processor CPU model = 12th Gen Intel(R) Core(TM) i7-1260P

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 400000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 4700000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_performance [HWP.EPP] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/intel_pstate/status = active /sys/devices/system/cpu/intel_pstate/min_perf_pct = 10 [%] /sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] /sys/devices/system/cpu/intel_pstate/no_turbo = 0 /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost = 0 /sys/devices/system/cpu/intel_pstate/turbo_pct = (not available) /sys/devices/system/cpu/intel_pstate/num_pstates = (not available)

/sys/module/workqueue/parameters/power_efficient = Y /proc/sys/kernel/nmi_watchdog = 0

+++ Platform Profile /sys/firmware/acpi/platform_profile = (not available) /sys/firmware/acpi/platform_profile_choices = (not available)

lhl@frame ~> sudo tlp-stat -p --- TLP 1.5.0 --------------------------------------------

+++ Processor CPU model = 12th Gen Intel(R) Core(TM) i7-1260P

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 400000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 4700000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = balance_power [HWP.EPP] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power

/sys/devices/system/cpu/cpu1..cpu15: omitted for clarity, use -v to show all

/sys/devices/system/cpu/intel_pstate/status = active /sys/devices/system/cpu/intel_pstate/min_perf_pct = 10 [%] /sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] /sys/devices/system/cpu/intel_pstate/no_turbo = 0 /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost = 0 /sys/devices/system/cpu/intel_pstate/turbo_pct = (not available) /sys/devices/system/cpu/intel_pstate/num_pstates = (not available)

/sys/module/workqueue/parameters/power_efficient = Y /proc/sys/kernel/nmi_watchdog = 0

+++ Platform Profile /sys/firmware/acpi/platform_profile = (not available) /sys/firmware/acpi/platform_profile_choices = (not available)

lhl@frame ~> sudo x86_energy_perf_policy cpu0: EPB 7 cpu0: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu0: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu1: EPB 7 cpu1: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu1: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu2: EPB 7 cpu2: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu2: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu3: EPB 7 cpu3: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu3: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu4: EPB 7 cpu4: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu4: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu5: EPB 7 cpu5: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu5: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu6: EPB 7 cpu6: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu6: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu7: EPB 7 cpu7: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu7: HWP_CAP: low 1 eff 21 guar 27 high 60 cpu8: EPB 7 cpu8: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu8: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu9: EPB 7 cpu9: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu9: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu10: EPB 7 cpu10: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu10: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu11: EPB 7 cpu11: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu11: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu12: EPB 7 cpu12: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu12: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu13: EPB 7 cpu13: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu13: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu14: EPB 7 cpu14: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu14: HWP_CAP: low 1 eff 16 guar 15 high 34 cpu15: EPB 7 cpu15: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (010^0us) use_pkg 0 cpu15: HWP_CAP: low 1 eff 16 guar 15 high 34 pkg0: HWP_REQ_PKG: min 1 max 255 des 0 epp 128 window 0x0 (0*10^0us) pkg0: MSR_HWP_INTERRUPT: 0x00000001 (Excursion_Min-Disabled, Guaranteed_Perf_Change-ENabled) pkg0: MSR_HWP_STATUS: 0x00000000 (No-Excursion_Min, No-Guaranteed_Perf_Change)

https://github.com/linrunner/TLP/issues/490 https://www.reddit.com/r/linuxhardware/comments/w9wp61/questions_regarding_intel_pstate_eppepb_and/ https://gitlab.freedesktop.org/hadess/power-profiles-daemon/-/issues/97 https://www.phoronix.com/review/intel-12900k-pstate https://www.kernel.org/doc/html/v4.19/admin-guide/pm/intel_pstate.html https://wiki.archlinux.org/title/CPU_frequency_scaling#Scaling_drivers

https://www.phoronix.com/review/intel-12900k-pstate/7

https://unix.stackexchange.com/questions/182696/how-to-get-current-cpupower-governor

EPP Listing https://manpages.debian.org/testing/linux-cpupower/x86_energy_perf_policy.8.en.html

The following table shows the mapping from the value strings above to actual MSR values. This mapping is defined in the Linux-kernel header, msr-index.h.

VALUE STRING      	EPB	EPP
performance       	0	0
balance-performance	4	128
normal, default		6	128
balance-power	 	8	192
power       		15	255


echo balance_power > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference

echo power > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference

EPP 225 https://community.frame.work/t/linux-battery-life-tuning/6665/204

In /etc/tlp.conf

CPU_ENERGY_PERF_POLICY_ON_BAT=225

result:

cat /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference
225

See: https://www.reddit.com/r/framework/comments/yd5fyk/comment/itw3s3k/?utm_source=share&utm_medium=web2x&context=3

FWIW, this seems pretty normal to me for your hardware. I have a 1260P w/ 2 x 32GB DDR4-3200 SODIMMs and a Phison E18 PCIe 4.0 NVMe drive and am running Arch w/ 6.0.2 and vanilla sway. With wifi on, bluetooth off, 1% display brightness, powerstat gives me an average of 3.51W w/ a std deviation of 0.06, w/ 99.75% C10 residency.

As for your comments about doing anything and bringing up power, again, sadly, this is also normal.

You can try this at home for science/giggles if you want - I ran a second terminal (I use foot) with a bash one-liner that would echo and sleep for 1 second. This brought C10 residency down to ~99.5% and raised average power consumption to 4.09W (std deviation 0.04). So an additional 0.5W of power consumption for 0.25% more CPU activity.

I tried this again setting sleep to 0.1s which brought C10 down to ~98.7% and bumped up power to 5.5W. In this case a 1% difference in C10 residency = 2W of additional power usage!

And out of curiosity, when I set sleep to 0.01s - C10 went down to 93.5% and power usage went all the way up to 9W. powerstat reports the overall CPU usage 96.4% idle, mind you and load is barely above 1 so the system isn't being stressed at all - remember, we aren't actually doing anything except for echoing lines to our terminal but we're now down to 6h of battery life.

Anyway, just thought this was worth bring up for perspective, since it's easy to get distracted w/ idle power golf (I'm guilty of it myself). Sadly, the almost idle power performance, which for real world usage for most users is probably a lot more common and gets pretty bad, pretty quickly.

I run my laptop w/ thermald which loads the adaptive DPTF tables, and tlp set to powersave and balance-power w/ intel_pstate (that's EPB = 8 and EPP = 192) - interestingly, switching EPP to power actually made power consumption worse on this test (less C10 residency, higher power consumption!).

https://github.com/linrunner/TLP/issues/490

sudo x86_energy_perf_policy
cpu0: EPB 7
cpu0: HWP_REQ: min 6 max 6 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu0: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu1: EPB 7
cpu1: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu1: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu2: EPB 7
cpu2: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu2: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu3: EPB 7
cpu3: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu3: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu4: EPB 7
cpu4: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu4: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu5: EPB 7
cpu5: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu5: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu6: EPB 7
cpu6: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu6: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu7: EPB 7
cpu7: HWP_REQ: min 6 max 60 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu7: HWP_CAP: low 1 eff 21 guar 27 high 60
cpu8: EPB 7
cpu8: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu8: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu9: EPB 7
cpu9: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu9: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu10: EPB 7
cpu10: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu10: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu11: EPB 7
cpu11: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu11: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu12: EPB 7
cpu12: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu12: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu13: EPB 7
cpu13: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu13: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu14: EPB 7
cpu14: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu14: HWP_CAP: low 1 eff 16 guar 15 high 34
cpu15: EPB 7
cpu15: HWP_REQ: min 4 max 34 des 0 epp 102 window 0x0 (0*10^0us) use_pkg 0
cpu15: HWP_CAP: low 1 eff 16 guar 15 high 34
pkg0: HWP_REQ_PKG: min 1 max 255 des 0 epp 128 window 0x0 (0*10^0us)
pkg0: MSR_HWP_INTERRUPT: 0x00000001 (Excursion_Min-Disabled, Guaranteed_Perf_Change-ENabled)
pkg0: MSR_HWP_STATUS: 0x00000000 (No-Excursion_Min, No-Guaranteed_Perf_Change)

https://docs.kernel.org/admin-guide/pm/intel_idle.html https://wiki.bu.ost.ch/infoportal/_media/embedded_systems/ethercat/controlling_processor_c-state_usage_in_linux_v1.1_nov2013.pdf https://01.org/blogs/qwang59/2018/how-achieve-s0ix-states-linux

Testing

Using:

powerstat -d 0 -c -H 1 480

Scenarios:

  • idle testing
  • bash - echo 'hi'; sleep 0.01/0.1/1
  • Spotify
  • YouTube video playback
  • mpv video playback

Tests:

  • bash script, echo and sleep
  • idle, clocks,
⚠️ **GitHub.com Fallback** ⚠️