Bug 28192
Summary: | battery confuses mW and mA reporting units => wrong rate/energy | ||
---|---|---|---|
Product: | ACPI | Reporter: | Björn Schließmann (chronoss) |
Component: | Power-Battery | Assignee: | Lan Tianyu (tianyu.lan) |
Status: | CLOSED CODE_FIX | ||
Severity: | normal | CC: | florian, lenb, rui.zhang |
Priority: | P1 | ||
Hardware: | All | ||
OS: | Linux | ||
Kernel Version: | v2.6.38 | Subsystem: | |
Regression: | No | Bisected commit-id: | |
Attachments: |
Patch that solves the issue for me
Refresh sysfs in acpi_battery_update(), too Output of acpidump Output of acpidump -b Contents of sysfs battery directory, everything in order. Same as above, but now the values are wrong. Situation after file 61802; reloaded module battery debug patch add_hibernation_and_restore.patch |
Description
Björn Schließmann
2011-02-04 18:49:44 UTC
After lengthy bisections and experiments I have gained two insights: 1. It's no regression. It happens from 7faa144a518c456e2057918f030f50100144ccc6 onward (in there, power_now was introduced). 2. The attached patch solves the issue for me. It was inspired by da8aeb92d4853f37e281f11fddf61f9c7d84c3cd; the latter does not solve the problem for me though. This one does. How well are chances to get this patch into mainline? It applies cleanly on v2.6.38 and v2.6.39-rc1. Created attachment 53352 [details]
Patch that solves the issue for me
tested to apply on v2.6.38 and v2.6.39-rc1 of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Created attachment 53692 [details]
Refresh sysfs in acpi_battery_update(), too
applies cleanly on v2.6.38, v2.6.39-rc1, v2.6.39-rc2 of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git
> - _BIF, which among others returns the reporting unit of the battery data, is > only called once at module load The _BIF will also be called when receiving the ACPI_BATTERY_NOTIFY_INF notification. This happens in the acpi_battery_refresh. This functions will do the same thing as your patch do. If the _BIF wasn't called, your patch would make no sense. After dealing with the ACPI_BATTERY_NOTIFY_INF notification, the _BST method will be called to update associated data. The b23fffd778c312b8fb258d342051fcbdf6712128 mentions your issue. > Most of the time, the error only appears after the X201 was turned off for a > longer time period. Does this problem happen very time? This looks like lacking the ACPI_BATTERY_NOTIFY_INF notification during the situation. Pls attach the output of acpidump. > Does this problem happen very time? I forgot to write it; later I could reproduce it practically always by 1. hibernating/suspending 2. plugging/unplugging from mains (toggle) 3. resuming It's a while ago now so I'm not absolutely sure if it happened only with hibernating, suspending or with both. IIRC both. I could look into it again if it'd be useful. > This looks like lacking the ACPI_BATTERY_NOTIFY_INF notification during the > situation. > Pls attach the output of acpidump. I will. Created attachment 60282 [details]
Output of acpidump
Created attachment 60292 [details]
Output of acpidump -b
Please attach the output of the following respectively in the normal situation and the abnormal situation. cat /proc/acpi/battery/*/* I find the patch 25be5821521640eb00b7eb219ffe59664510d073 have resolved your problem. Have you checked the problem on the 2.6.39-rc1 or up without your patch? commit 25be5821521640eb00b7eb219ffe59664510d073 Author: Kyle McMartin <kyle@redhat.com> Date: Tue Mar 22 16:19:50 2011 -0400 ACPI battery: fribble sysfs files from a resume notifier Commit da8aeb92 re-poked the battery on resume, but Linus reports that it broke his eee and partially reverted it in b23fffd7. Unfortunately this also results in my x201s giving crack values until the sysfs files are poked again. In the revert message, it was suggested that we poke it from a PM notifier, so let's do that. With this in place, I haven't noticed the units going nutty on my gnome-power-manager across a dozen suspends or so... This bug is resolved? Cool, good to know. I didn't even have any time to test it yet. I will though during the next days. I'm sorry to say the error appears again. A freshly compiled v3.0-rc2 without my patch produces the attached files (ad #8). (With my patch it works best.) BTW, I have no /proc/acpi, I changed the command to for i in /sys/class/power_supply/*/*; do echo ==== ${i} ===; cat $i; echo; done &> file.log Created attachment 61792 [details]
Contents of sysfs battery directory, everything in order.
Created attachment 61802 [details]
Same as above, but now the values are wrong.
Note that energy_*, power_now all differ by approx. factor 10.
Created attachment 61812 [details]
Situation after file 61802; reloaded module battery
After having reloaded module battery, the values are correct again.
Forgot to mention; I created att. 61802 after hibernating the computer in the evening yesterday and waking it up this noon, with an unpatched v3.0-rc2. Created attachment 61922 [details]
debug patch
You can add CONFIG_ACPI_PROCFS_POWER and then will be able to visit /proc/acpi.
Please try add_hibernation.patch which add the process of the hibernation event.
If it doesn't work, try add_hibernation_and_restore.patch.
Created attachment 61932 [details]
add_hibernation_and_restore.patch
Thanks, I'll do so and report back. Since my last message, I'm testing v3.0-rc3 with "add_hibernation.patch", and the error condition hasn't shown itself once. I'd consider this bug fixed. Thanks for your time :) patch above staged in acpi-test for 3.1 A patch referencing this bug report has been merged in Linux v3.1-rc1: commit d5a5911b3278bad6515a9958f7318f74d534ef64 Author: Lan Tianyu <tianyu.lan@intel.com> Date: Thu Jun 30 11:33:40 2011 +0800 ACPI / Battery: Add the hibernation process in the battery_notify() |