• Home
  • Raw
  • Download

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
98 DEFINE_SHOW_ATTRIBUTE(proc);
247 * There are separate work lists for proc, thread, and node (async).
274 * (protected by @proc->inner_lock)
275 * @rb_node: element for proc->nodes tree
276 * (protected by @proc->inner_lock)
279 * @proc: binder_proc that owns this node
285 * (protected by @proc->inner_lock if @proc
288 * (protected by @proc->inner_lock if @proc
291 * (protected by @proc->inner_lock if @proc
294 * (protected by @proc->inner_lock while @proc
296 * if @proc is NULL. During inc/dec and node release
298 * as the node dies and @proc becomes NULL)
304 * (protected by @proc->inner_lock if @proc
307 * (protected by @proc->inner_lock if @proc
310 * (protected by @proc->inner_lock if @proc
313 * (protected by @proc->inner_lock if @proc
324 * (protected by @proc->inner_lock)
336 struct binder_proc *proc; member
347 * proc inner_lock
369 * (protected by inner_lock of the proc that
398 * @rb_node_desc: node for lookup by @data.desc in proc's rb_tree
399 * @rb_node_node: node for lookup by @node in proc's rb_tree
402 * @proc: binder_proc containing ref
410 * structure is unsafe to access without holding @proc->outer_lock.
414 /* node + proc => ref (transaction) */
415 /* desc + proc => ref (transaction, inc/dec ref) */
416 /* node => refs + procs (proc exit) */
421 struct binder_proc *proc; member
434 * @threads: rbtree of binder_threads in this proc
437 * this proc ordered by node->ptr
443 * @waiting_threads: threads currently waiting for proc work
473 * @tmp_ref: temporary reference to indicate proc is in use
479 * @context: binder_context for this proc
529 * @proc: binder process for this thread
531 * @rb_node: element for proc->threads rbtree
532 * (protected by @proc->inner_lock)
533 * @waiting_thread_node: element for @proc->waiting_threads list
534 * (protected by @proc->inner_lock)
542 * (protected by @proc->inner_lock)
544 * (protected by @proc->inner_lock)
546 * (protected by @proc->inner_lock)
550 * (protected by @proc->inner_lock)
555 * (atomic since @proc->inner_lock cannot
559 * (protected by @proc->inner_lock)
564 struct binder_proc *proc; member
663 * @proc: struct binder_proc to acquire
665 * Acquires proc->outer_lock. Used to protect binder_ref
666 * structures associated with the given proc.
668 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
670 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
671 __acquires(&proc->outer_lock) in _binder_proc_lock()
675 spin_lock(&proc->outer_lock); in _binder_proc_lock()
680 * @proc: struct binder_proc to acquire
686 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
687 __releases(&proc->outer_lock) in _binder_proc_unlock()
691 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
696 * @proc: struct binder_proc to acquire
698 * Acquires proc->inner_lock. Used to protect todo lists
700 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
702 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
703 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
707 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
712 * @proc: struct binder_proc to acquire
716 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
718 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
719 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
723 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
762 * Acquires node->lock. If node->proc also acquires
763 * proc->inner_lock. Used to protect binder_node fields
768 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
773 if (node->proc) in _binder_node_inner_lock()
774 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
777 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
789 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
791 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
795 if (proc) in _binder_node_inner_unlock()
796 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
799 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
810 * @proc: binder_proc associated with list
815 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
820 binder_inner_proc_lock(proc); in binder_worklist_empty()
822 binder_inner_proc_unlock(proc); in binder_worklist_empty()
834 * Requires the proc->inner_lock to be held.
854 * Requires the proc->inner_lock to be held.
872 * Requires the proc->inner_lock to be held.
905 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
907 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
918 * @proc: binder_proc associated with list
925 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
927 binder_inner_proc_lock(proc); in binder_dequeue_work()
929 binder_inner_proc_unlock(proc); in binder_dequeue_work()
944 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
946 static void binder_free_proc(struct binder_proc *proc);
965 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
972 binder_inner_proc_lock(thread->proc); in binder_has_work()
974 binder_inner_proc_unlock(thread->proc); in binder_has_work()
987 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
993 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
1006 * binder_select_thread_ilocked() - selects a thread for doing proc work.
1007 * @proc: process to select a thread from
1018 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
1022 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
1023 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
1034 * binder_wakeup_thread_ilocked() - wakes up a thread for doing proc work.
1035 * @proc: process to wake up a thread in
1039 * This function wakes up a thread in the @proc process.
1049 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
1053 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
1063 /* Didn't find a thread waiting for proc work; this can happen in binder_wakeup_thread_ilocked()
1076 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
1079 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
1081 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
1083 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
1104 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
1107 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
1110 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
1132 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
1137 binder_inner_proc_lock(proc); in binder_get_node()
1138 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
1139 binder_inner_proc_unlock(proc); in binder_get_node()
1144 struct binder_proc *proc, in binder_init_node_ilocked() argument
1148 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
1155 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
1180 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
1182 node->proc = proc; in binder_init_node_ilocked()
1194 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
1200 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
1208 binder_inner_proc_lock(proc); in binder_new_node()
1209 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
1210 binder_inner_proc_unlock(proc); in binder_new_node()
1230 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
1233 if (proc) in binder_inc_node_nilocked()
1234 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
1239 !(node->proc && in binder_inc_node_nilocked()
1240 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
1290 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
1293 if (proc) in binder_dec_node_nilocked()
1294 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
1310 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
1312 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
1313 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
1318 if (proc) { in binder_dec_node_nilocked()
1320 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
1376 * (node->proc is NULL), use binder_dead_nodes_lock to protect
1384 if (node->proc) in binder_inc_node_tmpref()
1385 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
1389 if (node->proc) in binder_inc_node_tmpref()
1390 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
1407 if (!node->proc) in binder_dec_node_tmpref()
1413 if (!node->proc) in binder_dec_node_tmpref()
1434 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1437 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1459 * @proc: binder_proc that owns the ref
1467 * into the given proc rb_trees and node refs list.
1476 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1480 struct binder_context *context = proc->context; in binder_get_ref_for_node_olocked()
1481 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1502 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1505 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1508 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node_olocked()
1515 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1528 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1535 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1547 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1550 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1551 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1575 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1577 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1589 * Increment the ref. @ref->proc->outer_lock must be held on entry
1630 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1641 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1656 * binder_get_node_from_ref() - get the node from the given proc/desc
1657 * @proc: proc containing the ref
1662 * Given a proc and ref handle, return the associated binder_node
1667 struct binder_proc *proc, in binder_get_node_from_ref() argument
1674 binder_proc_lock(proc); in binder_get_node_from_ref()
1675 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1686 binder_proc_unlock(proc); in binder_get_node_from_ref()
1691 binder_proc_unlock(proc); in binder_get_node_from_ref()
1712 * @proc: proc containing the ref
1718 * Given a proc and ref handle, increment or decrement the ref
1723 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1731 binder_proc_lock(proc); in binder_update_ref_for_handle()
1732 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1744 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1751 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1757 * @proc: proc containing the ref
1766 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1769 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1774 * binder_inc_ref_for_node() - increment the ref for given proc/node
1775 * @proc: proc containing the ref
1781 * Given a proc and node, increment the ref. Create the ref if it
1786 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1796 binder_proc_lock(proc); in binder_inc_ref_for_node()
1797 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1799 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1803 binder_proc_lock(proc); in binder_inc_ref_for_node()
1804 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1820 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1834 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1860 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1863 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1867 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1871 * binder_proc_dec_tmpref() - decrement proc->tmp_ref
1872 * @proc: proc to decrement
1875 * handle a transaction. proc->tmp_ref is incremented when
1879 * proc if appropriate (proc has been released, all threads have
1882 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1884 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1885 proc->tmp_ref--; in binder_proc_dec_tmpref()
1886 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1887 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1888 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1889 binder_free_proc(proc); in binder_proc_dec_tmpref()
1892 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1922 * Same as binder_get_txn_from() except it also acquires the proc->inner_lock
1931 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1937 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1940 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1945 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1946 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
2004 target_thread->proc->pid, in binder_send_failed_reply()
2024 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
2029 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
2071 * @proc: binder_proc owning the buffer
2085 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
2104 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
2139 * @proc: binder_proc owning the buffer
2160 struct binder_proc *proc, in binder_validate_ptr() argument
2176 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
2180 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
2191 * @proc: binder_proc owning the buffer
2228 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
2245 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
2261 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
2330 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
2341 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
2357 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
2360 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
2375 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2395 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2445 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2486 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2510 static inline void binder_release_entire_buffer(struct binder_proc *proc, in binder_release_entire_buffer() argument
2520 binder_transaction_buffer_release(proc, thread, buffer, in binder_release_entire_buffer()
2529 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2534 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2536 node = binder_new_node(proc, fp); in binder_translate_binder()
2542 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2548 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2581 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2587 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2591 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2594 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2600 if (node->proc == target_proc) { in binder_translate_handle()
2607 if (node->proc) in binder_translate_handle()
2608 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2610 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2614 if (node->proc) in binder_translate_handle()
2615 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2617 __release(&node->proc->inner_lock); in binder_translate_handle()
2655 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2668 proc->pid, thread->pid, in binder_translate_fd()
2678 proc->pid, thread->pid, fd); in binder_translate_fd()
2682 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2968 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2977 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2984 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
3002 proc->pid, thread->pid); in binder_translate_fd_array()
3035 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
3049 proc->pid, thread->pid); in binder_fixup_parent()
3058 proc->pid, thread->pid); in binder_fixup_parent()
3066 proc->pid, thread->pid); in binder_fixup_parent()
3077 * @proc: process to send the transaction to
3078 * @thread: thread in @proc to send the transaction to (may be NULL)
3082 * wake it up. If no thread is found, the work is queued to the proc
3092 struct binder_proc *proc, in binder_proc_transaction() argument
3109 binder_inner_proc_lock(proc); in binder_proc_transaction()
3111 if (proc->is_dead || (thread && thread->is_dead)) { in binder_proc_transaction()
3112 binder_inner_proc_unlock(proc); in binder_proc_transaction()
3118 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
3123 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
3128 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
3130 binder_inner_proc_unlock(proc); in binder_proc_transaction()
3139 * @proc: returns @node->proc if valid
3140 * @error: if no @proc then returns BR_DEAD_REPLY
3150 * the transaction. We also need a tmpref on the proc while we are
3153 * Return: The target_node with refs taken or NULL if no @node->proc is NULL.
3154 * Also sets @proc if valid. If the @node->proc is NULL indicating that the
3155 * target proc has died, @error is set to BR_DEAD_REPLY
3165 if (node->proc) { in binder_get_node_refs_for_txn()
3169 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
3170 *procp = node->proc; in binder_get_node_refs_for_txn()
3178 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
3202 struct binder_context *context = proc->context; in binder_transaction()
3216 e->from_proc = proc->pid; in binder_transaction()
3221 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
3224 binder_inner_proc_lock(proc); in binder_transaction()
3227 binder_inner_proc_unlock(proc); in binder_transaction()
3229 proc->pid, thread->pid); in binder_transaction()
3238 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3244 binder_inner_proc_unlock(proc); in binder_transaction()
3252 binder_inner_proc_unlock(proc); in binder_transaction()
3257 __release(&target_thread->proc->inner_lock); in binder_transaction()
3264 proc->pid, thread->pid, in binder_transaction()
3268 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3276 target_proc = target_thread->proc; in binder_transaction()
3278 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3290 binder_proc_lock(proc); in binder_transaction()
3291 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3299 proc->pid, thread->pid); in binder_transaction()
3302 binder_proc_unlock(proc); in binder_transaction()
3313 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3315 proc->pid, thread->pid); in binder_transaction()
3331 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3337 if (security_binder_transaction(proc->cred, in binder_transaction()
3344 binder_inner_proc_lock(proc); in binder_transaction()
3355 * thread from proc->waiting_threads to enqueue in binder_transaction()
3360 proc->pid, thread->pid); in binder_transaction()
3361 binder_inner_proc_unlock(proc); in binder_transaction()
3375 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3380 binder_inner_proc_unlock(proc); in binder_transaction()
3391 if (from && from->proc == target_proc) { in binder_transaction()
3401 binder_inner_proc_unlock(proc); in binder_transaction()
3433 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3442 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3458 t->async_from_pid = thread->proc->pid; in binder_transaction()
3462 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3477 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3544 proc->pid, thread->pid); in binder_transaction()
3552 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3560 proc->pid, thread->pid, in binder_transaction()
3606 proc->pid, thread->pid); in binder_transaction()
3616 proc->pid, thread->pid, in binder_transaction()
3706 proc->pid, thread->pid); in binder_transaction()
3719 proc->pid, thread->pid); in binder_transaction()
3730 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3734 proc->pid, thread->pid, in binder_transaction()
3769 proc->pid, thread->pid); in binder_transaction()
3784 /* Fixup buffer pointer to target proc address space */ in binder_transaction()
3812 proc->pid, thread->pid, hdr->type); in binder_transaction()
3826 proc->pid, thread->pid); in binder_transaction()
3837 proc->pid, thread->pid); in binder_transaction()
3864 binder_inner_proc_lock(proc); in binder_transaction()
3879 binder_inner_proc_unlock(proc); in binder_transaction()
3881 binder_inner_proc_lock(proc); in binder_transaction()
3883 binder_inner_proc_unlock(proc); in binder_transaction()
3912 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3955 proc->pid, thread->pid, return_error, return_error_param, in binder_transaction()
3989 * @proc: binder proc that owns buffer
3999 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
4003 binder_inner_proc_lock(proc); in binder_free_buf()
4008 binder_inner_proc_unlock(proc); in binder_free_buf()
4016 BUG_ON(buf_node->proc != proc); in binder_free_buf()
4023 w, &proc->todo); in binder_free_buf()
4024 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
4029 binder_release_entire_buffer(proc, thread, buffer, is_failure); in binder_free_buf()
4030 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
4033 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
4039 struct binder_context *context = proc->context; in binder_thread_write()
4053 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
4077 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
4079 proc->pid, thread->pid); in binder_thread_write()
4084 proc, ctx_mgr_node, in binder_thread_write()
4091 proc, target, increment, strong, in binder_thread_write()
4095 proc->pid, thread->pid, in binder_thread_write()
4115 proc->pid, thread->pid, debug_string, in binder_thread_write()
4121 proc->pid, thread->pid, debug_string, in binder_thread_write()
4139 node = binder_get_node(proc, node_ptr); in binder_thread_write()
4142 proc->pid, thread->pid, in binder_thread_write()
4151 proc->pid, thread->pid, in binder_thread_write()
4163 proc->pid, thread->pid, in binder_thread_write()
4173 proc->pid, thread->pid, in binder_thread_write()
4186 proc->pid, thread->pid, in binder_thread_write()
4209 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4215 proc->pid, thread->pid, in binder_thread_write()
4220 proc->pid, thread->pid, in binder_thread_write()
4227 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
4230 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4241 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4252 binder_transaction(proc, thread, &tr, in binder_thread_write()
4260 proc->pid, thread->pid); in binder_thread_write()
4261 binder_inner_proc_lock(proc); in binder_thread_write()
4265 proc->pid, thread->pid); in binder_thread_write()
4266 } else if (proc->requested_threads == 0) { in binder_thread_write()
4269 proc->pid, thread->pid); in binder_thread_write()
4271 proc->requested_threads--; in binder_thread_write()
4272 proc->requested_threads_started++; in binder_thread_write()
4275 binder_inner_proc_unlock(proc); in binder_thread_write()
4280 proc->pid, thread->pid); in binder_thread_write()
4284 proc->pid, thread->pid); in binder_thread_write()
4291 proc->pid, thread->pid); in binder_thread_write()
4324 proc->pid, thread->pid); in binder_thread_write()
4328 binder_proc_lock(proc); in binder_thread_write()
4329 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4332 proc->pid, thread->pid, in binder_thread_write()
4337 binder_proc_unlock(proc); in binder_thread_write()
4344 proc->pid, thread->pid, in binder_thread_write()
4356 proc->pid, thread->pid); in binder_thread_write()
4358 binder_proc_unlock(proc); in binder_thread_write()
4366 if (ref->node->proc == NULL) { in binder_thread_write()
4369 binder_inner_proc_lock(proc); in binder_thread_write()
4371 &ref->death->work, &proc->todo); in binder_thread_write()
4372 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4373 binder_inner_proc_unlock(proc); in binder_thread_write()
4378 proc->pid, thread->pid); in binder_thread_write()
4380 binder_proc_unlock(proc); in binder_thread_write()
4386 proc->pid, thread->pid, in binder_thread_write()
4390 binder_proc_unlock(proc); in binder_thread_write()
4394 binder_inner_proc_lock(proc); in binder_thread_write()
4406 &proc->todo); in binder_thread_write()
4408 proc); in binder_thread_write()
4414 binder_inner_proc_unlock(proc); in binder_thread_write()
4417 binder_proc_unlock(proc); in binder_thread_write()
4428 binder_inner_proc_lock(proc); in binder_thread_write()
4429 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4443 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4447 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4448 binder_inner_proc_unlock(proc); in binder_thread_write()
4462 &proc->todo); in binder_thread_write()
4463 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4466 binder_inner_proc_unlock(proc); in binder_thread_write()
4471 proc->pid, thread->pid, cmd); in binder_thread_write()
4479 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4485 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4490 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4512 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4514 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4525 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4529 binder_inner_proc_lock(proc); in binder_wait_for_work()
4536 &proc->waiting_threads); in binder_wait_for_work()
4537 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4539 binder_inner_proc_lock(proc); in binder_wait_for_work()
4547 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4555 * @proc: binder_proc associated @t->buffer
4567 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4589 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4603 err = binder_alloc_copy_from_buffer(&proc->alloc, &fd, in binder_apply_fd_fixups()
4618 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4637 binder_inner_proc_lock(proc); in binder_thread_read()
4639 binder_inner_proc_unlock(proc); in binder_thread_read()
4645 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4650 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4654 binder_set_nice(proc->default_priority); in binder_thread_read()
4679 binder_inner_proc_lock(proc); in binder_thread_read()
4682 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4684 list = &proc->todo; in binder_thread_read()
4686 binder_inner_proc_unlock(proc); in binder_thread_read()
4695 binder_inner_proc_unlock(proc); in binder_thread_read()
4704 binder_inner_proc_unlock(proc); in binder_thread_read()
4712 binder_inner_proc_unlock(proc); in binder_thread_read()
4719 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4722 binder_inner_proc_unlock(proc); in binder_thread_read()
4730 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4733 proc->pid, thread->pid); in binder_thread_read()
4745 BUG_ON(proc != node->proc); in binder_thread_read()
4771 proc->pid, thread->pid, in binder_thread_read()
4775 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4776 binder_inner_proc_unlock(proc); in binder_thread_read()
4790 binder_inner_proc_unlock(proc); in binder_thread_read()
4794 proc, thread, &ptr, node_ptr, in binder_thread_read()
4799 proc, thread, &ptr, node_ptr, in binder_thread_read()
4804 proc, thread, &ptr, node_ptr, in binder_thread_read()
4809 proc, thread, &ptr, node_ptr, in binder_thread_read()
4815 proc->pid, thread->pid, in binder_thread_read()
4838 proc->pid, thread->pid, in binder_thread_read()
4844 binder_inner_proc_unlock(proc); in binder_thread_read()
4849 w, &proc->delivered_death); in binder_thread_read()
4850 binder_inner_proc_unlock(proc); in binder_thread_read()
4859 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4864 binder_inner_proc_unlock(proc); in binder_thread_read()
4866 proc->pid, thread->pid, w->type); in binder_thread_read()
4898 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4904 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4906 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4911 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4913 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4917 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
4928 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
4931 proc->pid, thread->pid, in binder_thread_read()
4940 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4979 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4982 proc->pid, thread->pid, in binder_thread_read()
4986 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
4996 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4999 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
5002 binder_inner_proc_lock(thread->proc); in binder_thread_read()
5006 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
5016 binder_inner_proc_lock(proc); in binder_thread_read()
5017 if (proc->requested_threads == 0 && in binder_thread_read()
5018 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
5019 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
5023 proc->requested_threads++; in binder_thread_read()
5024 binder_inner_proc_unlock(proc); in binder_thread_read()
5027 proc->pid, thread->pid); in binder_thread_read()
5030 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
5032 binder_inner_proc_unlock(proc); in binder_thread_read()
5036 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
5043 binder_inner_proc_lock(proc); in binder_release_work()
5046 binder_inner_proc_unlock(proc); in binder_release_work()
5096 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
5100 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
5117 thread->proc = proc; in binder_get_thread_ilocked()
5123 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
5133 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
5138 binder_inner_proc_lock(proc); in binder_get_thread()
5139 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
5140 binder_inner_proc_unlock(proc); in binder_get_thread()
5145 binder_inner_proc_lock(proc); in binder_get_thread()
5146 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
5147 binder_inner_proc_unlock(proc); in binder_get_thread()
5154 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
5158 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
5159 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
5160 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
5162 kfree(proc->context->name); in binder_free_proc()
5165 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5166 put_task_struct(proc->tsk); in binder_free_proc()
5167 put_cred(proc->cred); in binder_free_proc()
5169 kfree(proc); in binder_free_proc()
5176 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5180 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5188 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5190 * take a ref on the proc so it survives in binder_thread_release()
5191 * after we remove this thread from proc->threads. in binder_thread_release()
5195 proc->tmp_ref++; in binder_thread_release()
5201 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5217 proc->pid, thread->pid, in binder_thread_release()
5254 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5268 binder_release_work(proc, &thread->todo); in binder_thread_release()
5276 struct binder_proc *proc = filp->private_data; in binder_poll() local
5280 thread = binder_get_thread(proc); in binder_poll()
5284 binder_inner_proc_lock(thread->proc); in binder_poll()
5288 binder_inner_proc_unlock(thread->proc); in binder_poll()
5303 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5318 proc->pid, thread->pid, in binder_ioctl_write_read()
5323 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5336 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5341 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5342 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5343 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5344 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5353 proc->pid, thread->pid, in binder_ioctl_write_read()
5368 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5369 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5379 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5394 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5412 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5416 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5422 proc->pid); in binder_ioctl_get_node_info_for_ref()
5429 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5435 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5448 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5456 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5457 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5468 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5476 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5482 proc->pid, current->pid, cmd, arg);*/ in binder_ioctl()
5484 binder_selftest_alloc(&proc->alloc); in binder_ioctl()
5492 thread = binder_get_thread(proc); in binder_ioctl()
5512 binder_inner_proc_lock(proc); in binder_ioctl()
5513 proc->max_threads = max_threads; in binder_ioctl()
5514 binder_inner_proc_unlock(proc); in binder_ioctl()
5536 proc->pid, thread->pid); in binder_ioctl()
5537 binder_thread_release(proc, thread); in binder_ioctl()
5562 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5581 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5613 binder_inner_proc_lock(proc); in binder_ioctl()
5616 binder_inner_proc_unlock(proc); in binder_ioctl()
5637 binder_inner_proc_lock(proc); in binder_ioctl()
5643 binder_inner_proc_unlock(proc); in binder_ioctl()
5671 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5679 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5683 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5690 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5694 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5697 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5713 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5715 if (proc->tsk != current->group_leader) in binder_mmap()
5720 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5726 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5733 vma->vm_private_data = proc; in binder_mmap()
5735 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5740 struct binder_proc *proc, *itr; in binder_open() local
5749 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5750 if (proc == NULL) in binder_open()
5752 spin_lock_init(&proc->inner_lock); in binder_open()
5753 spin_lock_init(&proc->outer_lock); in binder_open()
5755 proc->tsk = current->group_leader; in binder_open()
5756 proc->cred = get_cred(filp->f_cred); in binder_open()
5757 INIT_LIST_HEAD(&proc->todo); in binder_open()
5758 proc->default_priority = task_nice(current); in binder_open()
5769 proc->context = &binder_dev->context; in binder_open()
5770 binder_alloc_init(&proc->alloc); in binder_open()
5773 proc->pid = current->group_leader->pid; in binder_open()
5774 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
5775 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
5776 filp->private_data = proc; in binder_open()
5780 if (itr->pid == proc->pid) { in binder_open()
5785 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
5791 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5793 * proc debug entries are shared between contexts. in binder_open()
5798 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
5800 (void *)(unsigned long)proc->pid, in binder_open()
5808 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5816 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
5818 proc->binderfs_entry = binderfs_entry; in binder_open()
5833 struct binder_proc *proc = filp->private_data; in binder_flush() local
5835 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
5840 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
5845 binder_inner_proc_lock(proc); in binder_deferred_flush()
5846 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
5855 binder_inner_proc_unlock(proc); in binder_deferred_flush()
5858 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
5864 struct binder_proc *proc = filp->private_data; in binder_release() local
5866 debugfs_remove(proc->debugfs_entry); in binder_release()
5868 if (proc->binderfs_entry) { in binder_release()
5869 binderfs_remove_file(proc->binderfs_entry); in binder_release()
5870 proc->binderfs_entry = NULL; in binder_release()
5873 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
5882 struct binder_proc *proc = node->proc; in binder_node_release() local
5884 binder_release_work(proc, &node->async_todo); in binder_node_release()
5887 binder_inner_proc_lock(proc); in binder_node_release()
5894 binder_inner_proc_unlock(proc); in binder_node_release()
5901 node->proc = NULL; in binder_node_release()
5904 binder_inner_proc_unlock(proc); in binder_node_release()
5918 binder_inner_proc_lock(ref->proc); in binder_node_release()
5920 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5929 &ref->proc->todo); in binder_node_release()
5930 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
5931 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5943 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
5945 struct binder_context *context = proc->context; in binder_deferred_release()
5950 hlist_del(&proc->proc_node); in binder_deferred_release()
5955 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
5958 __func__, proc->pid); in binder_deferred_release()
5962 binder_inner_proc_lock(proc); in binder_deferred_release()
5964 * Make sure proc stays alive after we in binder_deferred_release()
5967 proc->tmp_ref++; in binder_deferred_release()
5969 proc->is_dead = true; in binder_deferred_release()
5972 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
5976 binder_inner_proc_unlock(proc); in binder_deferred_release()
5978 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
5979 binder_inner_proc_lock(proc); in binder_deferred_release()
5984 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
5995 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
5996 binder_inner_proc_unlock(proc); in binder_deferred_release()
5998 binder_inner_proc_lock(proc); in binder_deferred_release()
6000 binder_inner_proc_unlock(proc); in binder_deferred_release()
6003 binder_proc_lock(proc); in binder_deferred_release()
6004 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
6010 binder_proc_unlock(proc); in binder_deferred_release()
6012 binder_proc_lock(proc); in binder_deferred_release()
6014 binder_proc_unlock(proc); in binder_deferred_release()
6016 binder_release_work(proc, &proc->todo); in binder_deferred_release()
6017 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
6021 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
6024 binder_proc_dec_tmpref(proc); in binder_deferred_release()
6029 struct binder_proc *proc; in binder_deferred_func() local
6036 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
6038 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
6039 defer = proc->deferred_work; in binder_deferred_func()
6040 proc->deferred_work = 0; in binder_deferred_func()
6042 proc = NULL; in binder_deferred_func()
6048 binder_deferred_flush(proc); in binder_deferred_func()
6051 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
6052 } while (proc); in binder_deferred_func()
6057 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
6060 proc->deferred_work |= defer; in binder_defer_work()
6061 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
6062 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
6070 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
6082 t->from ? t->from->proc->pid : 0, in print_binder_transaction_ilocked()
6089 if (proc != to_proc) { in print_binder_transaction_ilocked()
6092 * correct proc inner lock for this node in print_binder_transaction_ilocked()
6110 struct binder_proc *proc, in print_binder_work_ilocked() argument
6122 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6172 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6176 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6180 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6186 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6210 seq_puts(m, " proc"); in print_binder_node_nilocked()
6212 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6215 if (node->proc) { in print_binder_node_nilocked()
6217 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6228 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6235 struct binder_proc *proc, int print_all) in print_binder_proc() argument
6243 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6244 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6247 binder_inner_proc_lock(proc); in print_binder_proc()
6248 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
6252 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
6265 binder_inner_proc_unlock(proc); in print_binder_proc()
6272 binder_inner_proc_lock(proc); in print_binder_proc()
6274 binder_inner_proc_unlock(proc); in print_binder_proc()
6279 binder_proc_lock(proc); in print_binder_proc()
6280 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
6286 binder_proc_unlock(proc); in print_binder_proc()
6288 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6289 binder_inner_proc_lock(proc); in print_binder_proc()
6290 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6291 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6293 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6297 binder_inner_proc_unlock(proc); in print_binder_proc()
6346 "proc",
6398 struct binder_proc *proc) in print_binder_proc_stats() argument
6405 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6407 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6408 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6411 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6412 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6415 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6421 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6422 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6426 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6428 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6433 binder_proc_lock(proc); in print_binder_proc_stats()
6434 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
6441 binder_proc_unlock(proc); in print_binder_proc_stats()
6444 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6447 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6450 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6451 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6455 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6458 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6464 struct binder_proc *proc; in binder_state_show() local
6494 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_state_show()
6495 print_binder_proc(m, proc, 1); in binder_state_show()
6503 struct binder_proc *proc; in binder_stats_show() local
6510 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_stats_show()
6511 print_binder_proc_stats(m, proc); in binder_stats_show()
6519 struct binder_proc *proc; in binder_transactions_show() local
6523 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transactions_show()
6524 print_binder_proc(m, proc, 0); in binder_transactions_show()
6538 seq_puts(m, "binder proc state:\n"); in proc_show()
6621 from_pid = t->from ? (t->from->proc ? t->from->proc->pid : 0) : t->async_from_pid; in print_binder_transaction_brief_ilocked()
6655 struct binder_proc *proc, in print_binder_transaction_brief() argument
6665 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6666 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6682 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6691 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6699 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6701 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6711 struct binder_proc *proc) in print_binder_proc_brief() argument
6715 size_t free_async_space = binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_brief()
6717 seq_printf(m, "%d\t", proc->pid); in print_binder_proc_brief()
6718 seq_printf(m, "%s\t", proc->context->name); in print_binder_proc_brief()
6720 binder_inner_proc_lock(proc); in print_binder_proc_brief()
6721 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_brief()
6725 "\t%zd\n", proc->requested_threads, in print_binder_proc_brief()
6726 proc->requested_threads_started, proc->max_threads, in print_binder_proc_brief()
6729 binder_inner_proc_unlock(proc); in print_binder_proc_brief()
6734 struct binder_proc *proc = NULL; in binder_transaction_proc_show() local
6739 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6740 print_binder_transaction_brief(m, proc, now); in binder_transaction_proc_show()
6743 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6744 print_binder_proc_brief(m, proc); in binder_transaction_proc_show()
6798 binder_debugfs_dir_entry_proc = debugfs_create_dir("proc", in binder_init()