Lines Matching full:mutex
4 * Module Name: exmutex - ASL Mutex Acquire/Release functions
27 * PARAMETERS: obj_desc - The mutex to be unlinked
31 * DESCRIPTION: Remove a mutex from the "AcquiredMutex" list
37 struct acpi_thread_state *thread = obj_desc->mutex.owner_thread; in acpi_ex_unlink_mutex()
45 if (obj_desc->mutex.next) { in acpi_ex_unlink_mutex()
46 (obj_desc->mutex.next)->mutex.prev = obj_desc->mutex.prev; in acpi_ex_unlink_mutex()
49 if (obj_desc->mutex.prev) { in acpi_ex_unlink_mutex()
50 (obj_desc->mutex.prev)->mutex.next = obj_desc->mutex.next; in acpi_ex_unlink_mutex()
53 * Migrate the previous sync level associated with this mutex to in acpi_ex_unlink_mutex()
54 * the previous mutex on the list so that it may be preserved. in acpi_ex_unlink_mutex()
58 (obj_desc->mutex.prev)->mutex.original_sync_level = in acpi_ex_unlink_mutex()
59 obj_desc->mutex.original_sync_level; in acpi_ex_unlink_mutex()
61 thread->acquired_mutex_list = obj_desc->mutex.next; in acpi_ex_unlink_mutex()
69 * PARAMETERS: obj_desc - The mutex to be linked
74 * DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk
88 obj_desc->mutex.prev = NULL; in acpi_ex_link_mutex()
89 obj_desc->mutex.next = list_head; in acpi_ex_link_mutex()
94 list_head->mutex.prev = obj_desc; in acpi_ex_link_mutex()
107 * obj_desc - Mutex object
112 * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common
115 * MUTEX: Interpreter must be locked
140 if (obj_desc->mutex.thread_id == thread_id) { in acpi_ex_acquire_mutex_object()
142 * The mutex is already owned by this thread, just increment the in acpi_ex_acquire_mutex_object()
145 obj_desc->mutex.acquisition_depth++; in acpi_ex_acquire_mutex_object()
149 /* Acquire the mutex, wait if necessary. Special case for Global Lock */ in acpi_ex_acquire_mutex_object()
155 acpi_ex_system_wait_mutex(obj_desc->mutex.os_mutex, in acpi_ex_acquire_mutex_object()
166 /* Acquired the mutex: update mutex object */ in acpi_ex_acquire_mutex_object()
168 obj_desc->mutex.thread_id = thread_id; in acpi_ex_acquire_mutex_object()
169 obj_desc->mutex.acquisition_depth = 1; in acpi_ex_acquire_mutex_object()
170 obj_desc->mutex.original_sync_level = 0; in acpi_ex_acquire_mutex_object()
171 obj_desc->mutex.owner_thread = NULL; /* Used only for AML Acquire() */ in acpi_ex_acquire_mutex_object()
181 * obj_desc - Mutex object
186 * DESCRIPTION: Acquire an AML mutex
207 "Cannot acquire Mutex [%4.4s], null thread info", in acpi_ex_acquire_mutex()
208 acpi_ut_get_node_name(obj_desc->mutex.node))); in acpi_ex_acquire_mutex()
214 * of the mutex. This mechanism provides some deadlock prevention. in acpi_ex_acquire_mutex()
216 if (walk_state->thread->current_sync_level > obj_desc->mutex.sync_level) { in acpi_ex_acquire_mutex()
218 "Cannot acquire Mutex [%4.4s], " in acpi_ex_acquire_mutex()
220 acpi_ut_get_node_name(obj_desc->mutex.node), in acpi_ex_acquire_mutex()
226 "Acquiring: Mutex SyncLevel %u, Thread SyncLevel %u, " in acpi_ex_acquire_mutex()
228 obj_desc->mutex.sync_level, in acpi_ex_acquire_mutex()
230 obj_desc->mutex.acquisition_depth, in acpi_ex_acquire_mutex()
237 if (ACPI_SUCCESS(status) && obj_desc->mutex.acquisition_depth == 1) { in acpi_ex_acquire_mutex()
241 obj_desc->mutex.owner_thread = walk_state->thread; in acpi_ex_acquire_mutex()
242 obj_desc->mutex.original_sync_level = in acpi_ex_acquire_mutex()
245 obj_desc->mutex.sync_level; in acpi_ex_acquire_mutex()
247 /* Link the mutex to the current thread for force-unlock at method exit */ in acpi_ex_acquire_mutex()
253 "Acquired: Mutex SyncLevel %u, Thread SyncLevel %u, Depth %u\n", in acpi_ex_acquire_mutex()
254 obj_desc->mutex.sync_level, in acpi_ex_acquire_mutex()
256 obj_desc->mutex.acquisition_depth)); in acpi_ex_acquire_mutex()
269 * DESCRIPTION: Release a previously acquired Mutex, low level interface.
273 * MUTEX: Interpreter must be locked
289 if (obj_desc->mutex.acquisition_depth == 0) { in acpi_ex_release_mutex_object()
295 obj_desc->mutex.acquisition_depth--; in acpi_ex_release_mutex_object()
296 if (obj_desc->mutex.acquisition_depth != 0) { in acpi_ex_release_mutex_object()
303 if (obj_desc->mutex.owner_thread) { in acpi_ex_release_mutex_object()
305 /* Unlink the mutex from the owner's list */ in acpi_ex_release_mutex_object()
308 obj_desc->mutex.owner_thread = NULL; in acpi_ex_release_mutex_object()
311 /* Release the mutex, special case for Global Lock */ in acpi_ex_release_mutex_object()
316 acpi_os_release_mutex(obj_desc->mutex.os_mutex); in acpi_ex_release_mutex_object()
319 /* Clear mutex info */ in acpi_ex_release_mutex_object()
321 obj_desc->mutex.thread_id = 0; in acpi_ex_release_mutex_object()
334 * DESCRIPTION: Release a previously acquired Mutex.
352 owner_thread = obj_desc->mutex.owner_thread; in acpi_ex_release_mutex()
354 /* The mutex must have been previously acquired in order to release it */ in acpi_ex_release_mutex()
358 "Cannot release Mutex [%4.4s], not acquired", in acpi_ex_release_mutex()
359 acpi_ut_get_node_name(obj_desc->mutex.node))); in acpi_ex_release_mutex()
367 "Cannot release Mutex [%4.4s], null thread info", in acpi_ex_release_mutex()
368 acpi_ut_get_node_name(obj_desc->mutex.node))); in acpi_ex_release_mutex()
373 * The Mutex is owned, but this thread must be the owner. in acpi_ex_release_mutex()
379 "Thread %u cannot release Mutex [%4.4s] acquired by thread %u", in acpi_ex_release_mutex()
381 acpi_ut_get_node_name(obj_desc->mutex.node), in acpi_ex_release_mutex()
387 * The sync level of the mutex must be equal to the current sync level. In in acpi_ex_release_mutex()
388 * other words, the current level means that at least one mutex at that in acpi_ex_release_mutex()
389 * level is currently being held. Attempting to release a mutex of a in acpi_ex_release_mutex()
390 * different level can only mean that the mutex ordering rule is being in acpi_ex_release_mutex()
393 if (obj_desc->mutex.sync_level != owner_thread->current_sync_level) { in acpi_ex_release_mutex()
395 "Cannot release Mutex [%4.4s], SyncLevel mismatch: " in acpi_ex_release_mutex()
396 "mutex %u current %u", in acpi_ex_release_mutex()
397 acpi_ut_get_node_name(obj_desc->mutex.node), in acpi_ex_release_mutex()
398 obj_desc->mutex.sync_level, in acpi_ex_release_mutex()
404 * Get the previous sync_level from the head of the acquired mutex list. in acpi_ex_release_mutex()
409 owner_thread->acquired_mutex_list->mutex.original_sync_level; in acpi_ex_release_mutex()
414 obj_desc->mutex.sync_level, in acpi_ex_release_mutex()
417 obj_desc->mutex.acquisition_depth, in acpi_ex_release_mutex()
425 if (obj_desc->mutex.acquisition_depth == 0) { in acpi_ex_release_mutex()
435 obj_desc->mutex.sync_level, in acpi_ex_release_mutex()
438 obj_desc->mutex.acquisition_depth)); in acpi_ex_release_mutex()
456 * method to acquire a mutex, and a different method to release it, as long as
473 "Mutex [%4.4s] force-release, SyncLevel %u Depth %u\n", in acpi_ex_release_all_mutexes()
474 obj_desc->mutex.node->name.ascii, in acpi_ex_release_all_mutexes()
475 obj_desc->mutex.sync_level, in acpi_ex_release_all_mutexes()
476 obj_desc->mutex.acquisition_depth)); in acpi_ex_release_all_mutexes()
478 /* Release the mutex, special case for Global Lock */ in acpi_ex_release_all_mutexes()
486 acpi_os_release_mutex(obj_desc->mutex.os_mutex); in acpi_ex_release_all_mutexes()
489 /* Update Thread sync_level (Last mutex is the important one) */ in acpi_ex_release_all_mutexes()
492 obj_desc->mutex.original_sync_level; in acpi_ex_release_all_mutexes()
494 /* Mark mutex unowned */ in acpi_ex_release_all_mutexes()
496 next = obj_desc->mutex.next; in acpi_ex_release_all_mutexes()
498 obj_desc->mutex.prev = NULL; in acpi_ex_release_all_mutexes()
499 obj_desc->mutex.next = NULL; in acpi_ex_release_all_mutexes()
500 obj_desc->mutex.acquisition_depth = 0; in acpi_ex_release_all_mutexes()
501 obj_desc->mutex.owner_thread = NULL; in acpi_ex_release_all_mutexes()
502 obj_desc->mutex.thread_id = 0; in acpi_ex_release_all_mutexes()