Comment 46 for bug 1973434

Revision history for this message
Benico van der Westhuizen (benicovdw) wrote (last edit ):

Dell Latitude E6540 (2014) ... Intel i7-4600M
Problem seems related to new after market battery, load shedding when the power comes on and off (also when I start the generator, etc.) The state of tlp changes from AC to battery and it also affects the governor. It seems that all the detail for the battery is not properly detected when the battery is 100% charged (tlp-stat -b shows the capacity as not available ... but when it is at less than 100% it displays it correctly.)

I tried to disable the Intel "C States" in the BIOS as well as /etc/default/grub: GRUB_CMDLINE_LINUX_DEFAULT="intel_idle.max_cstate=0"
but the fix did not last.

I watch Frequencies with: watch -n 0.3 "cat /proc/cpuinfo | grep MHz"
fwiiw
I also apt purged: linux-tools-* cpufreq* gamemode*

So what does currently work is (when the battery is not at 100%) then I use the underneath script to play around and that seems to fix the cpu scaling (on kernel 6.2)

Faster way to try and tune stuff:
su -
./manage_governor.sh
#================================================================================
#!/bin/bash

reserv () {
 systemctl restart acpid.service ;
 systemctl restart lm-sensors.service ;
 systemctl restart machine.slice ;
 systemctl restart power-profiles-daemon.service ;
 systemctl restart gpu-manager.service ;
 systemctl restart powertop.service ;
 systemctl restart thermald.service ;
 systemctl restart tuned.service ;
 systemctl restart tlp.service ;
 upower -d ;
 tlp recalibrate ;
 tlp-stat -b ;
}

GOV=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` ;

govdrv () {
 echo "current driver: ";
 grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver ;
 }

govtuning () {
 echo "current tuning parameters of $GOV governor:
grep . /sys/devices/system/cpu/cpufreq/$GOV/* " ;
 grep . /sys/devices/system/cpu/cpufreq/$GOV/* ;
 }

getgov () {
 echo "current governor: ";
 grep . /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ;
 echo "available governors: " ;
 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ;
 }

setgov () {
 getgov ;
 read -p " watter governor wil jy apply ? ... " GOV ;
 echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ;
 echo $GOV > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor ;
 echo $GOV > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor ;
 echo $GOV > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor ;
 getgov ;
 }

watchfreq () {
 watch -n 0.3 "cat /proc/cpuinfo |grep MHz" ;
 }

tunegov () {
 echo "=====================================================" ;
 grep . /sys/devices/system/cpu/cpufreq/conservative/up_threshold ;
 echo "setting conservative governor up_threshold to 40%: " ;
 echo -n 40 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold ;
 grep . /sys/devices/system/cpu/cpufreq/conservative/up_threshold ;

 echo "=====================================================" ;
 grep . /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor ;
 echo "setting sampling_down_factor to 2: " ;
 echo -n 2 > /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor ;
 grep . /sys/devices/system/cpu/cpufreq/conservative/sampling_down_factor ;
 echo "=====================================================" ;sleep 1 ;
 }

echo "
============== also see =============
   man tlp ... tlp-stat -h
   /usr/lib/udev/rules.d/85-tlp.rules
   dmidecode ... lscpu ... hwinfo" ;

while true
 do
  echo -n "
========================================================================
[rs] restart-services [wf] watchfreq [gd] govdrv
[gg] getgov [sg] setgov [gt] govtuning [tg] tunegov
[ts] tlp? [tb] tlpbat [pd] powr? [q] quit ? " ;
  read keuse ;
  case $keuse in
   rs) reserv ;;
   gg) getgov ;;
   sg) setgov ;;
   gd) govdrv ;;
   gt) govtuning ;;
   tg) tunegov ;;
   wf) watchfreq ;;
   ts) tlp-stat -s ;;
   tb) tlp-stat -b ;;
   pd) upower -d | less ;;
   q) exit ;;
  esac
 done

#================================================================================