Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Laptop Battery Issue
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Fri Apr 13, 2012 11:34 pm    Post subject: Laptop Battery Issue Reply with quote

Brand new Asus UX31 (core i5, ssd, 4 gigs ram) with a fresh gentoo install. Asus advertises a 6+ hour battery life, however, I only get about 2 hours.
I have installed laptop_mode_tools and started it. cat /proc/sys/vm/laptop_mode returns 5 when it is on battery power, so it is working.

kernel 3.2.1-gentoo-r2

Code:
Power Management and ACPI Options
  [*] Suspend to RAM and standby
  [*] Run-Time PM core functionality
  [ ] Power Management Debug Support
  [*] ACPI Support -->
    [*] Deprecated /proc/acpi files
    [*] Deprecated power /proc/acpi directories
    <> EC read/write access through /sys/kernel/debug/ec
    [*] Deprecated /proc/acpi/event Support
    <*> AC Adapter
    <*> Battery
    -*- Button
    -*- Video
    <> Fan
    [*] Dock
    <*> Processor
    <*> Processor Aggregator
    <*> Thermal Zone
    [ ] Debug Statements
    <> PCI slot detection error
    [*] Power Management Timer Support
    <*> Smart Battery System
    <> Hardware Error Device
    <> Allow ACPI methods to be inserted/replaced at run time
    [] ACPI Platform Error Interface

  [ ] SFI Support -->

  [*] CPU Frequency scaling --->
     [*] CPU Frequency scaling
     <> CPU frequency translation statistics
           Default CPUFreq governor (userspace) -->
      <*>   'performance' governor
      <*>   'powersave' governor
       _*_   'userspace' governor
      <*>   'ondemand' governor
      <*>   'conservative' governor
           
                x86 CPU frequency scaling drivers -->
                     <> Processor Clocking Control interface driver
                     <*> ACPI Processor P-States driver
                     < > AMD Opteron/Athlon64 PowerNow! 
                     < > Intel Enhanced SpeedStep (deprecated)
                     < > Intel Pentium 4 clock modulation
      _*_ CPU idle PM support
      [*] Cpuidle Driver for Intel Processors
            Memory power savings
                      <*> Intel chpiset idle memory power savings driver





On an unrelated note the laptop also does not resume from 'sleep'. it only shows a black screen with a single, solid, underscore in the top left of the screen.
Back to top
View user's profile Send private message
CrankyPenguin
Apprentice
Apprentice


Joined: 19 Jun 2003
Posts: 235

PostPosted: Sat Apr 14, 2012 12:48 am    Post subject: Reply with quote

As a first point I see you have "userspace" set as your frequency default. Do you have an appropriate governor running in userspace? If not then support or no support your system may just be running at full power. I don't think that the laptop-mode-tools handles userspace frequency scaling out of the box.

As a second point is hdparm setup properly for your system?

Keep in mind that the 6+ advertisement is based upon the assumption that you will do absolutely nothing with it other than turn it on, let the screen go dim and never, ever, ever, open a file :)
_________________
Linux, the OS for the obsessive-compulsive speed freak in all of us.
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 1:18 am    Post subject: Reply with quote

changed my frequency default to conservative. recompiled, restarted, clicked on the battery icon, and i'm just watching it without moving the mouse, with the screen at the dimmest possible setting. the kde battery monitor is estimating about 3 hours 10 minutes. while that is a full hour better than before, it is still only 50% what is advertised.

forgive my ignorance, this is my first linux laptop, but i've never heard of hdparm before. i'll start googling it right now but would welcome any info/advice about it that you guys may have.
i also don't even know what having an appropriate governor in userspace means... i'll look that up too.
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sat Apr 14, 2012 5:06 am    Post subject: Reply with quote

http://forums.gentoo.org/viewtopic-t-920122.html

Same problem. Do you have an hybrid graphics system? If so, maybe it's what I'm thinking and the dedicated video card is draining your battery, as mine.
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 4:06 pm    Post subject: Reply with quote

candamil wrote:
http://forums.gentoo.org/viewtopic-t-920122.html

Same problem. Do you have an hybrid graphics system? If so, maybe it's what I'm thinking and the dedicated video card is draining your battery, as mine.


i don't have a hybrid graphics system, i have "intel hd graphics 3000" according to the ux31 spec sheet. this is very frustrating, how is windows so much more effecient in regard to battery consumption?
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sat Apr 14, 2012 4:09 pm    Post subject: Reply with quote

It's the same integrated graphics card as in mine. Maybe there is a power saving issue with this card in Linux...
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 4:17 pm    Post subject: Reply with quote

that is very possible... if you figure this out please let me know. i just bought this laptop for school and 2 hour battery life (while being used) is not going to get me through my night classes
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sat Apr 14, 2012 4:19 pm    Post subject: Reply with quote

I was using powertop yesterday and the Intel module was one of the most actives.
If I find anything else I'll let you know.
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 4:30 pm    Post subject: Reply with quote

I just found http://www.phoronix.com/scan.php?page=article&item=intel_i915_power&num=2, i'll let you know how the settings work
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 4:40 pm    Post subject: Reply with quote

definitely add those settings to your grub.conf. mine now looks like:
Code:

default 0
timeout 3
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title Gentoo Linux 3.2.1-r2 Small
root (hd0,0)
kernel /boot/kernel-3.2.1-r2-small root=/dev/sda2 i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1


when i let my system idle the kde battery monitor estimated 5+ hours of battery life. now that i'm using the browser it currently estiamtes 4 hours 22 minutes (and it's only at 91% charged).

still might not be as good as windows but it's much, much closer now


Last edited by xtx on Sat Apr 14, 2012 4:43 pm; edited 1 time in total
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sat Apr 14, 2012 4:43 pm    Post subject: Reply with quote

Ok, I'll give it a try. If it works, I'll try to do a script to change it without reboot (I'm not sure if we can reload the Intel module without hanging the whole system)
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 7:09 pm    Post subject: Reply with quote

how necessary is laptop_mode_tools? what does it do differently than kde's default power save features? i only ask because it slows down my boot process
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sat Apr 14, 2012 8:10 pm    Post subject: Reply with quote

I have used your options to boot and, yes, there is an important increase in the battery life (about 4:30).
I used it and also this script I made:
Code:

#!/bin/bash

mount -o remount,relatime /
hdparm -B 1 -S 12 /dev/sda
echo 5 > /proc/sys/vm/laptop_mode
echo 40 > /proc/sys/vm/dirty_ratio
echo 10 > /proc/sys/vm/dirty_background_ratio
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo powersave > /sys/module/pcie_aspm/parameters/policy
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
/etc/init.d/mysql stop
/etc/init.d/ntpd stop
/etc/init.d/NetworkManager stop
/etc/init.d/cupsd stop
killall akonadiserver
killall akonadi_control
killall wpa_supplicant


but I was not using laptop_mode_tools. Now it's a little late here, tomorrow I'll try with it, and we'll see if the improvement is big or not. In windows it lasted 5:36, so there should be more things to do.
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Sat Apr 14, 2012 8:34 pm    Post subject: Reply with quote

good to hear the improved battery life. another boot option that the article mentions is "pcie_aspm=force" if you want to give that a try
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sun Apr 15, 2012 9:34 am    Post subject: Reply with quote

News with my tests. I tried with all of that booting parameters (even the pcie_aspm), with laptop_mode (it just changes some parameters of some files, just as my script does, but is useful anyway), and without using my script. I didn't use the prediction of the energy manager, because it is quite wrong. I just did some maths, and my prediction after 30% of the battery is that it would last between 3:55 and 3:58. It's an hour more than before, but it's still 1:30 less than in windows, so I think there is still a lot of work here. And the fan didn't turn on in the whole test, a good new.
I'll try all the parameters in my script, one by one, because I'm not sure that all of them really help to increase the battery life. Then, I'll put here the results, after each test.
I'll also try removing the widgets in my desktop. I had a couple of temperature and CPU load meters, and maybe they are using more energy than I think.

So, let's begin with this.

PARAMETERS:
- WiFi OFF (hardware)
- Screen brightness: minimum
- Screen off time: none
- Graphic effects OFF
- Sound UNmuted
- Opened programs: acroread
- External hardware: none
- Optimus server started
- Laptop mode server started
- Boot parameters: <deleted for powersaving issue> i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1
- CPU mode: conservative
- ACPI server started

Test 1:
- With widgets
- Without any other configuration
TIME: 3:55 - 3:58

Test 2:
- Same configuration
- Without widgets
TIME: 4:06 - 4:09

Test 3:
- Same configuration
- Without the pcie_aspm=force parameter
TIME: 4:13 - 4:15

Test 4:
- Same configuration
- Added script parameters:
Code:

#Discrete video card
/etc/init.d/optimus stop
rmmod nvidia
insmod /home/candamil/programas/acpi_call/acpi_call.ko
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call

#Miscellaneous
echo 90 > /proc/sys/vm/dirty_ratio
echo 1 > /proc/sys/vm/dirty_background_ratio
echo 6000 > /proc/sys/vm/dirty_writeback_centisecs
echo 9 > /proc/sys/vm/swappiness

#Services
/etc/init.d/mysql stop
/etc/init.d/ntpd stop
/etc/init.d/NetworkManager stop
/etc/init.d/cupsd stop

#Processes
killall akonadiserver
killall akonadi_control
killall wpa_supplicant
killall java

TIME: 6:45 - 6:48 <<<< CRAZY!


--------------------------------------------------------------------------
TESTS WITH LOAD
Script:
Code:

#!/bin/bash

while true
do
        emacs &
        xterm &

        let j=3
        for i in {1..200000}
        do
                let j=j**5
                echo $j
        done
        sleep 30

        ffmpeg -i /home/candamil/test/video-test.avi -acodec libmp3lame -b:a 128k -vcodec libxvid -b:v 600k -aspect 16:9 /home/candam
il/test/deleteme.avi
        sleep 30
        rm /home/candamil/test/deleteme.avi

        wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.3.2.tar.bz2 -O /home/candamil/test/deleteme.dl
        sleep 30
        rm /home/candamil/test/deleteme.dl

        glxgears &
        sleep 30

        killall glxgears
        killall xterm
        killall emacs

        sleep 30
done


PARAMETERS:
- WiFi ON
- Screen brightness: minimum
- Screen off time: none
- Graphic effects OFF
- Sound UNmuted
- External hardware: none
- Laptop mode server started
- Boot parameters: i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1
- CPU mode: conservative
- ACPI server started
- irqbalance server started (added after test 2)

Initial parameters script:
Code:

#!/bin/bash

#Discrete video card
/etc/init.d/optimus stop
rmmod nvidia
insmod /home/candamil/programas/acpi_call/acpi_call.ko
echo '\_SB.PCI0.PEG0.PEGP._OFF' > /proc/acpi/call

#Miscellaneous
echo 90 > /proc/sys/vm/dirty_ratio
echo 1 > /proc/sys/vm/dirty_background_ratio
echo 6000 > /proc/sys/vm/dirty_writeback_centisecs
echo 9 > /proc/sys/vm/swappiness

#Services
/etc/init.d/mysql stop
/etc/init.d/ntpd stop
/etc/init.d/cupsd stop

#Processes
killall akonadiserver
killall akonadi_control
killall java


Test 1:
- irqbalance OFF
TIME: 3:13 - 3:18

Test 2:
- irqbalance ON
TIME: 3:53 - 3:58

Test 3:
Added
Code:

#WiFi
iwconfig wlan0 power on
ethtool -s wlan0 wol d
 
#Wired LAN
ethtool -s eth0 wol d
ethtool -s eth0 autoneg off speed 100

TIME: 3:38 - 3:44

Test 4:
Added
Code:

#Hard drive
mount -o remount,relatime /

TIME: 3:55 - 3:58

Test 5:
Added
Code:

#Hard drive
hdparm -B 1 -S 6 /dev/sda

TIME: 3:53 - 3:58

Test 6:
Added
Code:

#Hard drive
for dev in /dev/sd[a-z]; do blockdev --setra 3072 $dev; done

TIME: 3:55 - 4:00

Test 7:
Added
Code:

#Sound
echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller

TIME: 3:55 - 3:58

Test 8:
Added
Code:

#Miscellaneous
echo noop > /sys/block/sdb/queue/scheduler
for i in $(ls /sys/bus/{pci,i2c}/devices/*/power/control);do echo auto > $i;done
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
for i in /sys/bus/usb/devices/*/power/control; do echo auto > $i; done

TIME: 3:55 - 4:00

Test 9:
Added
Code:

#Processor
echo conservative | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
echo 1 > /sys/devices/system/cpu/cpufreq/conservative/ignore_nice_load
echo -n 40 > /sys/devices/system/cpu/cpufreq/conservative/down_threshold
echo -n 90 > /sys/devices/system/cpu/cpufreq/conservative/up_threshold

TIME: 4:00 - 4:01

Test 10
Added
Code:

#Power managers
for i in /sys/class/scsi_host/host*/link_power_management_policy; do echo min_power > $i; done
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
echo 1 > /sys/devices/system/cpu/sched_smt_power_savings
echo 1 > /sys/module/snd_hda_intel/parameters/power_save

TIME: 3:55 - 3:57

Test 11
Added apparently irrelevant code, all together.
Code:

#Hard drive
for dev in /dev/sd[a-z]; do blockdev --setra 3072 $dev; done

#Miscellaneous
echo noop > /sys/block/sdb/queue/scheduler
for i in $(ls /sys/bus/{pci,i2c}/devices/*/power/control);do echo auto > $i;done
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
for i in /sys/bus/usb/devices/*/power/control; do echo auto > $i; done

TIME: 3:50 - 3:53


Last edited by candamil on Mon Apr 23, 2012 6:48 am; edited 22 times in total
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sun Apr 15, 2012 11:35 am    Post subject: Reply with quote

Another hint that maybe is useful: in powertop, the first activation reason is [Rescheduling interrupts] <kernel IPI>
Maybe this is also an important problem... In my case, it's about 150 when idle, and about 400-500 when surfing with chrome.
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sun Apr 15, 2012 2:41 pm    Post subject: Reply with quote

Added new test. As soon as my battery is fully loaded, I'll try without the pcie_aspm parameter, as I have read that it could drain more battery.
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Sun Apr 15, 2012 8:57 pm    Post subject: Reply with quote

Added new test without the pcie_aspm=force parameter.
Tomorrow I'll start with script parameters.
Back to top
View user's profile Send private message
hephooey
n00b
n00b


Joined: 24 Feb 2003
Posts: 51

PostPosted: Sun Apr 15, 2012 10:56 pm    Post subject: Reply with quote

candamil wrote:
Added new test without the pcie_aspm=force parameter.
Tomorrow I'll start with script parameters.

Try to upgrade your kernel as well, the infamous aspm bug is fixed in 3.2.5, 3.2.1 still have the bug (unless gentoo patched it) and pcie_aspm=force will not help , should be able to save a few watt.
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Mon Apr 16, 2012 5:28 am    Post subject: Reply with quote

In fact I am using 3.2.12-gentoo, but as you can see, there is no big difference adding or removing that parameter.
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Mon Apr 16, 2012 4:36 pm    Post subject: Reply with quote

Added test with massive improvement for nvidia discrete card users.
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Mon Apr 16, 2012 7:00 pm    Post subject: Reply with quote

Solid! Quick question for anybody that reads this, I noticed today (for the first time) that when my laptop was plugged in and then I removed the power, the laptop would immediately shut off. This never happened before but it happened 3 times in a row. I can boot up without power and the battery works fine then...

Anyway, your tests made me want to do some of my own tests, so here it goes:

PARAMETERS:
- WiFi ON (ath9k driver Atheros AR9485WB-EG)
- Screen brightness: minimum
- Screen off time: none
- Graphic effects ON
- Sound UNmuted
- Opened programs: none
- External hardware: none
- Boot parameters: i915.i915_enable_rc6=1 i915.i915_enable_fbc=1 i915.lvds_downclock=1
- CPU mode: conservative
- With desktop widgets

Test 1:
- Boot option pcie_aspm=force
- Laptop mode server started
TIME: ~6 hours 35 minutes

I will do two more tests, one without laptop mode started, and another without pcie_aspm=force


Last edited by xtx on Mon Apr 16, 2012 8:41 pm; edited 5 times in total
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Mon Apr 16, 2012 7:07 pm    Post subject: Reply with quote

what I do to measure the time is wait until the battery is full, then unplug and then each 5% calculate the time until 4% with the minutes that passed.
For example, start time 10:00, 95% at 10:13, 2.6 minutes per %, 249 minutes until 4%, 4:09.
I finish each test when the prediction stabilizes, normally at about 60-50% remaining.
Back to top
View user's profile Send private message
candamil
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2012
Posts: 84

PostPosted: Mon Apr 16, 2012 7:30 pm    Post subject: Reply with quote

I tried to boot without any parameter extra an then load the parameters of i915, but it doesn't work as well as when you boot directly with them. Discarded.
Back to top
View user's profile Send private message
xtx
Tux's lil' helper
Tux's lil' helper


Joined: 27 Dec 2011
Posts: 110

PostPosted: Mon Apr 16, 2012 7:30 pm    Post subject: Reply with quote

Ok I will start paying attention to that now as well.

Any clue why my laptop is crashing when I unplug it from power?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum