upowerd high cpu usage

2011-12-07 Thread Hizsnyai Gábor
Hi,

Sorry for bugging, but I think this is the most appropriate place to
send a report of a potential bug. If you find this info is rather
related to other project(s), please help me find the right one.

I installed the latest version of Ubuntu on my netbook. The battery
indicator started changing its state continuously, so I gathered some
info. The top reported the upowerd used 50-80% CPU. After doing some
research it seems udev/upower creates/handles far too many events about
the battery state -- incorrectly. It also happens with other distros,
and other versions of Ubuntu (11.04, 11.10, 12.04 daily).
The situation is similar to an older problem, when the udev had some
conflict w optiarc drives producing many events:
https://bugs.launchpad.net/linux/+bug/379780

The details
-
When the battery is in the netbook, the monitors of upower and udev
report a tons of events. Here’s the battery info of my netbook

$ cat /proc/acpi/battery/BAT0/*
alarm: unsupported
present: yes
design capacity: 2200 mAh
last full capacity: 2167 mAh
battery technology: rechargeable
design voltage: 11100 mV
design capacity warning: 220 mAh
design capacity low: 21 mAh
cycle count: 0
capacity granularity 1: 0 mAh
capacity granularity 2: -1 mAh
model number: Battery
serial number: 20
battery type: LION
OEM info: Manufacture
present: yes
capacity state: ok
charging state: charged
present rate: 0 mA
remaining capacity: 2144 mAh
present voltage: 12499 mV

Here's the output of the upower monitor

$ upower --monitor
Monitoring activity from the power daemon. Press Ctrl+C to cancel.
[08:40:45.158]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:45.165]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:45.196]  device
removed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:46.224]  device
added: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:46.235]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:46.245]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:46.256]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:46.257]  device
changed: /org/freedesktop/UPower/devices/line_power_AC0
[08:40:47.120]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:47.286]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:47.344]  device
removed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:48.337]  device
added: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:48.351]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:48.362]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:48.372]  device
changed: /org/freedesktop/UPower/devices/battery_BAT0
[08:40:48.372]  device
changed: /org/freedesktop/UPower/devices/line_power_AC0
...

The output of the udev monitor

$ udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[350.765144]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
UDEV [350.768243]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[350.829713]
remove 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[350.829896]
add 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[350.830243]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
UDEV [350.833709]
remove 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
UDEV [350.844231]
add 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
UDEV [350.853118]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[350.871278]
change /devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/AC0
(power_supply)
UDEV [350.876821]
change /devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/AC0
(power_supply)
KERNEL[352.885204]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
UDEV [352.889076]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[352.967214]
remove 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[352.967453]
add 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
KERNEL[352.967716]
change 
/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
 (power_supply)
UDEV [352.970506]
remove 
/devices/LNXSYSTM

Re: upowerd high cpu usage

2011-12-07 Thread Richard Hughes
On 7 December 2011 09:03, Hizsnyai Gábor  wrote:
> KERNEL[350.765144]
> change 
> /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0
>  (power_supply)
> UDEV [350.768243]

That's an insane amount of data from the kernel. I think you need to
file a bug against the kernel about rate-limiting events like this.

> For the first sight the main difference between these batteries is the
> capacity granularity values; I'd say the values (0 and -1) could cause
> problems (division by zero, non managed interval...? whatever).

Have you tried a different battery? I've heard problems of the "smart"
controller on the battery malfunctioning and causing an SMBIOS event
storm like you describe.

Richard.
___
devkit-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/devkit-devel


Re: upowerd high cpu usage

2011-12-07 Thread Hizsnyai Gábor
> That's an insane amount of data from the kernel. I think you need to
> file a bug against the kernel about rate-limiting events like this.

Probably you're right, however the issue is not just the amount of the events,
but the events. When you have a look at the list it seems I removed the battery
and put it back few times in every second. (I didn't)

> Have you tried a different battery? I've heard problems of the "smart"
> controller on the battery malfunctioning and causing an SMBIOS event
> storm like you describe.

I have two batteries for this netbook. The upowerd produces the same
using any of them. However, an older version of Ubuntu (10.10) was
working fine on this netbook.

Thanks for your response, I give it a try and file a bug there anyway

Gabor

___
devkit-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/devkit-devel