upowerd high cpu usage

Hizsnyai Gábor hizsnyaig at gmail.com
Wed Dec 7 01:03:41 PST 2011


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: 200000
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:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [352.984979]
add /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
UDEV [352.994303]
change /devices/LNXSYSTM:00/device:00/PNP0A08:00/device:02/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 (power_supply)
KERNEL[353.006645]
change /devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/AC0
(power_supply)
UDEV [353.012196]
change /devices/LNXSYSTM:00/device:00/ACPI0003:00/power_supply/AC0
(power_supply)
…

As a comparison here’s the battery info of a Dell Inspiron that works
well with udev/upower
$ cat /proc/acpi/battery/BAT0/*
alarm: unsupported
present: yes
design capacity: 4400 mAh
last full capacity: 4609 mAh
battery technology: rechargeable
design voltage: 11100 mV
design capacity warning: 440 mAh
design capacity low: 133 mAh
cycle count:	 0
capacity granularity 1: 44 mAh
capacity granularity 2: 44 mAh
model number: DELL 8NH5512
serial number: 3491
battery type: LION
OEM info: SMP
present: yes
capacity state: ok
charging state: charged
present rate: 1 mA
remaining capacity: 4609 mAh
present voltage: 12449 mV

Taking someones advice to limit the cpu usage of upowerd w cpulimit, the
system gets non-responsive for real PM events. Taking the battery out
everything seems normal until I put it back -- the huge amount of events
comes again.

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).

Thanks,
Gabor



More information about the devkit-devel mailing list