Howto: double battery runtime on newer systems

Comments

10 comments

  • Forrest Smith

    Thanks for the tip! This is great!

     

    0
    Comment actions Permalink
  • Tom Miller

    Mario,

    I wanted to confirm that under load the CPU speeds back up to "full tilt"? 

    This is exactly what we have been looking for!  As a less than guru linux guy could you setup a "step by step" script?  eg.  what exactly is "mounting a partition etc" mean from a keystroke point of view inside of the CloudReady command line. 

    My notebook, laptop and a couple of other machines thank you!

    Tom

    0
    Comment actions Permalink
  • Mario Wolff

    Hey Tom,

    without pstate the system falls back to ondemand governor and that adjusts the speed in the limits scaling_max_freq and scaling_min_freq.

    To do those tasks you need some knowledge and experience with this environment. Maybe it would be better to buy support from from Neverware. This guys did a great job and by giving an unsupported version for free they support the open source spirit very well. In my opinion everybody should "pay" for open source - either with time one spend to fix problems, writing documentation and so on, or at least with money.

    Don't get me wrong! But it's hard to create a fail save script for inexperienced users. You modify the parameter-set of your kernel and a typo may leaf you with unusable system! First part is to get the right partition. There are some posts taking about partition 12, mine is 27, could be the case, because i'm using multiboot - not sure myself!

    Regards,

    Mario 

    0
    Comment actions Permalink
  • Jeff

    Tom,

    Here's how I did it. Like Mario said, you could break your system, but you're an adult--you can judge whether it's worth the risk.

    1. Get into your preferred shell.
    2. sudo su
    3. password: chrome
    4. fdisk -l to find the EFI partition. It was /dev/sda27 on mine.
    5. mkdir /tmp/t
    6. mount /dev/sda27 /tmp/t
    7. vi /tmp/t/efi/boot/grub.cfg (You might want to read a beginner's guide to Vi - it's kind of a pain for a text editor)
    8. Add intel_pstate=disable to the end of the red lines in grub.
    9. Save it (:wq) and reboot.

    It did amazing things for my 2013 MacBook Pro.

    2
    Comment actions Permalink
  • Tom Miller

    Jeff, 

    Your right.  That is the level of detail I needed.  

    I'm not dual-booting so I am wondering if I still use the EFI partition?  Forrest?

    I just got done struggling with "nano" so I will see if it is available.  If it isn't I will stop dodging vi and bite the bullet and learn enough to solve this.

    I am playing with CloudReady on an HP 3105m and I would like to see if I can boost the already respectable 4 hours of battery a little higher.

    Maybe this will also let me reset the touchpad which is a synaptic one so it is very touchy.  Forrest proposed a way to fix that which works but I haven't figured out how to make the "change" permanent.

    Tom

    0
    Comment actions Permalink
  • oluwatosin osinubi

    Does this still apply when running this from the USB Live image?  Attempted the listed commands in crosh and means like none of the commands are available.

    crosh> sudo
    ERROR: unknown command: sudo

    crosh> fdisk -l
    ERROR: unknown command: fdisk
    0
    Comment actions Permalink
  • Jeff

    From crosh, you must type "shell" and enter to get a real shell prompt.

    1
    Comment actions Permalink
  • James Schroders

    My early 2015 laptop has a 1GHz Celeron 1019Y processor and 2GB RAM and 3-cell battery. It usually gives me about a little over 4 hours of usage time when I use it with Windows 8.1, which is what the processor is optimized for, although I never record the usage time in detail.

    Although I expected a longer usage time with Cloud Ready, the usage time is also around 4 hours, which is disappointing for me, because it should be lighter on the resources than Windows, right? Again, I never record the usage time in detail.

    I'm intrigued by the setting mentioned above. Is disabling the intel_pstate driver really improve the battery drain and increase the usage time for newer systems? So, I set out to conducting a little experiment. I ran the laptop twice. First with intel_pstate enabled, and the second with it disabled.

    The procedure was to ensure the conditions as similar as possible: the laptop was fully charged when it's off, unplug from the mains, boot it up, make sure it's connected to the same wifi, set the brightness halfway the slider, open seven Chrome tabs (one of them is the shell, the others are the same on both test, and none play video or sound), then use the laptop on battery until it reached 50% (when I usually began to charge the battery). After making note of the time, I change grub setting according to the instruction above, then turn off the laptop.

    For the second run, I simply repeat the procedure above.

    During both run, I checked the cpu frequency every 10 minutes.

    These are the specification of the cpu:

         - cpuinfo_min_freq: 800000 (800MHz?)
         - cpuinfo_max_freq: 1000000 (1GHz?)
         - scaling_min_freq: 800000
         - scaling_max_freq: 1000000

    Now, the result of the experiment.

    When intel_pstate enabled, the scaling_governor was powersave. The cpuinfo_cur_freq and scaling_cur_freq both are between 800000 - 1000000, mostly keeping around 900000 when I actively use the laptop, and around 800000 when idle. I got 1 hour and 51 minutes running time from fully charged to 50%. One note: the fan came on high and the frequencies went to 1000000 for the last 45 minutes, and stayed there.

    When intel_pstate disabled, the scaling_governor was ondemand. Both current frequency never went below 100000. The fan started as soon as Cloud Ready start, although it slowed down after about 30 minutes. Running time was 1 hour and 50 minutes

    So, there is practically no difference in enabling or disabling intel_pstate on my laptop. I read here (http://www.newnix.space/blog/2015/7/23/dealing-with-power-drain-on-gnulinux-for-intel-based-machines) that the issue with intel_pstate has been resolved as of kernel 4.5 (I don't know the kernel version of Cloud Ready). Another point is that Celeron 1019Y is an Ivy Bridge processor, instead of Haswell or Broadwell, so I don't know if this qualifies as "newer processor".

    All things considered, I restore the setting to the original one, since it at least enable the laptop to run quietly (without fan) for a while.

    0
    Comment actions Permalink
  • Forrest Smith

    Thanks for the deep info James!

     

    We're not as far as kernel v4.5 yet, but will be moving forward in the future - stay tuned for improvements!

    0
    Comment actions Permalink
  • Justin Lamp

    Alternatively, if you want to keep the intel_pstate driver, you can add that to the rc.local:

    change .../cpuX/... to how many cpu threads your devices has, for eg if you happend to have 6 threads add two more lines. One with cpu4 and another with cpu5, as it starts with cpu0 ;)

    To find out how many cores your devices has, just run :

    cat /proc/cpuinfo | grep "siblings"
    sudo mount -o remount,rw /
    sudo vim /etc/rc.local
    -------------------------------------------------------------------------------
    ...
    # Uncomment the following mount commands and put any commands that modify the # root filesystem between them # mount -o remount,rw / # mount -o remount,ro / echo power > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference echo power > /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference echo power > /sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference echo power > /sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor echo powersave > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor echo powersave > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor exit

     (to add lines in vim press i and then paste these lines into the file. To save press ESC to go out of insert mode and then press : and type wq and confirm with enter!

     

    That will increase the battery life a lot! If you have some experience with linux you can also use powertop to tune other variables! Just boot into any distribution and install powertop (bspw. sudo apt install powertop). Then run:

    powertop --html=powerreport.html && awk -F '</?td ?>' '/tune/ { print $4 }' powerreport.html

     

    That command should then output all relevant tunables into your command line! Those can then be used within CloudReady! Just put those in a txt file on an etx4 formatted USB for it to be easily accessible in CloudReady

     

    cat /media/removable/(THE NAME OF YOUR USB)/(NAME OF POWERTOP-OUTPUT).txt

    cat /media/removable/USB/powertop.txt //Sth like that

    Those commands can than also be inserted into the rc.local! In the end it should look similar to mine:

     

    #!/bin/bash
    # rc.local
    #
    # This is a bash script that runs at boot and persists between updates. You can
    # edit it below to add your own commands.
    #
    # If your code is overly complex or uses a different language (eg Python,) you
    # may consider putting it in /mnt/stateful_partition/ as a separate script and
    # calling it from here.
    #
    # Please only remount the root filesystem read/write if it's required for what
    # you are doing.
    #
    # Use the $log command shortcut to add logging. Your messages will show up in
    # /var/log/messages under the rc.local service name.
    
    log='/usr/bin/logger -t rc.local'
    $log "Entering rc.local"
    
    # Uncomment the following mount commands and put any commands that modify the
    # root filesystem between them
    # mount -o remount,rw /
    # mount -o remount,ro /
    
    echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs'; 
    echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy'; 
    echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy'; 
    echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy'; 
    echo '0' > '/proc/sys/kernel/nmi_watchdog'; 
    echo 'auto' > '/sys/bus/i2c/devices/i2c-0/device/power/control'; 
    echo 'auto' > '/sys/bus/i2c/devices/i2c-1/device/power/control'; 
    echo 'auto' > '/sys/bus/usb/devices/1-10/power/control'; 
    echo 'auto' > '/sys/bus/i2c/devices/i2c-2/device/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:17.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:02:00.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:04.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:14.2/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.6/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.4/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:14.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control'; 
    echo 'auto' > '/sys/bus/pci/devices/0000:00:16.3/power/control'; 
    
    echo power > /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference
    echo power > /sys/devices/system/cpu/cpu1/cpufreq/energy_performance_preference
    echo power > /sys/devices/system/cpu/cpu2/cpufreq/energy_performance_preference
    echo power > /sys/devices/system/cpu/cpu3/cpufreq/energy_performance_preference
    
    echo powersave > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    echo powersave > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
    echo powersave > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
    echo powersave > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
    
    exit

     

    0
    Comment actions Permalink

Please sign in to leave a comment.