Re: powertop vs upower, troubleshooting battery remaining

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 03-09-19 17:29, Chris Murphy wrote:
On Tue, Sep 3, 2019 at 5:13 AM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:

Hi Chris,

On 03-09-19 01:47, Chris Murphy wrote:
This is an hp spectre running Fedora 30 Workstation. On Fedora 29,
there was fairly close agreement between powertop and upower and the
time estimates were sane.

Something's wonky on Fedora 30 and I'm not sure where to begin
troubleshooting, although I posted a message on the upstream powertop
list.

This is what I'm seeing.
https://paste.fedoraproject.org/paste/3M7euUWnqZG07KKJQpRQ-w/raw

powertop says 108 hours remaining, upower first says 6.8 hours
remaining which is much more plausible, but then merely 4 minutes
later battery has gone from 93% to 77%, and to a 22 minute remaining
estimate. Really? One says the battery reports 268mW of discharge, the
other reports 61W discharge. Neither of those is possible.

What you are likely seeing is the fuel-gauge/BMC chip adjusting its
readings all of a sudden, probably based on battery voltage.

A fuel-gauge can do 2 things to get a "percentage" full reading:

1) it can measure current going into and out of the battery and keep
track of the amount of energy in the battery that way, but that does
not include looses, including looses by the battery-cells's
self-discharging (which all cells do to some extend).

2) it can use a battery voltage to percent-full table

Most fuel-gauges use 1 since it is much more fine grained, combined
with 2 to adjust 1 if the 2 get out of sync too much, since 1
collects a cumulative amount of errors over time.

I guess that you put this laptop away fully charged and then did
not use it for a while?

It's a laptop almost always left plugged in. I try to exercise the
battery once a month though, with a complete discharge until it powers
off. In this case, I'd unplugged power within the previous ~10 minutes
trying to reproduce on kernel 5.2.11 what I first saw with 5.3.0-rc6.

Esp. when charged near 100% the self-discharge
is pretty high (for long term storage 50-70% charge is advised), but
the self-discharge is not energy consumed by the mainboard of the laptop,
it is energy which "disappears" inside the cells itself, so the fuel-gauge
does not know about it causing the gauge value reported by method 1 above
to be off by a significant amount. So what I think you saw happening with
the jump from 93 to 77% is the fuel-gauge correcting the reading based
on cell voltage. Some fuel-gauge-s do this gradually, this one clearly
does not.

As for the 61W discharge rate, Your 2 upower runs with 4 minutes in between,
saw a jump of 4.7Wh in capacity 4.7Wh = 4.7 * 3600 Ws = 16920 Ws(econd)

16920 Ws / 4min = 16920 Ws / (4 * 60s) = 70.5W so the math certainly
is spot on there. Now if we had enough manpower it would be nice to
teach upower to somehow filter out these jumps. But we really do not
have anyone to work on that. However if you wait a bit then the readings
should normalize again shortly afterwards.

upower does, powertop doesn't (in contrast to how it worked as
recently as a few months ago on this same laptop)

However, near end of battery it becomes erratic again. Sometimes it
gives no warning and just shuts off, going from ~30 minutes remaining
to "ok bye!". And other times it gets to ~20 minutes (3% battery) and
stays there for nearly an hour within a single minute increase or
decrease in "remaining" value.

Yeah, so this indeed sounds like the battery is not in good health,
note that leaving a laptop continuously plugged in tends to be bad
for batteries. The ideal state for a li-ion battery wrt wear and tear
is the 40 to 70% range, if it is continuously plugged in you are
constantly recharging between 95% and a 100% which causes a lot of
wear.  Note I'm not blaming you, the problem is just that battery
technology still sucks. Electric cars avoid this by never going over
80% charge, this is how they can give a 5 year warranty on the battery.

Unfortunately for laptops and phones advertised battery life seems
to be more important then longevity (yeah marketing) so they
charge to 100% or over 100%, 100% used to be charge to 4.2 volts
for a single cell. Now a days with better cells, which will not
spectacularly fail at higher voltages, phone manufacturers often
charge up to 4.3 volt, which basically is like 110%. This is not
good for the longevity of the battery ...

TL;DR: I do not believe that this is a software issue.

As for the POWERTOP reading of 268mW that does sound wrong, powertop
uses a moving average for this, did you give it a couple of minutes
for the readings to stabilize?

Maybe 6 hours. It started out with ~270mW and ends with that, it never
really varies much. And that's not my experience with this same laptop
even as recently as a few months ago. If the vast majority of power
management is in hardware, then I'm suspicious of a powertop bug. Or
otherwise powertop and upower are getting their information from
different sources.

Yeah 270mW seems way too low and a bug, esp. since upower is giving
proper readings (except for the jump and the end of the range)

With Fedora 29 (and thus powertop 2.9) the time remaining estimate was
sane, but it seemingly underestimated the draw on the backlight, with
virbr0 consuming as much as I figured the backlight should have been
consuming. Whereas F30/powertop 2.10, the display backlight only shows
up for the first minute of runtime and then it vanishes out of the
list entirely, and even while plugged into power, powertop reports
"The battery reports a discharge rate of 281 mW" which really does
seem bogus.

So the way powertop determines which component consumes how much is
really unreliable. It has not clue, so it looks at changes compared to
previous measurements and if say only one process caused significantly
more wakeups, and that causes an extra power-draw of 0.1W then it
calculates a W per wakeup based on that. So basically it does a whole
lot of guessing based on differences between different measurements,
but it really is nothing more then a guess.

Regards,

Hans
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux