aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBob Moore <robert.moore@intel.com>2007-02-02 11:48:21 -0500
committerLen Brown <len.brown@intel.com>2007-02-02 21:14:27 -0500
commitd1fdda83f7c567f376ddd4305833de09f7919ca9 (patch)
tree059dccd5c38ad96a8f31bf8b45409460a02bd41f /drivers
parent9bc75cff4919f9d947982d805aed89582a20d04d (diff)
ACPICA: Fix race condition with AcpiWalkNamespace.
Fixed a problem with a possible race condition between threads executing AcpiWalkNamespace and the AML interpreter. This condition was removed by modifying AcpiWalkNamespace to (by default) ignore all temporary namespace entries created during any concurrent control method execution Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/dispatcher/dswload.c4
-rw-r--r--drivers/acpi/namespace/nsdump.c9
-rw-r--r--drivers/acpi/namespace/nssearch.c4
-rw-r--r--drivers/acpi/namespace/nswalk.c13
4 files changed, 22 insertions, 8 deletions
diff --git a/drivers/acpi/dispatcher/dswload.c b/drivers/acpi/dispatcher/dswload.c
index 565d4557d0e0..4ed08680ae7c 100644
--- a/drivers/acpi/dispatcher/dswload.c
+++ b/drivers/acpi/dispatcher/dswload.c
@@ -756,9 +756,9 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
756 flags = ACPI_NS_NO_UPSEARCH; 756 flags = ACPI_NS_NO_UPSEARCH;
757 if (walk_state->pass_number == 3) { 757 if (walk_state->pass_number == 3) {
758 758
759 /* Execution mode, node cannot already exist */ 759 /* Execution mode, node cannot already exist, node is temporary */
760 760
761 flags |= ACPI_NS_ERROR_IF_FOUND; 761 flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY);
762 } 762 }
763 763
764 /* Add new entry or lookup existing entry */ 764 /* Add new entry or lookup existing entry */
diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c
index da88834f55e7..ec5ce59acb98 100644
--- a/drivers/acpi/namespace/nsdump.c
+++ b/drivers/acpi/namespace/nsdump.c
@@ -226,6 +226,12 @@ acpi_ns_dump_one_object(acpi_handle obj_handle,
226 obj_desc = acpi_ns_get_attached_object(this_node); 226 obj_desc = acpi_ns_get_attached_object(this_node);
227 acpi_dbg_level = dbg_level; 227 acpi_dbg_level = dbg_level;
228 228
229 /* Temp nodes are those nodes created by a control method */
230
231 if (this_node->flags & ANOBJ_TEMPORARY) {
232 acpi_os_printf("(T) ");
233 }
234
229 switch (info->display_type & ACPI_DISPLAY_MASK) { 235 switch (info->display_type & ACPI_DISPLAY_MASK) {
230 case ACPI_DISPLAY_SUMMARY: 236 case ACPI_DISPLAY_SUMMARY:
231 237
@@ -623,7 +629,8 @@ acpi_ns_dump_objects(acpi_object_type type,
623 info.display_type = display_type; 629 info.display_type = display_type;
624 630
625 (void)acpi_ns_walk_namespace(type, start_handle, max_depth, 631 (void)acpi_ns_walk_namespace(type, start_handle, max_depth,
626 ACPI_NS_WALK_NO_UNLOCK, 632 ACPI_NS_WALK_NO_UNLOCK |
633 ACPI_NS_WALK_TEMP_NODES,
627 acpi_ns_dump_one_object, (void *)&info, 634 acpi_ns_dump_one_object, (void *)&info,
628 NULL); 635 NULL);
629} 636}
diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c
index 566f0a4aff93..d261c9bcd450 100644
--- a/drivers/acpi/namespace/nssearch.c
+++ b/drivers/acpi/namespace/nssearch.c
@@ -402,6 +402,10 @@ acpi_ns_search_and_enter(u32 target_name,
402 } 402 }
403#endif 403#endif
404 404
405 if (flags & ACPI_NS_TEMPORARY) {
406 new_node->flags |= ANOBJ_TEMPORARY;
407 }
408
405 /* Install the new object into the parent's list of children */ 409 /* Install the new object into the parent's list of children */
406 410
407 acpi_ns_install_node(walk_state, node, new_node, type); 411 acpi_ns_install_node(walk_state, node, new_node, type);
diff --git a/drivers/acpi/namespace/nswalk.c b/drivers/acpi/namespace/nswalk.c
index c8f6bef16ed0..a138fcb832a3 100644
--- a/drivers/acpi/namespace/nswalk.c
+++ b/drivers/acpi/namespace/nswalk.c
@@ -126,7 +126,7 @@ struct acpi_namespace_node *acpi_ns_get_next_node(acpi_object_type type,
126 * PARAMETERS: Type - acpi_object_type to search for 126 * PARAMETERS: Type - acpi_object_type to search for
127 * start_node - Handle in namespace where search begins 127 * start_node - Handle in namespace where search begins
128 * max_depth - Depth to which search is to reach 128 * max_depth - Depth to which search is to reach
129 * unlock_before_callback- Whether to unlock the NS before invoking 129 * Flags - Whether to unlock the NS before invoking
130 * the callback routine 130 * the callback routine
131 * user_function - Called when an object of "Type" is found 131 * user_function - Called when an object of "Type" is found
132 * Context - Passed to user function 132 * Context - Passed to user function
@@ -153,7 +153,7 @@ acpi_status
153acpi_ns_walk_namespace(acpi_object_type type, 153acpi_ns_walk_namespace(acpi_object_type type,
154 acpi_handle start_node, 154 acpi_handle start_node,
155 u32 max_depth, 155 u32 max_depth,
156 u8 unlock_before_callback, 156 u32 flags,
157 acpi_walk_callback user_function, 157 acpi_walk_callback user_function,
158 void *context, void **return_value) 158 void *context, void **return_value)
159{ 159{
@@ -201,12 +201,15 @@ acpi_ns_walk_namespace(acpi_object_type type,
201 child_type = child_node->type; 201 child_type = child_node->type;
202 } 202 }
203 203
204 if (child_type == type) { 204 if ((child_type == type) &&
205 (!(child_node->flags & ANOBJ_TEMPORARY) ||
206 (child_node->flags & ANOBJ_TEMPORARY)
207 && (flags & ACPI_NS_WALK_TEMP_NODES))) {
205 /* 208 /*
206 * Found a matching node, invoke the user 209 * Found a matching node, invoke the user
207 * callback function 210 * callback function
208 */ 211 */
209 if (unlock_before_callback) { 212 if (flags & ACPI_NS_WALK_UNLOCK) {
210 mutex_status = 213 mutex_status =
211 acpi_ut_release_mutex 214 acpi_ut_release_mutex
212 (ACPI_MTX_NAMESPACE); 215 (ACPI_MTX_NAMESPACE);
@@ -219,7 +222,7 @@ acpi_ns_walk_namespace(acpi_object_type type,
219 status = user_function(child_node, level, 222 status = user_function(child_node, level,
220 context, return_value); 223 context, return_value);
221 224
222 if (unlock_before_callback) { 225 if (flags & ACPI_NS_WALK_UNLOCK) {
223 mutex_status = 226 mutex_status =
224 acpi_ut_acquire_mutex 227 acpi_ut_acquire_mutex
225 (ACPI_MTX_NAMESPACE); 228 (ACPI_MTX_NAMESPACE);