diff options
author | Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com> | 2007-02-15 16:12:23 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-15 16:13:16 -0500 |
commit | c0d127b56937c3e72c2b1819161d2f6718eee877 (patch) | |
tree | 40ac0fd3a628685ce25d11d1b00360344279ec5b /drivers/acpi/dispatcher | |
parent | 724339d76d9407cd1a8ad32a9c1fdf64840cc51b (diff) |
ACPICA: fix AML mutex re-entrancy
ACPI AML supports "serialized" methods which are protected
by an implicit mutex. The mutex is re-entrant for that AML thread
to allow recursion.
However, Linux implements notify() by creating a new AML thread.
So for systems where notify() re-enters a serialized method,
deadlock results.
The fix is to use the Linux thread_id as the key to allowing
re-entrancy, not the AML thread pointer.
http://bugzilla.kernel.org/show_bug.cgi?id=5534
Signed-off-by: Alexey Starikovskiy <alexey.y.starikovskiy@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/dispatcher')
-rw-r--r-- | drivers/acpi/dispatcher/dsmethod.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/acpi/dispatcher/dsmethod.c b/drivers/acpi/dispatcher/dsmethod.c index 1cbe61905824..1683e5c5b94c 100644 --- a/drivers/acpi/dispatcher/dsmethod.c +++ b/drivers/acpi/dispatcher/dsmethod.c | |||
@@ -231,10 +231,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
231 | * Obtain the method mutex if necessary. Do not acquire mutex for a | 231 | * Obtain the method mutex if necessary. Do not acquire mutex for a |
232 | * recursive call. | 232 | * recursive call. |
233 | */ | 233 | */ |
234 | if (!walk_state || | 234 | if (acpi_os_get_thread_id() != |
235 | !obj_desc->method.mutex->mutex.owner_thread || | 235 | obj_desc->method.mutex->mutex.owner_thread_id) { |
236 | (walk_state->thread != | ||
237 | obj_desc->method.mutex->mutex.owner_thread)) { | ||
238 | /* | 236 | /* |
239 | * Acquire the method mutex. This releases the interpreter if we | 237 | * Acquire the method mutex. This releases the interpreter if we |
240 | * block (and reacquires it before it returns) | 238 | * block (and reacquires it before it returns) |
@@ -248,14 +246,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node, | |||
248 | } | 246 | } |
249 | 247 | ||
250 | /* Update the mutex and walk info and save the original sync_level */ | 248 | /* Update the mutex and walk info and save the original sync_level */ |
249 | obj_desc->method.mutex->mutex.owner_thread_id = | ||
250 | acpi_os_get_thread_id(); | ||
251 | 251 | ||
252 | if (walk_state) { | 252 | if (walk_state) { |
253 | obj_desc->method.mutex->mutex. | 253 | obj_desc->method.mutex->mutex. |
254 | original_sync_level = | 254 | original_sync_level = |
255 | walk_state->thread->current_sync_level; | 255 | walk_state->thread->current_sync_level; |
256 | 256 | ||
257 | obj_desc->method.mutex->mutex.owner_thread = | ||
258 | walk_state->thread; | ||
259 | walk_state->thread->current_sync_level = | 257 | walk_state->thread->current_sync_level = |
260 | obj_desc->method.sync_level; | 258 | obj_desc->method.sync_level; |
261 | } else { | 259 | } else { |
@@ -569,7 +567,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc, | |||
569 | 567 | ||
570 | acpi_os_release_mutex(method_desc->method.mutex->mutex. | 568 | acpi_os_release_mutex(method_desc->method.mutex->mutex. |
571 | os_mutex); | 569 | os_mutex); |
572 | method_desc->method.mutex->mutex.owner_thread = NULL; | 570 | method_desc->method.mutex->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED; |
573 | } | 571 | } |
574 | } | 572 | } |
575 | 573 | ||