linux/drivers/acpi
Alexey Starikovskiy 88db5e1489 ACPI: created a dedicated workqueue for notify() execution
HP nx6125/nx6325/... machines have a _GPE handler with an infinite
loop sending Notify() events to different ACPI subsystems.

Notify handler in ACPI driver is a C-routine, which may call ACPI
interpreter again to get access to some ACPI variables
(acpi_evaluate_xxx).
On these HP machines such an evaluation changes state of some variable
and lets the loop above break.

In the current ACPI implementation Notify requests are being deferred
to the same kacpid workqueue on which the above GPE handler with
infinite loop is executing. Thus we have a deadlock -- loop will
continue to spin, sending notify events, and at the same time
preventing these notify events from being run on a workqueue. All
notify events are deferred, thus we see increase in memory consumption
noticed by author of the thread. Also as GPE handling is bloked,
machines overheat. Eventually by external poll of the same
acpi_evaluate, kacpid is released and all the queued notify events are
free to run, thus 100% cpu utilization by kacpid for several seconds
or more.

To prevent all these horrors it's needed to not put notify events to
kacpid workqueue by either executing them immediately or putting them
on some other thread. It's dangerous to execute notify events in
place, as it will put several ACPI interpreter stacks on top of each
other (at least 4 in case of nx6125), thus causing kernel  stack
overflow.

First attempt to create a new thread was done by Peter Wainwright
He created a bunch of threads, which were stealing work from a kacpid
workqueue.
This patch appeared in 2.6.15 kernel shipped with Ubuntu 6.06 LTS.

Second attempt was done by me, I created a new thread for each Notify
event. This worked OK on HP nx machines, but broke Linus' Compaq
n620c, by producing threads with a speed what they stopped the machine
completely. Thus this patch was reverted from 18-rc2 as I remember.
I re-made the patch to create second workqueue just for notify events,
thus hopping it will not break Linus' machine. Patch was tested on the
same HP nx machines in #5534 and #7122, but I did not received reply
from Linus on a test patch sent to him.
Patch went to 19-rc and was rejected with much fanfare again.
There was 4th patch, which inserted schedule_timeout(1) into deferred
execution of kacpid, if we had any notify requests pending, but Linus
decided that it was too complex (involved either changes to workqueue
to see if it's empty or atomic inc/dec).
Now you see last variant which adds yield() to every GPE execution.

http://bugzilla.kernel.org/show_bug.cgi?id=5534
http://bugzilla.kernel.org/show_bug.cgi?id=8385

Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-09 23:31:03 -04:00
..
dispatcher Revert "ACPICA: fix AML mutex re-entrancy" 2007-05-09 23:01:59 -04:00
events Revert "Execute AML Notify() requests on stack." 2007-05-09 22:59:38 -04:00
executer Revert "ACPICA: fix AML mutex re-entrancy" 2007-05-09 23:01:59 -04:00
hardware ACPI: resolve HP nx6125 S3 immediate wakeup regression 2007-03-12 14:49:26 -04:00
namespace Revert "ACPICA: revert "acpi_serialize" changes" 2007-05-09 22:56:38 -04:00
parser
resources ACPI: fix boot hang w/o "noapic" on MSI MS-6390-L 2007-03-08 03:42:42 -05:00
sleep PM: Separate hibernation code from suspend code 2007-05-09 12:30:48 -07:00
tables ACPICA: clear fields reserved before FADT r3 2007-04-28 20:55:06 -04:00
utilities Revert "ACPICA: fix AML mutex re-entrancy" 2007-05-09 23:01:59 -04:00
Kconfig Pull sbs into release branch 2007-04-28 23:16:59 -04:00
Makefile Pull sbs into release branch 2007-04-28 23:16:59 -04:00
ac.c
acpi_memhotplug.c ACPI: Remove duplicate definitions for _STA bits 2007-04-25 14:17:39 -04:00
asus_acpi.c backlight: Separate backlight properties from backlight ops pointers 2007-02-20 09:26:53 +00:00
battery.c Pull bugzilla-7200 into release branch 2007-02-16 22:11:37 -05:00
bay.c Pull fluff into release branch 2007-02-16 22:10:32 -05:00
blacklist.c ACPI: make blacklist more verbose 2007-03-09 21:19:05 -05:00
bus.c ACPI: use _STA bit names rather than 0x0F 2007-04-25 14:20:58 -04:00
button.c
cm_sbs.c
container.c ACPI: Remove duplicate definitions for _STA bits 2007-04-25 14:17:39 -04:00
debug.c
dock.c ACPI: dock: use NULL for pointer 2007-03-28 23:31:43 -04:00
ec.c ACPI: EC: Block queries until EC is fully initialized 2007-03-09 23:27:29 -05:00
event.c
fan.c
glue.c workaround rtc-related acpi table bugs 2007-05-08 11:15:18 -07:00
numa.c Fix unnecesary meminit 2007-05-08 20:41:14 -07:00
osl.c ACPI: created a dedicated workqueue for notify() execution 2007-05-09 23:31:03 -04:00
pci_bind.c
pci_irq.c
pci_link.c
pci_root.c
power.c Pull misc-for-upstream into release branch 2007-03-09 23:19:50 -05:00
processor_core.c ACPI: Remove duplicate definitions for _STA bits 2007-04-25 14:17:39 -04:00
processor_idle.c [PATCH] x86: Log reason why TSC was marked unstable 2007-05-02 19:27:08 +02:00
processor_perflib.c [CPUFREQ] Remove deprecated /proc/acpi/processor/performance write support 2007-04-26 14:32:02 -04:00
processor_thermal.c
processor_throttling.c
sbs.c ACPI: sbs: Common interface with CM battery 2007-03-22 01:15:58 -04:00
scan.c PNPACPI sets pnpdev->dev.archdata 2007-05-08 11:15:08 -07:00
system.c
tables.c Revert "ACPI: parse 2nd MADT by default" 2007-03-30 14:16:10 -04:00
thermal.c acpi-thermal: fix mod_timer() interval 2007-04-24 08:23:08 -07:00
toshiba_acpi.c backlight: Separate backlight properties from backlight ops pointers 2007-02-20 09:26:53 +00:00
utils.c
video.c ACPI: video: Fix spelling and grammar mistakes 2007-03-09 21:37:07 -05:00