ACPI battery problem and solution

From: Eric McCorkle <eric_at_shadowsun.net>
Date: Mon, 19 Sep 2011 23:08:51 -0400
Hello,

I'm running 9.0-CURRENT on a MacbookPro 5,5.  Following a recent update,
I found that the acpi battery functionality had stopped working.  I
suspect, given the nature of it, that other people may have seen this
problem as well.

I did some work, and traced the problem to its source.  The driver (in
dev/acpica/acpi_cmbat.c) attempts to dispatch a call to
acpi_cmbat_init_battery() via the AcpiOsExecute() mechanism.  However,
it seemed that the queue was filling up during kernel initialization,
and the call was getting dropped on the floor.  The cmbat driver reads
part of the battery info (the bif structure) into its own structures at
initialization, and then uses it, rather than querying the battery
directly.  Because AcpiOsExecute was dropping the initialization request
on the floor, the bif information was left uninitialized, which caused
the driver to mistakenly report the battery as not present when queried
from sysctl/ioctl.  I was able to workaround the problem by setting
debug.acpi.max_tasks to a higher value, which restored functionality.

Several possible solutions come to mind:
1) keep track of whether or not acpi_cmbat_init_battery (and possibly
other initialization routines) have actually been successfully queued
and run, to distinguish "genuine" failures, rather than failures
resulting from a full queue
2) run acpi_cmbat_init_battery (and possibly other initialization
routines) directly, rather than sending them through the queue.
3) something else

But I'll leave the decision of what to do up to people with more
knowledge of the acpi system.

Hope this helps someone.


Received on Tue Sep 20 2011 - 01:35:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:18 UTC