Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Jan 2013 16:19:44 -0500
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        Pawel Jakub Dawidek <pjd@freebsd.org>
Cc:        current@freebsd.org
Subject:   Re: ACPI panic on unplugging the power cord.
Message-ID:  <5102F6F0.4000100@FreeBSD.org>
In-Reply-To: <20130125092602.GB1295@garage.freebsd.pl>
References:  <20130122175629.GA1714@garage.freebsd.pl> <51008661.4060006@FreeBSD.org> <20130124161848.GA2386@garage.freebsd.pl> <20130125092602.GB1295@garage.freebsd.pl>

next in thread | previous in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5102F6F0.4000100>