Lines Matching full:proc
15 * 1) proc->outer_lock : protects binder_ref
21 * 3) proc->inner_lock : protects the thread and node lists
22 * (proc->threads, proc->waiting_threads, proc->nodes)
24 * (proc->todo, thread->todo, proc->delivered_death and
37 * foo_ilocked() : requires proc->inner_lock
38 * foo_oilocked(): requires proc->outer_lock and proc->inner_lock
39 * foo_nilocked(): requires node->lock and proc->inner_lock
92 DEFINE_SHOW_ATTRIBUTE(proc);
263 * @proc: struct binder_proc to acquire
265 * Acquires proc->outer_lock. Used to protect binder_ref
266 * structures associated with the given proc.
268 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
270 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
271 __acquires(&proc->outer_lock) in _binder_proc_lock()
275 spin_lock(&proc->outer_lock); in _binder_proc_lock()
280 * @proc: struct binder_proc to acquire
286 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
287 __releases(&proc->outer_lock) in _binder_proc_unlock()
291 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
296 * @proc: struct binder_proc to acquire
298 * Acquires proc->inner_lock. Used to protect todo lists
300 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
302 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
303 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
307 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
312 * @proc: struct binder_proc to acquire
316 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
318 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
319 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
323 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
362 * Acquires node->lock. If node->proc also acquires
363 * proc->inner_lock. Used to protect binder_node fields
368 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
373 if (node->proc) in _binder_node_inner_lock()
374 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
377 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
389 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
391 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
395 if (proc) in _binder_node_inner_unlock()
396 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
399 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
410 * @proc: binder_proc associated with list
415 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
420 binder_inner_proc_lock(proc); in binder_worklist_empty()
422 binder_inner_proc_unlock(proc); in binder_worklist_empty()
434 * Requires the proc->inner_lock to be held.
454 * Requires the proc->inner_lock to be held.
472 * Requires the proc->inner_lock to be held.
495 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
497 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
508 * @proc: binder_proc associated with list
515 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
517 binder_inner_proc_lock(proc); in binder_dequeue_work()
519 binder_inner_proc_unlock(proc); in binder_dequeue_work()
534 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
536 static void binder_free_proc(struct binder_proc *proc);
545 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
552 binder_inner_proc_lock(thread->proc); in binder_has_work()
554 binder_inner_proc_unlock(thread->proc); in binder_has_work()
567 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
573 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
586 * binder_select_thread_ilocked() - selects a thread for doing proc work.
587 * @proc: process to select a thread from
598 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
602 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
603 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
614 * binder_wakeup_thread_ilocked() - wakes up a thread for doing proc work.
615 * @proc: process to wake up a thread in
619 * This function wakes up a thread in the @proc process.
629 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
633 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
643 /* Didn't find a thread waiting for proc work; this can happen in binder_wakeup_thread_ilocked()
656 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
659 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
661 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
663 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
684 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
687 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
690 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
712 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
717 binder_inner_proc_lock(proc); in binder_get_node()
718 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
719 binder_inner_proc_unlock(proc); in binder_get_node()
724 struct binder_proc *proc, in binder_init_node_ilocked() argument
728 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
735 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
760 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
762 node->proc = proc; in binder_init_node_ilocked()
774 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
780 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
788 binder_inner_proc_lock(proc); in binder_new_node()
789 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
790 binder_inner_proc_unlock(proc); in binder_new_node()
810 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
813 if (proc) in binder_inc_node_nilocked()
814 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
819 !(node->proc && in binder_inc_node_nilocked()
820 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
870 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
873 if (proc) in binder_dec_node_nilocked()
874 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
890 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
892 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
893 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
898 if (proc) { in binder_dec_node_nilocked()
900 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
956 * (node->proc is NULL), use binder_dead_nodes_lock to protect
964 if (node->proc) in binder_inc_node_tmpref()
965 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
969 if (node->proc) in binder_inc_node_tmpref()
970 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
987 if (!node->proc) in binder_dec_node_tmpref()
993 if (!node->proc) in binder_dec_node_tmpref()
1014 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1017 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1039 * @proc: binder_proc that owns the ref
1047 * into the given proc rb_trees and node refs list.
1056 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1060 struct binder_context *context = proc->context; in binder_get_ref_for_node_olocked()
1061 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1082 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1085 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1088 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node_olocked()
1095 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1108 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1115 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1127 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1130 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1131 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1155 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1157 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1169 * Increment the ref. @ref->proc->outer_lock must be held on entry
1210 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1221 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1236 * binder_get_node_from_ref() - get the node from the given proc/desc
1237 * @proc: proc containing the ref
1242 * Given a proc and ref handle, return the associated binder_node
1247 struct binder_proc *proc, in binder_get_node_from_ref() argument
1254 binder_proc_lock(proc); in binder_get_node_from_ref()
1255 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1266 binder_proc_unlock(proc); in binder_get_node_from_ref()
1271 binder_proc_unlock(proc); in binder_get_node_from_ref()
1292 * @proc: proc containing the ref
1298 * Given a proc and ref handle, increment or decrement the ref
1303 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1311 binder_proc_lock(proc); in binder_update_ref_for_handle()
1312 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1324 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1331 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1337 * @proc: proc containing the ref
1346 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1349 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1354 * binder_inc_ref_for_node() - increment the ref for given proc/node
1355 * @proc: proc containing the ref
1361 * Given a proc and node, increment the ref. Create the ref if it
1366 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1376 binder_proc_lock(proc); in binder_inc_ref_for_node()
1377 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1379 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1383 binder_proc_lock(proc); in binder_inc_ref_for_node()
1384 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1400 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1414 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1440 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1443 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1447 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1451 * binder_proc_dec_tmpref() - decrement proc->tmp_ref
1452 * @proc: proc to decrement
1455 * handle a transaction. proc->tmp_ref is incremented when
1459 * proc if appropriate (proc has been released, all threads have
1462 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1464 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1465 proc->tmp_ref--; in binder_proc_dec_tmpref()
1466 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1467 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1468 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1469 binder_free_proc(proc); in binder_proc_dec_tmpref()
1472 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1502 * Same as binder_get_txn_from() except it also acquires the proc->inner_lock
1511 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1517 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1520 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1525 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1526 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1559 from_proc = t->from ? t->from->proc->pid : 0; in binder_txn_latency_free()
1608 target_thread->proc->pid, in binder_send_failed_reply()
1628 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
1633 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
1675 * @proc: binder_proc owning the buffer
1689 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
1706 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
1741 * @proc: binder_proc owning the buffer
1762 struct binder_proc *proc, in binder_validate_ptr() argument
1778 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
1782 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
1793 * @proc: binder_proc owning the buffer
1830 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
1847 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
1863 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
1934 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
1945 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
1962 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
1965 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
1980 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2000 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2050 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2091 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2119 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2124 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2126 node = binder_new_node(proc, fp); in binder_translate_binder()
2132 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2138 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2171 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2177 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2181 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2184 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2190 if (node->proc == target_proc) { in binder_translate_handle()
2197 if (node->proc) in binder_translate_handle()
2198 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2200 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2204 if (node->proc) in binder_translate_handle()
2205 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2207 __release(&node->proc->inner_lock); in binder_translate_handle()
2245 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2258 proc->pid, thread->pid, in binder_translate_fd()
2268 proc->pid, thread->pid, fd); in binder_translate_fd()
2272 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2559 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2568 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2575 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2593 proc->pid, thread->pid); in binder_translate_fd_array()
2626 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
2640 proc->pid, thread->pid); in binder_fixup_parent()
2649 proc->pid, thread->pid); in binder_fixup_parent()
2657 proc->pid, thread->pid); in binder_fixup_parent()
2695 * Requires the proc->inner_lock to be held.
2718 * @proc: process to send the transaction to
2719 * @thread: thread in @proc to send the transaction to (may be NULL)
2723 * wake it up. If no thread is found, the work is queued to the proc
2734 struct binder_proc *proc, in binder_proc_transaction() argument
2752 binder_inner_proc_lock(proc); in binder_proc_transaction()
2753 if (proc->is_frozen) { in binder_proc_transaction()
2754 proc->sync_recv |= !oneway; in binder_proc_transaction()
2755 proc->async_recv |= oneway; in binder_proc_transaction()
2758 if ((proc->is_frozen && !oneway) || proc->is_dead || in binder_proc_transaction()
2760 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2762 return proc->is_frozen ? BR_FROZEN_REPLY : BR_DEAD_REPLY; in binder_proc_transaction()
2766 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
2771 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
2773 if ((t->flags & TF_UPDATE_TXN) && proc->is_frozen) { in binder_proc_transaction()
2781 proc->outstanding_txns--; in binder_proc_transaction()
2788 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
2790 proc->outstanding_txns++; in binder_proc_transaction()
2791 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2804 binder_transaction_buffer_release(proc, NULL, buffer, 0, 0); in binder_proc_transaction()
2805 binder_alloc_free_buf(&proc->alloc, buffer); in binder_proc_transaction()
2816 * @proc: returns @node->proc if valid
2817 * @error: if no @proc then returns BR_DEAD_REPLY
2827 * the transaction. We also need a tmpref on the proc while we are
2830 * Return: The target_node with refs taken or NULL if no @node->proc is NULL.
2831 * Also sets @proc if valid. If the @node->proc is NULL indicating that the
2832 * target proc has died, @error is set to BR_DEAD_REPLY
2842 if (node->proc) { in binder_get_node_refs_for_txn()
2846 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
2847 *procp = node->proc; in binder_get_node_refs_for_txn()
2862 __release(&from->proc->inner_lock); in binder_set_txn_from_error()
2869 binder_inner_proc_unlock(from->proc); in binder_set_txn_from_error()
2873 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
2897 struct binder_context *context = proc->context; in binder_transaction()
2911 e->from_proc = proc->pid; in binder_transaction()
2916 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
2918 binder_inner_proc_lock(proc); in binder_transaction()
2920 binder_inner_proc_unlock(proc); in binder_transaction()
2923 binder_inner_proc_lock(proc); in binder_transaction()
2926 binder_inner_proc_unlock(proc); in binder_transaction()
2928 proc->pid, thread->pid); in binder_transaction()
2937 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
2943 binder_inner_proc_unlock(proc); in binder_transaction()
2951 binder_inner_proc_unlock(proc); in binder_transaction()
2956 __release(&target_thread->proc->inner_lock); in binder_transaction()
2958 thread->pid, proc->pid); in binder_transaction()
2965 proc->pid, thread->pid, in binder_transaction()
2969 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
2977 target_proc = target_thread->proc; in binder_transaction()
2979 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
2991 binder_proc_lock(proc); in binder_transaction()
2992 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3000 proc->pid, thread->pid, tr->target.handle); in binder_transaction()
3003 binder_proc_unlock(proc); in binder_transaction()
3014 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3016 proc->pid, thread->pid); in binder_transaction()
3025 thread->pid, proc->pid); in binder_transaction()
3034 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3036 thread->pid, proc->pid); in binder_transaction()
3042 if (security_binder_transaction(proc->cred, in binder_transaction()
3045 thread->pid, proc->pid); in binder_transaction()
3051 binder_inner_proc_lock(proc); in binder_transaction()
3062 * thread from proc->waiting_threads to enqueue in binder_transaction()
3067 proc->pid, thread->pid); in binder_transaction()
3068 binder_inner_proc_unlock(proc); in binder_transaction()
3082 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3087 binder_inner_proc_unlock(proc); in binder_transaction()
3098 if (from && from->proc == target_proc) { in binder_transaction()
3108 binder_inner_proc_unlock(proc); in binder_transaction()
3118 thread->pid, proc->pid); in binder_transaction()
3131 thread->pid, proc->pid); in binder_transaction()
3144 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3153 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3164 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3175 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3179 thread->pid, proc->pid); in binder_transaction()
3189 thread->pid, proc->pid); in binder_transaction()
3251 proc->pid, thread->pid); in binder_transaction()
3259 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3267 proc->pid, thread->pid, in binder_transaction()
3295 thread->pid, proc->pid); in binder_transaction()
3314 proc->pid, thread->pid); in binder_transaction()
3324 proc->pid, thread->pid, in binder_transaction()
3355 thread->pid, proc->pid); in binder_transaction()
3374 thread->pid, proc->pid); in binder_transaction()
3396 thread->pid, proc->pid); in binder_transaction()
3420 proc->pid, thread->pid); in binder_transaction()
3433 proc->pid, thread->pid); in binder_transaction()
3444 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3448 proc->pid, thread->pid, in binder_transaction()
3467 thread->pid, proc->pid); in binder_transaction()
3485 proc->pid, thread->pid); in binder_transaction()
3496 thread->pid, proc->pid); in binder_transaction()
3502 /* Fixup buffer pointer to target proc address space */ in binder_transaction()
3521 thread->pid, proc->pid); in binder_transaction()
3532 proc->pid, thread->pid, hdr->type); in binder_transaction()
3546 proc->pid, thread->pid); in binder_transaction()
3557 proc->pid, thread->pid); in binder_transaction()
3586 binder_inner_proc_lock(proc); in binder_transaction()
3598 binder_inner_proc_unlock(proc); in binder_transaction()
3602 binder_inner_proc_lock(proc); in binder_transaction()
3604 binder_inner_proc_unlock(proc); in binder_transaction()
3630 thread->pid, proc->pid); in binder_transaction()
3632 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3673 proc->pid, thread->pid, reply ? "reply" : in binder_transaction()
3711 binder_inner_proc_lock(proc); in binder_transaction()
3714 binder_inner_proc_unlock(proc); in binder_transaction()
3722 * @proc: binder proc that owns buffer
3732 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
3736 binder_inner_proc_lock(proc); in binder_free_buf()
3741 binder_inner_proc_unlock(proc); in binder_free_buf()
3749 BUG_ON(buf_node->proc != proc); in binder_free_buf()
3756 w, &proc->todo); in binder_free_buf()
3757 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
3762 binder_transaction_buffer_release(proc, thread, buffer, 0, is_failure); in binder_free_buf()
3763 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
3766 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
3772 struct binder_context *context = proc->context; in binder_thread_write()
3786 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
3811 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
3813 proc->pid, thread->pid); in binder_thread_write()
3818 proc, ctx_mgr_node, in binder_thread_write()
3825 proc, target, increment, strong, in binder_thread_write()
3829 proc->pid, thread->pid, in binder_thread_write()
3849 proc->pid, thread->pid, debug_string, in binder_thread_write()
3855 proc->pid, thread->pid, debug_string, in binder_thread_write()
3873 node = binder_get_node(proc, node_ptr); in binder_thread_write()
3876 proc->pid, thread->pid, in binder_thread_write()
3885 proc->pid, thread->pid, in binder_thread_write()
3897 proc->pid, thread->pid, in binder_thread_write()
3907 proc->pid, thread->pid, in binder_thread_write()
3920 proc->pid, thread->pid, in binder_thread_write()
3943 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
3949 proc->pid, thread->pid, in binder_thread_write()
3954 proc->pid, thread->pid, in binder_thread_write()
3961 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
3964 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
3975 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
3986 binder_transaction(proc, thread, &tr, in binder_thread_write()
3994 proc->pid, thread->pid); in binder_thread_write()
3995 binder_inner_proc_lock(proc); in binder_thread_write()
3999 proc->pid, thread->pid); in binder_thread_write()
4000 } else if (proc->requested_threads == 0) { in binder_thread_write()
4003 proc->pid, thread->pid); in binder_thread_write()
4005 proc->requested_threads--; in binder_thread_write()
4006 proc->requested_threads_started++; in binder_thread_write()
4009 binder_inner_proc_unlock(proc); in binder_thread_write()
4014 proc->pid, thread->pid); in binder_thread_write()
4018 proc->pid, thread->pid); in binder_thread_write()
4025 proc->pid, thread->pid); in binder_thread_write()
4058 proc->pid, thread->pid); in binder_thread_write()
4062 binder_proc_lock(proc); in binder_thread_write()
4063 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4066 proc->pid, thread->pid, in binder_thread_write()
4071 binder_proc_unlock(proc); in binder_thread_write()
4078 proc->pid, thread->pid, in binder_thread_write()
4090 proc->pid, thread->pid); in binder_thread_write()
4092 binder_proc_unlock(proc); in binder_thread_write()
4100 if (ref->node->proc == NULL) { in binder_thread_write()
4103 binder_inner_proc_lock(proc); in binder_thread_write()
4105 &ref->death->work, &proc->todo); in binder_thread_write()
4106 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4107 binder_inner_proc_unlock(proc); in binder_thread_write()
4112 proc->pid, thread->pid); in binder_thread_write()
4114 binder_proc_unlock(proc); in binder_thread_write()
4120 proc->pid, thread->pid, in binder_thread_write()
4124 binder_proc_unlock(proc); in binder_thread_write()
4128 binder_inner_proc_lock(proc); in binder_thread_write()
4140 &proc->todo); in binder_thread_write()
4142 proc); in binder_thread_write()
4148 binder_inner_proc_unlock(proc); in binder_thread_write()
4151 binder_proc_unlock(proc); in binder_thread_write()
4162 binder_inner_proc_lock(proc); in binder_thread_write()
4163 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4177 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4181 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4182 binder_inner_proc_unlock(proc); in binder_thread_write()
4196 &proc->todo); in binder_thread_write()
4197 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4200 binder_inner_proc_unlock(proc); in binder_thread_write()
4205 proc->pid, thread->pid, cmd); in binder_thread_write()
4213 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4219 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4224 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4246 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4248 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4259 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4262 binder_inner_proc_lock(proc); in binder_wait_for_work()
4269 &proc->waiting_threads); in binder_wait_for_work()
4270 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4272 binder_inner_proc_lock(proc); in binder_wait_for_work()
4280 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4287 * @proc: binder_proc associated @t->buffer
4298 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4319 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4339 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4358 binder_inner_proc_lock(proc); in binder_thread_read()
4360 binder_inner_proc_unlock(proc); in binder_thread_read()
4366 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4371 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4375 binder_set_nice(proc->default_priority); in binder_thread_read()
4400 binder_inner_proc_lock(proc); in binder_thread_read()
4403 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4405 list = &proc->todo; in binder_thread_read()
4407 binder_inner_proc_unlock(proc); in binder_thread_read()
4416 binder_inner_proc_unlock(proc); in binder_thread_read()
4425 binder_inner_proc_unlock(proc); in binder_thread_read()
4433 binder_inner_proc_unlock(proc); in binder_thread_read()
4440 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4444 if (proc->oneway_spam_detection_enabled && in binder_thread_read()
4449 binder_inner_proc_unlock(proc); in binder_thread_read()
4456 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4459 proc->pid, thread->pid); in binder_thread_read()
4471 BUG_ON(proc != node->proc); in binder_thread_read()
4497 proc->pid, thread->pid, in binder_thread_read()
4501 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4502 binder_inner_proc_unlock(proc); in binder_thread_read()
4516 binder_inner_proc_unlock(proc); in binder_thread_read()
4520 proc, thread, &ptr, node_ptr, in binder_thread_read()
4525 proc, thread, &ptr, node_ptr, in binder_thread_read()
4530 proc, thread, &ptr, node_ptr, in binder_thread_read()
4535 proc, thread, &ptr, node_ptr, in binder_thread_read()
4541 proc->pid, thread->pid, in binder_thread_read()
4564 proc->pid, thread->pid, in binder_thread_read()
4570 binder_inner_proc_unlock(proc); in binder_thread_read()
4575 w, &proc->delivered_death); in binder_thread_read()
4576 binder_inner_proc_unlock(proc); in binder_thread_read()
4585 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4590 binder_inner_proc_unlock(proc); in binder_thread_read()
4592 proc->pid, thread->pid, w->type); in binder_thread_read()
4624 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4633 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
4644 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
4647 proc->pid, thread->pid, in binder_thread_read()
4656 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4695 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4698 proc->pid, thread->pid, in binder_thread_read()
4702 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
4712 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4716 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4726 binder_inner_proc_lock(proc); in binder_thread_read()
4727 if (proc->requested_threads == 0 && in binder_thread_read()
4728 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
4729 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
4733 proc->requested_threads++; in binder_thread_read()
4734 binder_inner_proc_unlock(proc); in binder_thread_read()
4737 proc->pid, thread->pid); in binder_thread_read()
4740 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
4742 binder_inner_proc_unlock(proc); in binder_thread_read()
4746 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
4753 binder_inner_proc_lock(proc); in binder_release_work()
4756 binder_inner_proc_unlock(proc); in binder_release_work()
4806 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
4810 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
4827 thread->proc = proc; in binder_get_thread_ilocked()
4833 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
4844 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
4849 binder_inner_proc_lock(proc); in binder_get_thread()
4850 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
4851 binder_inner_proc_unlock(proc); in binder_get_thread()
4856 binder_inner_proc_lock(proc); in binder_get_thread()
4857 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
4858 binder_inner_proc_unlock(proc); in binder_get_thread()
4865 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
4869 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
4870 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
4871 if (proc->outstanding_txns) in binder_free_proc()
4873 __func__, proc->outstanding_txns); in binder_free_proc()
4874 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
4876 kfree(proc->context->name); in binder_free_proc()
4879 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
4880 put_task_struct(proc->tsk); in binder_free_proc()
4881 put_cred(proc->cred); in binder_free_proc()
4883 kfree(proc); in binder_free_proc()
4890 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
4894 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
4902 binder_inner_proc_lock(thread->proc); in binder_thread_release()
4904 * take a ref on the proc so it survives in binder_thread_release()
4905 * after we remove this thread from proc->threads. in binder_thread_release()
4909 proc->tmp_ref++; in binder_thread_release()
4915 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
4931 proc->pid, thread->pid, in binder_thread_release()
4936 thread->proc->outstanding_txns--; in binder_thread_release()
4965 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
4979 binder_release_work(proc, &thread->todo); in binder_thread_release()
4987 struct binder_proc *proc = filp->private_data; in binder_poll() local
4991 thread = binder_get_thread(proc); in binder_poll()
4995 binder_inner_proc_lock(thread->proc); in binder_poll()
4999 binder_inner_proc_unlock(thread->proc); in binder_poll()
5014 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5029 proc->pid, thread->pid, in binder_ioctl_write_read()
5034 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5047 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5052 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5053 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5054 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5055 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5064 proc->pid, thread->pid, in binder_ioctl_write_read()
5079 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5080 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5090 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5105 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5123 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5127 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5133 proc->pid); in binder_ioctl_get_node_info_for_ref()
5140 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5146 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5159 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5167 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5168 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5179 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5184 static bool binder_txns_pending_ilocked(struct binder_proc *proc) in binder_txns_pending_ilocked() argument
5189 if (proc->outstanding_txns > 0) in binder_txns_pending_ilocked()
5192 for (n = rb_first(&proc->threads); n; n = rb_next(n)) { in binder_txns_pending_ilocked()
5283 binder_inner_proc_lock(thread->proc); in binder_ioctl_get_extended_error()
5286 binder_inner_proc_unlock(thread->proc); in binder_ioctl_get_extended_error()
5297 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5303 proc->pid, current->pid, cmd, arg);*/ in binder_ioctl()
5305 binder_selftest_alloc(&proc->alloc); in binder_ioctl()
5313 thread = binder_get_thread(proc); in binder_ioctl()
5333 binder_inner_proc_lock(proc); in binder_ioctl()
5334 proc->max_threads = max_threads; in binder_ioctl()
5335 binder_inner_proc_unlock(proc); in binder_ioctl()
5357 proc->pid, thread->pid); in binder_ioctl()
5358 binder_thread_release(proc, thread); in binder_ioctl()
5383 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5402 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5497 binder_inner_proc_lock(proc); in binder_ioctl()
5498 proc->oneway_spam_detection_enabled = (bool)enable; in binder_ioctl()
5499 binder_inner_proc_unlock(proc); in binder_ioctl()
5517 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5525 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5529 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5536 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5540 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5543 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5559 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5561 if (proc->tsk != current->group_leader) in binder_mmap()
5566 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5572 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5579 vma->vm_private_data = proc; in binder_mmap()
5581 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5586 struct binder_proc *proc, *itr; in binder_open() local
5595 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5596 if (proc == NULL) in binder_open()
5598 spin_lock_init(&proc->inner_lock); in binder_open()
5599 spin_lock_init(&proc->outer_lock); in binder_open()
5601 proc->tsk = current->group_leader; in binder_open()
5602 proc->cred = get_cred(filp->f_cred); in binder_open()
5603 INIT_LIST_HEAD(&proc->todo); in binder_open()
5604 init_waitqueue_head(&proc->freeze_wait); in binder_open()
5605 proc->default_priority = task_nice(current); in binder_open()
5616 proc->context = &binder_dev->context; in binder_open()
5617 binder_alloc_init(&proc->alloc); in binder_open()
5620 proc->pid = current->group_leader->pid; in binder_open()
5621 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
5622 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
5623 filp->private_data = proc; in binder_open()
5627 if (itr->pid == proc->pid) { in binder_open()
5632 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
5638 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5640 * proc debug entries are shared between contexts. in binder_open()
5645 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
5647 (void *)(unsigned long)proc->pid, in binder_open()
5655 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5663 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
5665 proc->binderfs_entry = binderfs_entry; in binder_open()
5680 struct binder_proc *proc = filp->private_data; in binder_flush() local
5682 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
5687 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
5692 binder_inner_proc_lock(proc); in binder_deferred_flush()
5693 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
5702 binder_inner_proc_unlock(proc); in binder_deferred_flush()
5705 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
5711 struct binder_proc *proc = filp->private_data; in binder_release() local
5713 debugfs_remove(proc->debugfs_entry); in binder_release()
5715 if (proc->binderfs_entry) { in binder_release()
5716 binderfs_remove_file(proc->binderfs_entry); in binder_release()
5717 proc->binderfs_entry = NULL; in binder_release()
5720 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
5729 struct binder_proc *proc = node->proc; in binder_node_release() local
5731 binder_release_work(proc, &node->async_todo); in binder_node_release()
5734 binder_inner_proc_lock(proc); in binder_node_release()
5741 binder_inner_proc_unlock(proc); in binder_node_release()
5748 node->proc = NULL; in binder_node_release()
5751 binder_inner_proc_unlock(proc); in binder_node_release()
5765 binder_inner_proc_lock(ref->proc); in binder_node_release()
5767 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5776 &ref->proc->todo); in binder_node_release()
5777 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
5778 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5790 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
5792 struct binder_context *context = proc->context; in binder_deferred_release()
5797 hlist_del(&proc->proc_node); in binder_deferred_release()
5802 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
5805 __func__, proc->pid); in binder_deferred_release()
5809 binder_inner_proc_lock(proc); in binder_deferred_release()
5811 * Make sure proc stays alive after we in binder_deferred_release()
5814 proc->tmp_ref++; in binder_deferred_release()
5816 proc->is_dead = true; in binder_deferred_release()
5817 proc->is_frozen = false; in binder_deferred_release()
5818 proc->sync_recv = false; in binder_deferred_release()
5819 proc->async_recv = false; in binder_deferred_release()
5822 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
5826 binder_inner_proc_unlock(proc); in binder_deferred_release()
5828 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
5829 binder_inner_proc_lock(proc); in binder_deferred_release()
5834 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
5845 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
5846 binder_inner_proc_unlock(proc); in binder_deferred_release()
5848 binder_inner_proc_lock(proc); in binder_deferred_release()
5850 binder_inner_proc_unlock(proc); in binder_deferred_release()
5853 binder_proc_lock(proc); in binder_deferred_release()
5854 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
5860 binder_proc_unlock(proc); in binder_deferred_release()
5862 binder_proc_lock(proc); in binder_deferred_release()
5864 binder_proc_unlock(proc); in binder_deferred_release()
5866 binder_release_work(proc, &proc->todo); in binder_deferred_release()
5867 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
5871 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
5874 binder_proc_dec_tmpref(proc); in binder_deferred_release()
5879 struct binder_proc *proc; in binder_deferred_func() local
5886 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
5888 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
5889 defer = proc->deferred_work; in binder_deferred_func()
5890 proc->deferred_work = 0; in binder_deferred_func()
5892 proc = NULL; in binder_deferred_func()
5898 binder_deferred_flush(proc); in binder_deferred_func()
5901 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
5902 } while (proc); in binder_deferred_func()
5907 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
5910 proc->deferred_work |= defer; in binder_defer_work()
5911 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
5912 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
5920 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
5932 t->from ? t->from->proc->pid : 0, in print_binder_transaction_ilocked()
5939 if (proc != to_proc) { in print_binder_transaction_ilocked()
5942 * correct proc inner lock for this node in print_binder_transaction_ilocked()
5960 struct binder_proc *proc, in print_binder_work_ilocked() argument
5972 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6022 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6026 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6030 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6036 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6060 seq_puts(m, " proc"); in print_binder_node_nilocked()
6062 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6065 if (node->proc) { in print_binder_node_nilocked()
6067 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6078 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6085 struct binder_proc *proc, int print_all) in print_binder_proc() argument
6093 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6094 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6097 binder_inner_proc_lock(proc); in print_binder_proc()
6098 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
6102 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
6115 binder_inner_proc_unlock(proc); in print_binder_proc()
6122 binder_inner_proc_lock(proc); in print_binder_proc()
6124 binder_inner_proc_unlock(proc); in print_binder_proc()
6129 binder_proc_lock(proc); in print_binder_proc()
6130 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
6136 binder_proc_unlock(proc); in print_binder_proc()
6138 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6139 binder_inner_proc_lock(proc); in print_binder_proc()
6140 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6141 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6143 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6147 binder_inner_proc_unlock(proc); in print_binder_proc()
6198 "proc",
6250 struct binder_proc *proc) in print_binder_proc_stats() argument
6257 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6259 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6260 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6263 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6264 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6267 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6273 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6274 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6278 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6280 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6285 binder_proc_lock(proc); in print_binder_proc_stats()
6286 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
6293 binder_proc_unlock(proc); in print_binder_proc_stats()
6296 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6299 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6302 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6303 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6307 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6310 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6315 struct binder_proc *proc; in state_show() local
6345 hlist_for_each_entry(proc, &binder_procs, proc_node) in state_show()
6346 print_binder_proc(m, proc, 1); in state_show()
6354 struct binder_proc *proc; in stats_show() local
6361 hlist_for_each_entry(proc, &binder_procs, proc_node) in stats_show()
6362 print_binder_proc_stats(m, proc); in stats_show()
6370 struct binder_proc *proc; in transactions_show() local
6374 hlist_for_each_entry(proc, &binder_procs, proc_node) in transactions_show()
6375 print_binder_proc(m, proc, 0); in transactions_show()
6389 seq_puts(m, "binder proc state:\n"); in proc_show()
6550 binder_debugfs_dir_entry_proc = debugfs_create_dir("proc", in binder_init()