From 904de2e2e15197210e6741487615f78377366923 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 14 Feb 2010 21:37:01 -0800 Subject: [PATCH] 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. --- sys/dev/acpica5/acpi_thermal.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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); + } } } -- 2.41.0