android_kernel_samsung_msm8976/drivers
Alexey Starikovskiy 5f7748cf91 Execute AML Notify() requests on stack.
HP nx6125/nx6325/... machines have a _GPE handler with an infinite
loop sending Notify() events to different ACPI subsystems.

The notify handler in the ACPI thermal driver is a C-routine,
which may invoke the ACPI interpreter again to get access
to some ACPI variables such as temperature.  (acpi_evaluate_xxx)
On these HP machines such an evaluation changes state of an ASL 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 explosion in memory consumption.

Also as GPE handling is blocked, machines overheat because ACPI-based
fan control is stalled.  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 this failure,  Linux must not send notify events to the
kacpid workqueue -- either executing them immediately or putting them
on some other thread.

The 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-based kernel shipped with Ubuntu 6.06 LTS.

Second attempt was done by Alexey Starikovskiy, who 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 2.6.18-rc2.

Alexey 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 this broke Linus' machine
also and was reverted from 2.6.19-rc with much fanfair.

The 4th patch 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).  Then a 5th attempt did a
yield() to every GPE execution.

Finally, this 6th generation patch simply executes the notify handler
on the stack.  Previous attempts to do this simple solution failed
because of issues in AML mutex re-entrancy which are now fixed
by the previous patch in this series.

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

Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-15 16:13:51 -05:00
..
acorn [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
acpi Execute AML Notify() requests on stack. 2007-02-15 16:13:51 -05:00
amba
ata [PATCH] scheduled removal of SA_XXX interrupt flags: ata fix 2007-02-14 08:09:55 -08:00
atm [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
auxdisplay [PATCH] drivers: add LCD support 2007-02-11 10:51:24 -08:00
base [PATCH] Drop __get_zone_counts() 2007-02-11 10:51:18 -08:00
block [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
bluetooth [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
cdrom [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
char [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
clocksource
connector [PATCH] connector: some fixes for ia64 unaligned access errors 2007-01-05 23:55:29 -08:00
cpufreq [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
crypto [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
dio
dma
edac [PATCH] EDAC: Add Fully-Buffered DIMM APIs to core 2007-02-12 09:48:32 -08:00
eisa
fc4 [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
firmware [PATCH] docbook: add edd firmware interfaces 2007-02-11 10:51:32 -08:00
hid [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
hwmon i2c/vt8231: Remove superfluous initialization 2007-02-13 22:08:58 +01:00
i2c [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
ide [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
ieee1394 [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
infiniband [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2007-02-14 08:09:54 -08:00
input [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2 2007-02-14 08:09:55 -08:00
isdn [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
kvm [PATCH] i386: Convert i386 PDA code to use %fs 2007-02-13 13:26:20 +01:00
leds
macintosh [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
mca
md [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
media [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
message [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
mfd
misc [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2007-02-14 08:09:54 -08:00
mmc [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
mtd [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2 2007-02-14 08:09:55 -08:00
net [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
nubus
oprofile [PATCH] mark struct file_operations const 5 2007-02-12 09:48:45 -08:00
parisc [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
parport [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
pci [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2007-02-14 08:09:54 -08:00
pcmcia [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
pnp [PATCH] mark struct file_operations const 5 2007-02-12 09:48:45 -08:00
ps3 [PATCH] ps3: disable display flipping during mode changes 2007-02-12 09:48:44 -08:00
rapidio [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
rtc [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2007-02-14 08:09:54 -08:00
s390 [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
sbus [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
scsi [PATCH] sysctl: remove insert_at_head from register_sysctl 2007-02-14 08:09:59 -08:00
serial [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
sh
sn [PATCH] IOC3/IOC4: PCI mem space resources 2007-02-11 10:51:25 -08:00
spi [PATCH] SPI: atmel_spi driver 2007-02-14 08:09:53 -08:00
tc [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
telephony [PATCH] remove many unneeded #includes of sched.h 2007-02-14 08:09:54 -08:00
usb [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2007-02-14 08:09:54 -08:00
video [PATCH] Scheduled removal of SA_xxx interrupt flags fixups 2007-02-14 08:09:54 -08:00
w1 [PATCH] w1: Use ARRAY_SIZE macro when appropriate 2007-02-12 09:48:28 -08:00
zorro [PATCH] mark struct file_operations const 6 2007-02-12 09:48:45 -08:00
Kconfig [PATCH] drivers: add LCD support 2007-02-11 10:51:24 -08:00
Makefile [PATCH] drivers: add LCD support 2007-02-11 10:51:24 -08:00