Improving battery life, TLP and Intel pstate

Ok I have done as you said by inputting sudo udevadm control --log-level="debug" into the dom0 terminal while the AC is attached. Then I unplugged the AC, left it for 10 seconds, and then plugged the AC back in and left it for 10 seconds before typing into the dom0 terminal journalctl -b -g xenpm -n 10 and this is what I got


[user@dom0 Desktop]$ sudo udevadm control --log-level="debug"
[user@dom0 Desktop]$ journalctl -b -g xenpm -n 10
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Process>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Startin>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Running>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Process>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Startin>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Running>
May 25 16:39:10 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: /etc/ud>
May 25 16:39:10 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: /etc/ud>
May 25 16:39:10 dom0 (udev-worker)[18628]: port1-partner: Process '/usr/sbin/xe>
May 25 16:39:10 dom0 (udev-worker)[18628]: port1-partner: Starting '/usr/sbin/x>
lines 1-10/10 (END)...skipping...
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Process '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:9 energy-perf:255' succeeded.
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Starting '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:9 energy-perf:255'
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Running command "/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:9 energy-perf:255"
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Process '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:255 energy-perf:64' succeeded.
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Starting '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:255 energy-perf:64'
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Running command "/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:255 energy-perf:64"
May 25 16:39:10 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: /etc/udev/rules.d/90-on-battery.rules:4 RUN '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:9 energy-perf:255'
May 25 16:39:10 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: /etc/udev/rules.d/90-on-ac.rules:4 RUN '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:255 energy-perf:64'
May 25 16:39:10 dom0 (udev-worker)[18628]: port1-partner: Process '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:9 energy-perf:255' succeeded.
May 25 16:39:10 dom0 (udev-worker)[18628]: port1-partner: Starting '/usr/sbin/xenpm set-cpufreq-hwp minimum:1 maximum:9 energy-perf:255'
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-10/10 (END)
























May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Process>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Startin>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Running>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Process>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Startin>
May 25 16:39:11 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: Running>
May 25 16:39:10 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: /etc/ud>
May 25 16:39:10 dom0 (udev-worker)[18628]: ucsi-source-psy-USBC000:002: /etc/ud>
May 25 16:39:10 dom0 (udev-worker)[18628]: port1-partner: Process '/usr/sbin/xe>
May 25 16:39:10 dom0 (udev-worker)[18628]: port1-partner: Starting '/usr/sbin/x>
~
~
~
~
~
~
~
~
~
~
~
~
~
lines 1-10/10 (END)

When the AC is removed, why is udev showing
POWER_SUPPLY_TYPE=Mains
shouldn’t it show Battery instead of Mains?

UDEV in SUBSYTEM=power_supply shows various event, even usbc connect and disconnect.

So maybe it would be better if 90-on-battery.rules would monitor AC Mains not battery charged.
Your syslog shows that after successful setting parameters for AC it sets parameters for Battery at the end.

Another thing - with my test’s and some article on APM/ACPI it’s not too good to force CPU to low frequency because when it can’t bump frequency to do the job it stays longer in high power state and consume more energy.
Also forcing cpu to more higher power state with U intel cpu’s force TDP throttle too.
So, it’s best to do max frequency with balanced mode and for battery limit frequency to base frequency (2500MHz) and do little bit low power states bump:

So those are new best UDEV rules to use
/etc/udev/rules.d/90-on-ac.rules

SUBSYSTEM=="power_supply", \
   ENV{POWER_SUPPLY_TYPE}=="Mains", \
   ENV{POWER_SUPPLY_ONLINE}=="1", \
   RUN+="/usr/sbin/xenpm set-cpufreq-hwp min:1 max:255 energy-perf:128"

/etc/udev/rules.d/90-on-battery.rules

SUBSYSTEM=="power_supply", \
   ENV{POWER_SUPPLY_TYPE}=="Mains", \
   ENV{POWER_SUPPLY_ONLINE}=="0", \
   RUN+="/usr/sbin/xenpm set-cpufreq-hwp min:1 max:25 energy-perf:160"
2 Likes

One more thing - disabling turbo won’t do any good. CPU stays at 1000MHz and C0 power state (highest) all the time (even on AC) and is as slow as hell.
You can disable turbo with command:

xenpm disable-turbo-mode

to enable turbo

xenpm enable-turbo-mode
2 Likes

Ok I have just done those changes to the config files and will get back to you with results after trying it for a bit.

Just one question > what do the numbers 1 or 0 mean on the
ENV{POWER_SUPPLY_ONLINE}=="0", \

And again thank you so much

Rebooted and everything seems good so far. No graphical glitches. No instability issues that I have experienced so far. Performance seems great. And sudo sensors is showing around 7.5W on battery!

I will carry on using it for the next few hours and get back to you!

ENV{POWER_SUPPLY_ONLINE}=="0" is a environment flag to check. And it have numeric/binary value. 0 is false, 1 is true.
So with 0 it’s like check is this power supply offline?

PS: for me it’s 11-12W idle and 16-18W watching YouTube 720p in window (I have like 13 VM’s running).

1 Like

Several days in now and everything is working great. Been perfectly stable with great performance. And have managed to get an extra 2 hours of battery life!
Thank you again Kitsune

Ok.
Nice