summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2013-05-03 09:14:52 -0700
committerRobert Moore <Robert.Moore@intel.com>2013-05-03 09:14:52 -0700
commitba84d0fc18ba910a47a3f71c68a43543c06e6831 (patch)
treef4099d8a16b4e59367eb80257fb9e737b574829c
parentd6c105ae00a48d58787f872228e2ff529097a02d (diff)
iASL: If a non-serialized method creates named objects, issue remark.
If a thread blocks within the method for any reason, and another thread enters the method, the method will fail because an attempt will be made to create the same (named) object twice. In this case, issue a remark that the method should be marked serialized. ACPICA BZ 909.
-rw-r--r--source/compiler/asllisting.c3
-rw-r--r--source/compiler/aslmessages.h2
-rw-r--r--source/compiler/aslmethod.c71
-rw-r--r--source/compiler/asltypes.h11
4 files changed, 81 insertions, 6 deletions
diff --git a/source/compiler/asllisting.c b/source/compiler/asllisting.c
index ac62ab32a..3d0f85d31 100644
--- a/source/compiler/asllisting.c
+++ b/source/compiler/asllisting.c
@@ -339,9 +339,10 @@ LsTreeWriteWalk (
DbgPrint (ASL_TREE_OUTPUT,
"%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
+
UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
- DbgPrint (ASL_TREE_OUTPUT, "\n");
+ DbgPrint (ASL_TREE_OUTPUT, " (%.4X)\n", Op->Asl.ParseOpcode);
return (AE_OK);
}
diff --git a/source/compiler/aslmessages.h b/source/compiler/aslmessages.h
index b5c4d1246..3915739f2 100644
--- a/source/compiler/aslmessages.h
+++ b/source/compiler/aslmessages.h
@@ -252,6 +252,7 @@ typedef enum
ASL_MSG_SCOPE_TYPE,
ASL_MSG_SEEK,
ASL_MSG_SERIALIZED,
+ ASL_MSG_SERIALIZED_REQUIRED,
ASL_MSG_SINGLE_NAME_OPTIMIZATION,
ASL_MSG_SOME_NO_RETVAL,
ASL_MSG_STRING_LENGTH,
@@ -430,6 +431,7 @@ char *AslMessages [] = {
/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
/* ASL_MSG_SEEK */ "Could not seek file",
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
+/* ASL_MSG_SERIALIZED_REQUIRED */ "Control Method should be made Serialized",
/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
/* ASL_MSG_STRING_LENGTH */ "String literal too long",
diff --git a/source/compiler/aslmethod.c b/source/compiler/aslmethod.c
index 728694b59..f7b82d320 100644
--- a/source/compiler/aslmethod.c
+++ b/source/compiler/aslmethod.c
@@ -116,12 +116,22 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include "acparser.h"
+#include "amlcode.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslmethod")
+/* Local prototypes */
+
+void
+MtCheckNamedObjectInMethod (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_METHOD_INFO *MethodInfo);
+
+
/*******************************************************************************
*
* FUNCTION: MtMethodAnalysisWalkBegin
@@ -183,6 +193,8 @@ MtMethodAnalysisWalkBegin (
/* Get the SerializeRule and SyncLevel nodes, ignored here */
Next = Next->Asl.Next;
+ MethodInfo->ShouldBeSerialized = (UINT8) Next->Asl.Value.Integer;
+
Next = Next->Asl.Next;
ArgNode = Next;
@@ -479,12 +491,71 @@ MtMethodAnalysisWalkBegin (
break;
}
+ /* Check for named object creation within a non-serialized method */
+
+ MtCheckNamedObjectInMethod (Op, MethodInfo);
return (AE_OK);
}
/*******************************************************************************
*
+ * FUNCTION: MtCheckNamedObjectInMethod
+ *
+ * PARAMETERS: Op - Current parser op
+ * MethodInfo - Info for method being parsed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Detect if a non-serialized method is creating a named object,
+ * which could possibly cause problems if two threads execute
+ * the method concurrently. Emit a remark in this case.
+ *
+ ******************************************************************************/
+
+void
+MtCheckNamedObjectInMethod (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_METHOD_INFO *MethodInfo)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ /* We don't care about actual method declarations */
+
+ if (Op->Asl.AmlOpcode == AML_METHOD_OP)
+ {
+ return;
+ }
+
+ /* Determine if we are creating a named object */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+ if (OpInfo->Class == AML_CLASS_NAMED_OBJECT)
+ {
+ /*
+ * If we have a named object created within a non-serialized method,
+ * emit a remark that the method should be serialized.
+ *
+ * Reason: If a thread blocks within the method for any reason, and
+ * another thread enters the method, the method will fail because an
+ * attempt will be made to create the same object twice.
+ */
+ if (MethodInfo && !MethodInfo->ShouldBeSerialized)
+ {
+ AslError (ASL_REMARK, ASL_MSG_SERIALIZED_REQUIRED, MethodInfo->Op,
+ "due to creation of named objects within");
+
+ /* Emit message only ONCE per method */
+
+ MethodInfo->ShouldBeSerialized = TRUE;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: MtMethodAnalysisWalkEnd
*
* PARAMETERS: ASL_WALK_CALLBACK
diff --git a/source/compiler/asltypes.h b/source/compiler/asltypes.h
index cd556bbae..aa6c90b10 100644
--- a/source/compiler/asltypes.h
+++ b/source/compiler/asltypes.h
@@ -153,16 +153,17 @@
typedef struct asl_method_info
{
- UINT8 NumArguments;
- UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS];
- UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS];
+ ACPI_PARSE_OBJECT *Op;
+ struct asl_method_info *Next;
UINT32 ValidArgTypes[ACPI_METHOD_NUM_ARGS];
UINT32 ValidReturnTypes;
UINT32 NumReturnNoValue;
UINT32 NumReturnWithValue;
- ACPI_PARSE_OBJECT *Op;
- struct asl_method_info *Next;
+ UINT8 NumArguments;
+ UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS];
+ UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS];
UINT8 HasBeenTyped;
+ UINT8 ShouldBeSerialized;
} ASL_METHOD_INFO;