From owner-freebsd-current@FreeBSD.ORG Fri Jan 25 21:21:10 2013 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 53E32CD9; Fri, 25 Jan 2013 21:21:10 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from hammer.pct.niksun.com (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id CBB65A7E; Fri, 25 Jan 2013 21:21:09 +0000 (UTC) Message-ID: <5102F6F0.4000100@FreeBSD.org> Date: Fri, 25 Jan 2013 16:19:44 -0500 From: Jung-uk Kim User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130116 Thunderbird/17.0.2 MIME-Version: 1.0 To: Pawel Jakub Dawidek Subject: Re: ACPI panic on unplugging the power cord. References: <20130122175629.GA1714@garage.freebsd.pl> <51008661.4060006@FreeBSD.org> <20130124161848.GA2386@garage.freebsd.pl> <20130125092602.GB1295@garage.freebsd.pl> In-Reply-To: <20130125092602.GB1295@garage.freebsd.pl> X-Enigmail-Version: 1.4.6 Content-Type: multipart/mixed; boundary="------------000606020304020107010502" Cc: current@freebsd.org X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Jan 2013 21:21:10 -0000 This is a multi-part message in MIME format. --------------000606020304020107010502 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2013-01-25 04:26:02 -0500, Pawel Jakub Dawidek wrote: > On Thu, Jan 24, 2013 at 05:18:48PM +0100, Pawel Jakub Dawidek > wrote: >> One is when I leave laptop idle for some time (few hours?): >> >> http://people.freebsd.org/~pjd/misc/acpi_idle_panic_0.jpg >> http://people.freebsd.org/~pjd/misc/acpi_idle_panic_1.jpg > > Small update. This panic doesn't happen when the system is idle, > it happens we I close the lid to the point when display is turned > off (which is almost closed, but not entirely closed). > > Closing lid doesn't trigger suspend or anything like that. It just > turns off the display. Please try the attached patch (with my previous patch). Also, available from here: http://people.freebsd.org/~jkim/acpi_exit.diff Thanks, Jung-uk Kim -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQEcBAEBAgAGBQJRAvbwAAoJECXpabHZMqHOhkwIALmKk6ylgFwrvgTCWUZKrJXM X41gMBhbNnMoa+g/lBwxIsTxb17zXRAN2T8K6xOQZoB66vjW+ykq38SU0qQTaTLt ldihTV7xZawmMz/t5meshDZCbXUTtwOd6ChdFrjgc8+FUq+siL3mRi5UpoIk8o0k wblQ2werCGESIReW57cfGTnF+Sbfz1fBbobos+04gvs9d72FEfrsGRwSZv/wsBYP RKv2zGGWFzXSgPwYHbA+Nz1Tt36zl1npLV7mx/nijA6CNtYvL/RX4QDUTxFw2G5h Bjr3kVXTqz2ITM/K6Oajel6HE1utYDEMgBUL3kaEKdmxK2cguZmcP3p04f1XzRw= =AUMk -----END PGP SIGNATURE----- --------------000606020304020107010502 Content-Type: text/x-patch; name="acpi_exit.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="acpi_exit.diff" Index: sys/contrib/dev/acpica/include/acoutput.h =================================================================== --- sys/contrib/dev/acpica/include/acoutput.h (revision 245916) +++ sys/contrib/dev/acpica/include/acoutput.h (working copy) @@ -329,9 +329,9 @@ /* Helper macro */ -#define ACPI_TRACE_ENTRY(Name, Function, Cast, Param) \ +#define ACPI_TRACE_ENTRY(Name, Function, Type, Param) \ ACPI_FUNCTION_NAME (Name) \ - Function (ACPI_DEBUG_PARAMETERS, Cast (Param)) + Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)) /* The actual entry trace macros */ @@ -340,13 +340,13 @@ AcpiUtTrace (ACPI_DEBUG_PARAMETERS) #define ACPI_FUNCTION_TRACE_PTR(Name, Pointer) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, (void *), Pointer) + ACPI_TRACE_ENTRY (Name, AcpiUtTracePtr, void *, Pointer) #define ACPI_FUNCTION_TRACE_U32(Name, Value) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, (UINT32), Value) + ACPI_TRACE_ENTRY (Name, AcpiUtTraceU32, UINT32, Value) #define ACPI_FUNCTION_TRACE_STR(Name, String) \ - ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, (char *), String) + ACPI_TRACE_ENTRY (Name, AcpiUtTraceStr, char *, String) #define ACPI_FUNCTION_ENTRY() \ AcpiUtTrackStackPtr() @@ -361,16 +361,37 @@ * * One of the FUNCTION_TRACE macros above must be used in conjunction * with these macros so that "_AcpiFunctionName" is defined. + * + * There are two versions of most of the return macros. The default version is + * safer, since it avoids side-effects by guaranteeing that the argument will + * not be evaluated twice. + * + * A less-safe version of the macros is provided for optional use if the + * compiler uses excessive CPU stack (for example, this may happen in the + * debug case if code optimzation is disabled.) */ /* Exit trace helper macro */ -#define ACPI_TRACE_EXIT(Function, Cast, Param) \ +#ifndef ACPI_SIMPLE_RETURN_MACROS + +#define ACPI_TRACE_EXIT(Function, Type, Param) \ ACPI_DO_WHILE0 ({ \ - Function (ACPI_DEBUG_PARAMETERS, Cast (Param)); \ - return ((Param)); \ + register Type _Param = (Type) (Param); \ + Function (ACPI_DEBUG_PARAMETERS, _Param); \ + return (_Param); \ }) +#else /* Use original less-safe macros */ + +#define ACPI_TRACE_EXIT(Function, Type, Param) \ + ACPI_DO_WHILE0 ({ \ + Function (ACPI_DEBUG_PARAMETERS, (Type) (Param)); \ + return (Param); \ + }) + +#endif /* ACPI_SIMPLE_RETURN_MACROS */ + /* The actual exit macros */ #define return_VOID \ @@ -380,13 +401,13 @@ }) #define return_ACPI_STATUS(Status) \ - ACPI_TRACE_EXIT (AcpiUtStatusExit, (ACPI_STATUS), Status) + ACPI_TRACE_EXIT (AcpiUtStatusExit, ACPI_STATUS, Status) #define return_PTR(Pointer) \ - ACPI_TRACE_EXIT (AcpiUtPtrExit, (UINT8 *), Pointer) + ACPI_TRACE_EXIT (AcpiUtPtrExit, void *, Pointer) #define return_VALUE(Value) \ - ACPI_TRACE_EXIT (AcpiUtValueExit, (UINT64), Value) + ACPI_TRACE_EXIT (AcpiUtValueExit, UINT64, Value) /* Conditional execution */ --------------000606020304020107010502--