Bug 811949

Summary: On AC powertop shows charging rate as power usage
Product: [Fedora] Fedora Reporter: Need Real Name <lsof>
Component: powertopAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 16CC: jskarvad, lsof, metherid
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: powertop-1.98-9.fc16 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-04-26 20:06:39 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed fix none

Description Need Real Name 2012-04-12 11:32:35 UTC
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 12:06:48 UTC
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 17:28:36 UTC
(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 18:56:36 UTC
Same for machine 2. I have one last machine to try.

Comment 4 Jaroslav Škarvada 2012-04-13 07:45:26 UTC
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 09:02:50 UTC
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 09:03:54 UTC
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 09:10:49 UTC
From the log, machine 3 should work in powertop, could you confirm?

Comment 8 Need Real Name 2012-04-13 15:52:54 UTC
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 13:03:17 UTC
(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 09:15:07 UTC
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 13:45:43 UTC
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 13:58:58 UTC
Created attachment 578041 [details]
Proposed fix

Show power consumption only if discharging.

Comment 13 Jaroslav Škarvada 2012-04-17 14:04:51 UTC
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 14:19:28 UTC
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 14:24:22 UTC
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 19:33:16 UTC
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 20:06:39 UTC
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 20:28:54 UTC
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.