From owner-freebsd-acpi@FreeBSD.ORG Wed Feb 27 13:52:35 2013 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 81350747 for ; Wed, 27 Feb 2013 13:52:35 +0000 (UTC) (envelope-from hps@bitfrost.no) Received: from mta.bitpro.no (mta.bitpro.no [92.42.64.202]) by mx1.freebsd.org (Postfix) with ESMTP id 18A141CF for ; Wed, 27 Feb 2013 13:52:34 +0000 (UTC) Received: from mail.bitfrost.no (mail.bitfrost.no [46.29.221.36]) by mta.bitpro.no (Postfix) with ESMTP id 54FC47A123 for ; Wed, 27 Feb 2013 14:52:34 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bitfrost.no Received: from smtp.bitfrost.no (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: hanspetter) by mail.bitfrost.no (Postfix) with ESMTPSA id 7A77720D01 for ; Wed, 27 Feb 2013 14:52:28 +0100 (CET) From: Hans Petter Selasky Organization: Bitfrost A/S To: freebsd-acpi@freebsd.org Subject: ACPI locking bugs? Date: Wed, 27 Feb 2013 14:53:43 +0100 X-Face: ?p&W)c( =?utf-8?q?+80hU=3B=27=7B=2E=245K+zq=7BoC6y=7C=0A=09/D=27an*6mw?=>j'f:eBsex\Gi, X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2013 13:52:35 -0000 Hi, What is the reason for using cv_wait_sig() and cv_timedwait_sig() instead of cv_wait() and cv_timedwait() inside of AcpiOsWaitSemaphore(). What signals are supposed to be catched here? switch (Timeout) { case ACPI_DO_NOT_WAIT: if (!ACPISEM_AVAIL(as, Units)) status = AE_TIME; break; case ACPI_WAIT_FOREVER: while (!ACPISEM_AVAIL(as, Units)) { as->as_waiters++; error = cv_wait_sig(&as->as_cv, &as->as_lock); as->as_waiters--; if (error == EINTR || as->as_reset) { status = AE_ERROR; break; } } break; default: tmo = timeout2hz(Timeout); while (!ACPISEM_AVAIL(as, Units)) { prevtick = ticks; as->as_waiters++; error = cv_timedwait_sig(&as->as_cv, &as->as_lock, tmo); as->as_waiters--; if (error == EINTR || as->as_reset) { status = AE_ERROR; break; } if (ACPISEM_AVAIL(as, Units)) break; slptick = ticks - prevtick; if (slptick >= tmo || slptick < 0) { status = AE_TIME; break; } tmo -= slptick; } } I've observed an issue twice on my MacBookPro that some ACPI locking fails during shutdown on 9-stable and then the power-off won't complete. I've been unable to capture the full dmesg, because syslogd is killed at the moment this happens. There are two ACPI error printouts about failed locking. I see that in the case of ACPI_WAIT_FOREVER, it appears to be incorrect to catch signals, because sometimes the return argument is not checked for lock operations: ./components/utilities/utosi.c: (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); ./components/utilities/utosi.c: (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); ./components/utilities/utosi.c: (void) AcpiOsAcquireMutex (AcpiGbl_OsiMutex, ACPI_WAIT_FOREVER); Any comments? Reference: sys/dev/acpica/Osd/OsdSynch.c:AcpiOsWaitSemaphore --HPS