Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 12 Feb 2015 20:39:14 +1100 (EST)
From:      Ian Smith <smithi@nimnet.asn.au>
To:        george ember <sk8harddiefast@gmail.com>
Cc:        freebsd-acpi@freebsd.org
Subject:   Re: Laptop Battery drains insanely Fast!
Message-ID:  <20150212192344.P38620@sola.nimnet.asn.au>
In-Reply-To: <CAJ7d6nfh7DrUbFXoEV%2BzRObkEQn0dhuj8EQ8CfJtoKEfrZH=wg@mail.gmail.com>
References:  <CAJ7d6nfh7DrUbFXoEV%2BzRObkEQn0dhuj8EQ8CfJtoKEfrZH=wg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 11 Feb 2015 18:38:45 +0200, george ember wrote:

 > Hi. I have a lenovo Ideapad p400 touchscreen.
 > My problem is the battery.
 > Drains too fast. In idle ~1% per minute!!!
 > I tried almost everything but my battery still loses power extremely fast!
 > This is my post on FreeBSD forum
 > https://forums.freebsd.org/threads/laptop-battery-drains-extremly-fast.50344/
 > I don't like Linux. I am FreeBSD user almost 5 years. I don't want to
 > install again Linux on laptop.
 > I just want to make it work smooth with FreeBSD.
 > Any help could be appreciated.
 > George (sk8harddiefast on forum)

George, I read the forum post, but prefer to reply here, though I'll 
quote from bits there. There are a number of issues with your setup:

1) powerd:

 > powerd_enable="YES"
 > powerd_flags="-a maximum -b adaptive -i 85 -r 60 -p 100"

You shouldn't have -i (idle%) higher than -r (run%).  The defaults are 
-i 50 -r 75 and I suggest you start with those.  I use -i 70 -r 85 here 
on my X200 (Core2Duo 2.4GHz).  And -p 100 is polling faster than you 
need, increasing powerd's load somewhat.  The default of -p 250 is fine.

-a max is unnecessary.  -a hadp will work fine, especially as you've 
correctly disabled p4tcc and acpi_throttle in loader.conf, when you're 
doing things - but allow it to idle at a lower freq, which will reduce 
heat buildup on AC and perhaps fan usage on battery, at least initially.

2) C-states:

You have (misadvisedly) in /etc/sysctl.conf
 > dev.cpu.0.cx_lowest=C5
 > dev.cpu.1.cx_lowest=C2
 > dev.cpu.2.cx_lowest=C5
 > dev.cpu.3.cx_lowest=C5
 > dev.cpu.4.cx_lowest=C5
 > dev.cpu.5.cx_lowest=C5
 > dev.cpu.6.cx_lowest=C5
 > dev.cpu.7.cx_lowest=C5

Apart from the oddity of C2 on cpu1, setting these is NOT the way to do 
this, you have to set hw.acpi.cpu.cx_lowest instead, then cpufreq(4) 
uses that to set the individual cx_lowest per CPU (and all to the same 
state) which is usually and best accomplished by setting the below in 
rc.conf, as stated in https://wiki.freebsd.org/TuningPowerConsumption :

 performance_cx_lowest="Cmax"
 economy_cx_lowest="Cmax"

I expect Adrian will say more, but it looks to me that you're always
running in C1 state by your report at http://pastebin.com/GUJQqtX6
which is consistent with use of the defaults for *_cx_lowest as applied 
in /etc/defaults/rc.conf of:
 performance_cx_lowest="HIGH"    # Online CPU idle state
 economy_cx_lowest="HIGH"        # Offline CPU idle state

If you examine /etc/rc.d/power_profile you will see how these are used, 
along with the defaults of {performance,economy}_cpu_freq="NONE" which 
you should leave as is, to avoid conflicting with powerd when you apply 
or remove AC power.

Running in C1 all the time, it's no surprise your battery not lasting.

3) I didn't see mention in dmesg of loading acpi_ibm in loader.conf, 
which may help at least provide details for the script below, if it 
doesn't improve your access to Lenovo special Fn keys etc:
 
 acpi_ibm_load="YES"	# or just '# kldload acpi_ibm' while running

4) please show output of
 sysctl -a | egrep 'cx|freq_'

5) try putting this script, suitably renamed, somewhere in $PATH.  It 
doesn't needroot access to run, I also have it (as a link) in ~/bin/

root@x200:~ # cat /root/bin/x200stat
#!/bin/sh
t="	"	# a tab
echo -n "`date` "
sysctl dev.cpu.0.freq
echo "`sysctl -n dev.cpu.0.cx_usage` $t `sysctl -n vm.loadavg`"
echo "`sysctl -n dev.cpu.1.cx_usage` $t { `sysctl -n kern.eventtimer.timer` }"
sysctl dev.acpi_ibm | egrep 'fan_|thermal'
sysctl hw.acpi.thermal.tz0.temperature
sysctl hw.acpi.thermal.tz1.temperature
acpiconf -i0 | egrep 'State|Remain|Present|Volt'

to which I would add in the approriate place for yours:
 echo "`sysctl -n dev.cpu.2.cx_usage`"
 through
 echo "`sysctl -n dev.cpu.7.cx_usage`"
and if yours has more thermal zones, those also.

This provides a convenient way to see how things are going, as it shows 
C-state usage and power comsumption (when on battery) directly:

Thu Feb 12 20:12:47 EST 2015 dev.cpu.0.freq: 800
0.79% 12.31% 86.89% last 694us   { 0.51 0.55 0.50 }
0.64% 11.17% 88.17% last 227us   { HPET }
dev.acpi_ibm.0.fan_speed: 3363
dev.acpi_ibm.0.fan_level: 0
dev.acpi_ibm.0.thermal: 39 41 -1 39 34 -1 33 -1
hw.acpi.thermal.tz0.temperature: 39.0C
hw.acpi.thermal.tz1.temperature: 36.0C
State:                  high
Remaining capacity:     99%
Remaining time:         unknown
Present rate:           0 mW
Present voltage:        12413 mV

Ignore these load average figures shown with HPET timecounter, they're 
utter nonsense, this system is completely idle, and shows 0.00 0.00 0.00 
when using LAPIC timecounter - but that's an entirely separate issue :)

6) of course it's possible you have a dud battery, but if you get powerd 
and C-states working right you should see quite an improvement.

7) Your girlfriend is cuter than you :)

cheers, Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150212192344.P38620>