From d1fdda83f7c567f376ddd4305833de09f7919ca9 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 2 Feb 2007 19:48:21 +0300 Subject: 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 Signed-off-by: Len Brown --- drivers/acpi/namespace/nsdump.c | 9 ++++++++- drivers/acpi/namespace/nssearch.c | 4 ++++ drivers/acpi/namespace/nswalk.c | 13 ++++++++----- 3 files changed, 20 insertions(+), 6 deletions(-) (limited to 'drivers/acpi/namespace') diff --git a/drivers/acpi/namespace/nsdump.c b/drivers/acpi/namespace/nsdump.c index da88834f55e..ec5ce59acb9 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, obj_desc = acpi_ns_get_attached_object(this_node); acpi_dbg_level = dbg_level; + /* Temp nodes are those nodes created by a control method */ + + if (this_node->flags & ANOBJ_TEMPORARY) { + acpi_os_printf("(T) "); + } + switch (info->display_type & ACPI_DISPLAY_MASK) { case ACPI_DISPLAY_SUMMARY: @@ -623,7 +629,8 @@ acpi_ns_dump_objects(acpi_object_type type, info.display_type = display_type; (void)acpi_ns_walk_namespace(type, start_handle, max_depth, - ACPI_NS_WALK_NO_UNLOCK, + ACPI_NS_WALK_NO_UNLOCK | + ACPI_NS_WALK_TEMP_NODES, acpi_ns_dump_one_object, (void *)&info, NULL); } diff --git a/drivers/acpi/namespace/nssearch.c b/drivers/acpi/namespace/nssearch.c index 566f0a4aff9..d261c9bcd45 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, } #endif + if (flags & ACPI_NS_TEMPORARY) { + new_node->flags |= ANOBJ_TEMPORARY; + } + /* Install the new object into the parent's list of children */ 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 c8f6bef16ed..a138fcb832a 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, * PARAMETERS: Type - acpi_object_type to search for * start_node - Handle in namespace where search begins * max_depth - Depth to which search is to reach - * unlock_before_callback- Whether to unlock the NS before invoking + * Flags - Whether to unlock the NS before invoking * the callback routine * user_function - Called when an object of "Type" is found * Context - Passed to user function @@ -153,7 +153,7 @@ acpi_status acpi_ns_walk_namespace(acpi_object_type type, acpi_handle start_node, u32 max_depth, - u8 unlock_before_callback, + u32 flags, acpi_walk_callback user_function, void *context, void **return_value) { @@ -201,12 +201,15 @@ acpi_ns_walk_namespace(acpi_object_type type, child_type = child_node->type; } - if (child_type == type) { + if ((child_type == type) && + (!(child_node->flags & ANOBJ_TEMPORARY) || + (child_node->flags & ANOBJ_TEMPORARY) + && (flags & ACPI_NS_WALK_TEMP_NODES))) { /* * Found a matching node, invoke the user * callback function */ - if (unlock_before_callback) { + if (flags & ACPI_NS_WALK_UNLOCK) { mutex_status = acpi_ut_release_mutex (ACPI_MTX_NAMESPACE); @@ -219,7 +222,7 @@ acpi_ns_walk_namespace(acpi_object_type type, status = user_function(child_node, level, context, return_value); - if (unlock_before_callback) { + if (flags & ACPI_NS_WALK_UNLOCK) { mutex_status = acpi_ut_acquire_mutex (ACPI_MTX_NAMESPACE); -- cgit v1.2.3