Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 160659 - hald polls /proc/apm excessively
Summary: hald polls /proc/apm excessively
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: hal
Version: 4
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: David Zeuthen
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2005-06-16 14:02 UTC by Nick Lamb
Modified: 2013-03-06 03:43 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2005-06-16 14:23:15 UTC


Attachments (Terms of Use)

Description Nick Lamb 2005-06-16 14:02:59 UTC
Description of problem:

Duron 700 desktop (ie not laptop) - upgraded from FC3, and before that previous
versions of FC/ Red Hat - unnecessarily polls APM, wasting 0.2% of CPU all day,
every day.

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

hald wakes up every so often (2 seconds? a bit less?) and reads the /proc/apm
file _twice_ before going back to sleep. This is undesirable at best.

Here's a system call trace of the behaviour.

poll([{fd=5, events=POLLIN}, {fd=10, events=POLLIN}, {fd=11, events=POLLIN},
{fd=7, events=POLLIN}, {fd=13, events=POLLIN}, {fd=9, events=POLLIN|POLLPRI},
{fd=8, events=POLLIN}], 7, 1514) = 0
gettimeofday({1118929418, 873249}, NULL) = 0
open("//proc/apm", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7f1c000
read(3, "1.16ac 1.2 0x03 0x01 0xff 0x80 -"..., 1024) = 40
close(3)                                = 0
munmap(0xb7f1c000, 4096)                = 0
open("//proc/apm", O_RDONLY|O_LARGEFILE) = 3
fstat64(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0xb7f1c000
read(3, "1.16ac 1.2 0x03 0x01 0xff 0x80 -"..., 1024) = 40
close(3)                                = 0
munmap(0xb7f1c000, 4096)                = 0
gettimeofday({1118929419, 31308}, NULL) = 0

At least I should like to see this code changed to read /proc/apm only once for
each repetition, but preferably I should like to be able to turn this off
altogether. There's nothing for HAL to see in this APM structure on a desktop
PC, just mindless repetition.

Comment 1 David Zeuthen 2005-06-16 14:23:15 UTC
> There's nothing for HAL to see in this APM structure on a desktop
> PC, just mindless repetition.

If you're using APM, there's unfortunately no reliable way (we can't trust the
DMI tables, sorry) to detect whether there is a battery or not so we have to do
this. Suggest to use ACPI instead and then this won't happen. 

I've noted upstream (I'm upstream) to only read /proc/apm once per poll and
perhaps poll less often (say every ten seconds instead of every two seconds) -
that will be in the next release.


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