From: Matthew Dillon Date: Mon, 15 Feb 2010 05:37:01 +0000 (-0800) Subject: kernel - acpi - fix thermal thread loop X-Git-Tag: v2.7.1~135 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/904de2e2e15197210e6741487615f78377366923 kernel - acpi - fix thermal thread loop * The thermal thread was sleeping in tzpool with the thermal lock held, causing anyone trying to use the lock (e.g. apm) to block for very long periods of time (sometimes forever). * Properly drop the lock when sleeping. --- diff --git a/sys/dev/acpica5/acpi_thermal.c b/sys/dev/acpica5/acpi_thermal.c index 5bf894b2de..4fd68934f8 100644 --- a/sys/dev/acpica5/acpi_thermal.c +++ b/sys/dev/acpica5/acpi_thermal.c @@ -981,15 +981,15 @@ acpi_tz_thread(void *arg) } /* - * If we have no more work, sleep for a while, setting PDROP so that - * the mutex will not be reacquired. Otherwise, drop the mutex and - * loop to handle more events. + * Interlocked sleep until signaled or we timeout. */ - if (i == devcount) - tsleep(&acpi_tz_td, 0, "tzpoll", - hz * acpi_tz_polling_rate); - else + if (i == devcount) { + tsleep_interlock(&acpi_tz_td, 0); + ACPI_UNLOCK(thermal); + tsleep(&acpi_tz_td, 0, "tzpoll", hz * acpi_tz_polling_rate); + } else { ACPI_UNLOCK(thermal); + } } }