Bug 811949 - On AC powertop shows charging rate as power usage
On AC powertop shows charging rate as power usage
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: powertop (Show other bugs)
16
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Jaroslav Škarvada
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-12 07:32 EDT by Need Real Name
Modified: 2012-05-04 16:28 EDT (History)
3 users (show)

See Also:
Fixed In Version: powertop-1.98-9.fc16
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-04-26 16:06:39 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed fix (583 bytes, patch)
2012-04-17 09:58 EDT, Jaroslav Škarvada
no flags Details | Diff

  None (edit)
Description Need Real Name 2012-04-12 07:32:35 EDT
Description of problem:
powertop 1.98 no longer shows me the power usage like it used to.
This is a regression.

I have tested powertop-1.98-5.fc16.x86_64 on three machines where it worked before.

Bug 796068 claims a fix, but since it fails for me this must be a separate bug.

The following post contains a patch:
 http://www.mail-archive.com/debian-bugs-dist@lists.debian.org/msg988070.html

I have run calibrate.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 Jaroslav Škarvada 2012-04-12 08:06:48 EDT
Do you mean ACPI power rate (in top of screen) or per process estimate (in the first column)?

If the former is you case please provide output (when running on battery) of:
# for d in /sys/class/power_supply/*; do echo $d; cat $d/uevent; done

And:
# ls /proc/acpi/battery
Comment 2 Need Real Name 2012-04-12 13:28:36 EDT
(In reply to comment #1)
> Do you mean ACPI power rate (in top of screen) or per process estimate (in the
> first column)?

I don't know where it is in this version, but I see no signs of it anywhere.

I have
 PowerTOP 1.98 Overview
then
 Summary: 50.8 wakeups/second,  0.0 GPU ops/second and 0.0 VFS ops/sec

> If the former is you case please provide output (when running on battery) of:
> # for d in /sys/class/power_supply/*; do echo $d; cat $d/uevent; done

MACHINE 1:

# for d in /sys/class/power_supply/*; do echo $d; cat $d/uevent; done
/sys/class/power_supply/*
cat: /sys/class/power_supply/*/uevent: No such file or directory

> And:
> # ls /proc/acpi/battery

MACHINE 1:

# ls /proc/acpi/battery
ls: cannot access /proc/acpi/battery: No such file or directory


Machine 2 tomorrow.
Comment 3 Need Real Name 2012-04-12 14:56:36 EDT
Same for machine 2. I have one last machine to try.
Comment 4 Jaroslav Škarvada 2012-04-13 03:45:26 EDT
Thanks for info. This seems that the power consumption information is not exported by your kernel. We cannot fix this in powertop. Please provide your kernel version by:
# uname -r

I tested on 3.3.1-3.fc16.x86_64 and it worked OK on all my machines. If it worked for you with previous kernel(s) it is regression and the bug needs to be reassigned to kernel component.
Comment 5 Need Real Name 2012-04-13 05:02:50 EDT
MACHINE 3 on power:

# for d in /sys/class/power_supply/*; do echo $d; cat $d/uevent; done
/sys/class/power_supply/AC
POWER_SUPPLY_NAME=AC
POWER_SUPPLY_ONLINE=1
/sys/class/power_supply/BAT0
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
POWER_SUPPLY_VOLTAGE_NOW=16663000
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_CHARGE_FULL_DESIGN=2800000
POWER_SUPPLY_CHARGE_FULL=683000
POWER_SUPPLY_CHARGE_NOW=683000
POWER_SUPPLY_MODEL_NAME=Primary
POWER_SUPPLY_MANUFACTURER=Hewlett-Packard
POWER_SUPPLY_SERIAL_NUMBER=xxx
#  ls /proc/acpi/battery
ls: cannot access /proc/acpi/battery: No such file or directory

On battery:

# for d in /sys/class/power_supply/*; do echo $d; cat $d/uevent; done
/sys/class/power_supply/AC
POWER_SUPPLY_NAME=AC
POWER_SUPPLY_ONLINE=0
/sys/class/power_supply/BAT0
POWER_SUPPLY_NAME=BAT0
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=14800000
POWER_SUPPLY_VOLTAGE_NOW=16366000
POWER_SUPPLY_CURRENT_NOW=824000
POWER_SUPPLY_CHARGE_FULL_DESIGN=2800000
POWER_SUPPLY_CHARGE_FULL=683000
POWER_SUPPLY_CHARGE_NOW=732000
POWER_SUPPLY_MODEL_NAME=Primary
POWER_SUPPLY_MANUFACTURER=Hewlett-Packard
POWER_SUPPLY_SERIAL_NUMBER=xxx
#  ls /proc/acpi/battery
ls: cannot access /proc/acpi/battery: No such file or directory
Comment 6 Need Real Name 2012-04-13 05:03:54 EDT
Just saw your comment.

Using 3.3.1-3.fc16.x86_64 on machine 3 (and probably the others too).
Comment 7 Jaroslav Škarvada 2012-04-13 05:10:49 EDT
From the log, machine 3 should work in powertop, could you confirm?
Comment 8 Need Real Name 2012-04-13 11:52:54 EDT
Not that I can see - maybe I'm looking in the wrong place.

Starting from the console, I start powertop. Where should I look to see the power usage?
Comment 9 Jaroslav Škarvada 2012-04-16 09:03:17 EDT
(In reply to comment #8)
> Not that I can see - maybe I'm looking in the wrong place.
> 
> Starting from the console, I start powertop. Where should I look to see the
> power usage?

I injected your data (provided in comment 5) into my sysfs and it worked for me as expected (powertop-1.98-5.fc16). I got:
> The battery reports a discharge rate of 13.5 W
near the top of screen.

Automatic reproducer:
# powertop --html && grep discharge powertop.html
Loaded 331 prior measurements
Measuring for 20 seconds
Writing PowerTOP output to file powertop.html
<p>The battery reports a discharge rate of 13.5 W</p>

You have to run on battery (without AC) to see the power consumption.

Also for machines 1 and 2:
If it worked there with older kernels, i.e. you are able to get there output similar to comment 5 (or ls /proc/acpi/battery doesn't return 'No such file or directory') this would signal regression in kernel.
Comment 10 Need Real Name 2012-04-17 05:15:07 EDT
I can see the information on my laptop when the power is not connected.

Can you tell me if I am remembering wrong? I seem to remember that it was possible to view power usage in watts even for machines which don't run on battery.
Comment 11 Jaroslav Škarvada 2012-04-17 09:45:43 EDT
It should show the current power consumption only when discharging, otherwise the data means something different (in this case battery charging rate, i.e. the power that goes only to battery, not the overall power consumption).

So there is a bug - if you discharge your battery a bit and then connect to the AC, the charging rate is not zero and it is shown in powertop as discharging rate, which is not correct. Thanks for spotting, I will fix it.
Comment 12 Jaroslav Škarvada 2012-04-17 09:58:58 EDT
Created attachment 578041 [details]
Proposed fix

Show power consumption only if discharging.
Comment 13 Jaroslav Škarvada 2012-04-17 10:04:51 EDT
Changed subj accordingly. It seems there was a typo in original sources that causes this problem. Behaviour introduced by the proposed patch is the same as in older powertop version 1.
Comment 14 Fedora Update System 2012-04-17 10:19:28 EDT
powertop-1.98-9.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/powertop-1.98-9.fc17
Comment 15 Fedora Update System 2012-04-17 10:24:22 EDT
powertop-1.98-9.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/powertop-1.98-9.fc16
Comment 16 Fedora Update System 2012-04-18 15:33:16 EDT
Package powertop-1.98-9.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing powertop-1.98-9.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-6035/powertop-1.98-9.fc16
then log in and leave karma (feedback).
Comment 17 Fedora Update System 2012-04-26 16:06:39 EDT
powertop-1.98-9.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 18 Fedora Update System 2012-05-04 16:28:54 EDT
powertop-1.98-9.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.