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
94 DEFINE_SHOW_ATTRIBUTE(proc);
230 * There are separate work lists for proc, thread, and node (async).
257 * (protected by @proc->inner_lock)
258 * @rb_node: element for proc->nodes tree
259 * (protected by @proc->inner_lock)
262 * @proc: binder_proc that owns this node
268 * (protected by @proc->inner_lock if @proc
271 * (protected by @proc->inner_lock if @proc
274 * (protected by @proc->inner_lock if @proc
277 * (protected by @proc->inner_lock while @proc
279 * if @proc is NULL. During inc/dec and node release
281 * as the node dies and @proc becomes NULL)
287 * (protected by @proc->inner_lock if @proc
290 * (protected by @proc->inner_lock if @proc
293 * (protected by @proc->inner_lock if @proc
296 * (protected by @proc->inner_lock if @proc
307 * (protected by @proc->inner_lock)
319 struct binder_proc *proc; member
330 * proc inner_lock
352 * (protected by inner_lock of the proc that
381 * @rb_node_desc: node for lookup by @data.desc in proc's rb_tree
382 * @rb_node_node: node for lookup by @node in proc's rb_tree
385 * @proc: binder_proc containing ref
393 * structure is unsafe to access without holding @proc->outer_lock.
397 /* node + proc => ref (transaction) */
398 /* desc + proc => ref (transaction, inc/dec ref) */
399 /* node => refs + procs (proc exit) */
404 struct binder_proc *proc; member
417 * @threads: rbtree of binder_threads in this proc
420 * this proc ordered by node->ptr
426 * @waiting_threads: threads currently waiting for proc work
456 * @tmp_ref: temporary reference to indicate proc is in use
462 * @context: binder_context for this proc
512 * @proc: binder process for this thread
514 * @rb_node: element for proc->threads rbtree
515 * (protected by @proc->inner_lock)
516 * @waiting_thread_node: element for @proc->waiting_threads list
517 * (protected by @proc->inner_lock)
525 * (protected by @proc->inner_lock)
527 * (protected by @proc->inner_lock)
529 * (protected by @proc->inner_lock)
533 * (protected by @proc->inner_lock)
538 * (atomic since @proc->inner_lock cannot
542 * (protected by @proc->inner_lock)
547 struct binder_proc *proc; member
638 * @proc: struct binder_proc to acquire
640 * Acquires proc->outer_lock. Used to protect binder_ref
641 * structures associated with the given proc.
643 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
645 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
646 __acquires(&proc->outer_lock) in _binder_proc_lock()
650 spin_lock(&proc->outer_lock); in _binder_proc_lock()
655 * @proc: struct binder_proc to acquire
661 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
662 __releases(&proc->outer_lock) in _binder_proc_unlock()
666 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
671 * @proc: struct binder_proc to acquire
673 * Acquires proc->inner_lock. Used to protect todo lists
675 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
677 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
678 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
682 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
687 * @proc: struct binder_proc to acquire
691 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
693 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
694 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
698 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
737 * Acquires node->lock. If node->proc also acquires
738 * proc->inner_lock. Used to protect binder_node fields
743 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
748 if (node->proc) in _binder_node_inner_lock()
749 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
752 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
764 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
766 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
770 if (proc) in _binder_node_inner_unlock()
771 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
774 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
785 * @proc: binder_proc associated with list
790 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
795 binder_inner_proc_lock(proc); in binder_worklist_empty()
797 binder_inner_proc_unlock(proc); in binder_worklist_empty()
809 * Requires the proc->inner_lock to be held.
829 * Requires the proc->inner_lock to be held.
847 * Requires the proc->inner_lock to be held.
870 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
872 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
883 * @proc: binder_proc associated with list
890 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
892 binder_inner_proc_lock(proc); in binder_dequeue_work()
894 binder_inner_proc_unlock(proc); in binder_dequeue_work()
909 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
911 static void binder_free_proc(struct binder_proc *proc);
920 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
927 binder_inner_proc_lock(thread->proc); in binder_has_work()
929 binder_inner_proc_unlock(thread->proc); in binder_has_work()
942 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
948 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
961 * binder_select_thread_ilocked() - selects a thread for doing proc work.
962 * @proc: process to select a thread from
973 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
977 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
978 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
989 * binder_wakeup_thread_ilocked() - wakes up a thread for doing proc work.
990 * @proc: process to wake up a thread in
994 * This function wakes up a thread in the @proc process.
1004 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
1008 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
1018 /* Didn't find a thread waiting for proc work; this can happen in binder_wakeup_thread_ilocked()
1031 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
1034 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
1036 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
1038 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
1059 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
1062 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
1065 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
1087 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
1092 binder_inner_proc_lock(proc); in binder_get_node()
1093 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
1094 binder_inner_proc_unlock(proc); in binder_get_node()
1099 struct binder_proc *proc, in binder_init_node_ilocked() argument
1103 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
1110 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
1135 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
1137 node->proc = proc; in binder_init_node_ilocked()
1149 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
1155 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
1163 binder_inner_proc_lock(proc); in binder_new_node()
1164 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
1165 binder_inner_proc_unlock(proc); in binder_new_node()
1185 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
1188 if (proc) in binder_inc_node_nilocked()
1189 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
1194 !(node->proc && in binder_inc_node_nilocked()
1195 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
1245 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
1248 if (proc) in binder_dec_node_nilocked()
1249 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
1265 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
1267 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
1268 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
1273 if (proc) { in binder_dec_node_nilocked()
1275 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
1331 * (node->proc is NULL), use binder_dead_nodes_lock to protect
1339 if (node->proc) in binder_inc_node_tmpref()
1340 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
1344 if (node->proc) in binder_inc_node_tmpref()
1345 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
1362 if (!node->proc) in binder_dec_node_tmpref()
1368 if (!node->proc) in binder_dec_node_tmpref()
1389 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1392 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1414 * @proc: binder_proc that owns the ref
1422 * into the given proc rb_trees and node refs list.
1431 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1435 struct binder_context *context = proc->context; in binder_get_ref_for_node_olocked()
1436 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1457 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1460 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1463 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node_olocked()
1470 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1483 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1490 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1502 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1505 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1506 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1530 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1532 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1544 * Increment the ref. @ref->proc->outer_lock must be held on entry
1585 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1596 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1611 * binder_get_node_from_ref() - get the node from the given proc/desc
1612 * @proc: proc containing the ref
1617 * Given a proc and ref handle, return the associated binder_node
1622 struct binder_proc *proc, in binder_get_node_from_ref() argument
1629 binder_proc_lock(proc); in binder_get_node_from_ref()
1630 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1641 binder_proc_unlock(proc); in binder_get_node_from_ref()
1646 binder_proc_unlock(proc); in binder_get_node_from_ref()
1667 * @proc: proc containing the ref
1673 * Given a proc and ref handle, increment or decrement the ref
1678 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1686 binder_proc_lock(proc); in binder_update_ref_for_handle()
1687 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1699 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1706 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1712 * @proc: proc containing the ref
1721 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1724 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1729 * binder_inc_ref_for_node() - increment the ref for given proc/node
1730 * @proc: proc containing the ref
1736 * Given a proc and node, increment the ref. Create the ref if it
1741 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1751 binder_proc_lock(proc); in binder_inc_ref_for_node()
1752 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1754 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1758 binder_proc_lock(proc); in binder_inc_ref_for_node()
1759 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1775 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1789 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1815 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1818 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1822 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1826 * binder_proc_dec_tmpref() - decrement proc->tmp_ref
1827 * @proc: proc to decrement
1830 * handle a transaction. proc->tmp_ref is incremented when
1834 * proc if appropriate (proc has been released, all threads have
1837 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1839 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1840 proc->tmp_ref--; in binder_proc_dec_tmpref()
1841 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1842 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1843 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1844 binder_free_proc(proc); in binder_proc_dec_tmpref()
1847 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1877 * Same as binder_get_txn_from() except it also acquires the proc->inner_lock
1886 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1892 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1895 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1900 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1901 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1959 target_thread->proc->pid, in binder_send_failed_reply()
1979 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
1984 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
2026 * @proc: binder_proc owning the buffer
2040 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
2057 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
2092 * @proc: binder_proc owning the buffer
2113 struct binder_proc *proc, in binder_validate_ptr() argument
2129 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
2133 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
2144 * @proc: binder_proc owning the buffer
2181 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
2198 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
2214 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
2283 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
2294 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
2311 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
2314 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
2329 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2349 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2399 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2440 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2468 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2473 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2475 node = binder_new_node(proc, fp); in binder_translate_binder()
2481 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2487 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2520 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2526 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2530 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2533 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2539 if (node->proc == target_proc) { in binder_translate_handle()
2546 if (node->proc) in binder_translate_handle()
2547 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2549 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2553 if (node->proc) in binder_translate_handle()
2554 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2556 __release(&node->proc->inner_lock); in binder_translate_handle()
2594 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2607 proc->pid, thread->pid, in binder_translate_fd()
2617 proc->pid, thread->pid, fd); in binder_translate_fd()
2621 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2907 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2916 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2923 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2941 proc->pid, thread->pid); in binder_translate_fd_array()
2974 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
2988 proc->pid, thread->pid); in binder_fixup_parent()
2997 proc->pid, thread->pid); in binder_fixup_parent()
3005 proc->pid, thread->pid); in binder_fixup_parent()
3016 * @proc: process to send the transaction to
3017 * @thread: thread in @proc to send the transaction to (may be NULL)
3021 * wake it up. If no thread is found, the work is queued to the proc
3031 struct binder_proc *proc, in binder_proc_transaction() argument
3048 binder_inner_proc_lock(proc); in binder_proc_transaction()
3050 if (proc->is_dead || (thread && thread->is_dead)) { in binder_proc_transaction()
3051 binder_inner_proc_unlock(proc); in binder_proc_transaction()
3057 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
3062 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
3067 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
3069 binder_inner_proc_unlock(proc); in binder_proc_transaction()
3078 * @proc: returns @node->proc if valid
3079 * @error: if no @proc then returns BR_DEAD_REPLY
3089 * the transaction. We also need a tmpref on the proc while we are
3092 * Return: The target_node with refs taken or NULL if no @node->proc is NULL.
3093 * Also sets @proc if valid. If the @node->proc is NULL indicating that the
3094 * target proc has died, @error is set to BR_DEAD_REPLY
3104 if (node->proc) { in binder_get_node_refs_for_txn()
3108 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
3109 *procp = node->proc; in binder_get_node_refs_for_txn()
3117 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
3141 struct binder_context *context = proc->context; in binder_transaction()
3155 e->from_proc = proc->pid; in binder_transaction()
3160 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
3163 binder_inner_proc_lock(proc); in binder_transaction()
3166 binder_inner_proc_unlock(proc); in binder_transaction()
3168 proc->pid, thread->pid); in binder_transaction()
3177 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3183 binder_inner_proc_unlock(proc); in binder_transaction()
3191 binder_inner_proc_unlock(proc); in binder_transaction()
3196 __release(&target_thread->proc->inner_lock); in binder_transaction()
3203 proc->pid, thread->pid, in binder_transaction()
3207 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3215 target_proc = target_thread->proc; in binder_transaction()
3217 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3229 binder_proc_lock(proc); in binder_transaction()
3230 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3238 proc->pid, thread->pid); in binder_transaction()
3241 binder_proc_unlock(proc); in binder_transaction()
3252 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3254 proc->pid, thread->pid); in binder_transaction()
3270 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3276 if (security_binder_transaction(proc->cred, in binder_transaction()
3283 binder_inner_proc_lock(proc); in binder_transaction()
3294 * thread from proc->waiting_threads to enqueue in binder_transaction()
3299 proc->pid, thread->pid); in binder_transaction()
3300 binder_inner_proc_unlock(proc); in binder_transaction()
3314 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3319 binder_inner_proc_unlock(proc); in binder_transaction()
3330 if (from && from->proc == target_proc) { in binder_transaction()
3340 binder_inner_proc_unlock(proc); in binder_transaction()
3372 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3381 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3392 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3407 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3474 proc->pid, thread->pid); in binder_transaction()
3482 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3490 proc->pid, thread->pid, in binder_transaction()
3535 proc->pid, thread->pid); in binder_transaction()
3545 proc->pid, thread->pid, in binder_transaction()
3635 proc->pid, thread->pid); in binder_transaction()
3648 proc->pid, thread->pid); in binder_transaction()
3659 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3663 proc->pid, thread->pid, in binder_transaction()
3698 proc->pid, thread->pid); in binder_transaction()
3713 /* Fixup buffer pointer to target proc address space */ in binder_transaction()
3741 proc->pid, thread->pid, hdr->type); in binder_transaction()
3755 proc->pid, thread->pid); in binder_transaction()
3766 proc->pid, thread->pid); in binder_transaction()
3790 binder_inner_proc_lock(proc); in binder_transaction()
3802 binder_inner_proc_unlock(proc); in binder_transaction()
3804 binder_inner_proc_lock(proc); in binder_transaction()
3806 binder_inner_proc_unlock(proc); in binder_transaction()
3832 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3875 proc->pid, thread->pid, return_error, return_error_param, in binder_transaction()
3909 * @proc: binder proc that owns buffer
3919 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
3923 binder_inner_proc_lock(proc); in binder_free_buf()
3928 binder_inner_proc_unlock(proc); in binder_free_buf()
3936 BUG_ON(buf_node->proc != proc); in binder_free_buf()
3943 w, &proc->todo); in binder_free_buf()
3944 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
3949 binder_transaction_buffer_release(proc, thread, buffer, 0, is_failure); in binder_free_buf()
3950 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
3953 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
3959 struct binder_context *context = proc->context; in binder_thread_write()
3973 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
3997 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
3999 proc->pid, thread->pid); in binder_thread_write()
4004 proc, ctx_mgr_node, in binder_thread_write()
4011 proc, target, increment, strong, in binder_thread_write()
4015 proc->pid, thread->pid, in binder_thread_write()
4035 proc->pid, thread->pid, debug_string, in binder_thread_write()
4041 proc->pid, thread->pid, debug_string, in binder_thread_write()
4059 node = binder_get_node(proc, node_ptr); in binder_thread_write()
4062 proc->pid, thread->pid, in binder_thread_write()
4071 proc->pid, thread->pid, in binder_thread_write()
4083 proc->pid, thread->pid, in binder_thread_write()
4093 proc->pid, thread->pid, in binder_thread_write()
4106 proc->pid, thread->pid, in binder_thread_write()
4129 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4135 proc->pid, thread->pid, in binder_thread_write()
4140 proc->pid, thread->pid, in binder_thread_write()
4147 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
4150 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4161 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4172 binder_transaction(proc, thread, &tr, in binder_thread_write()
4180 proc->pid, thread->pid); in binder_thread_write()
4181 binder_inner_proc_lock(proc); in binder_thread_write()
4185 proc->pid, thread->pid); in binder_thread_write()
4186 } else if (proc->requested_threads == 0) { in binder_thread_write()
4189 proc->pid, thread->pid); in binder_thread_write()
4191 proc->requested_threads--; in binder_thread_write()
4192 proc->requested_threads_started++; in binder_thread_write()
4195 binder_inner_proc_unlock(proc); in binder_thread_write()
4200 proc->pid, thread->pid); in binder_thread_write()
4204 proc->pid, thread->pid); in binder_thread_write()
4211 proc->pid, thread->pid); in binder_thread_write()
4244 proc->pid, thread->pid); in binder_thread_write()
4248 binder_proc_lock(proc); in binder_thread_write()
4249 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4252 proc->pid, thread->pid, in binder_thread_write()
4257 binder_proc_unlock(proc); in binder_thread_write()
4264 proc->pid, thread->pid, in binder_thread_write()
4276 proc->pid, thread->pid); in binder_thread_write()
4278 binder_proc_unlock(proc); in binder_thread_write()
4286 if (ref->node->proc == NULL) { in binder_thread_write()
4289 binder_inner_proc_lock(proc); in binder_thread_write()
4291 &ref->death->work, &proc->todo); in binder_thread_write()
4292 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4293 binder_inner_proc_unlock(proc); in binder_thread_write()
4298 proc->pid, thread->pid); in binder_thread_write()
4300 binder_proc_unlock(proc); in binder_thread_write()
4306 proc->pid, thread->pid, in binder_thread_write()
4310 binder_proc_unlock(proc); in binder_thread_write()
4314 binder_inner_proc_lock(proc); in binder_thread_write()
4326 &proc->todo); in binder_thread_write()
4328 proc); in binder_thread_write()
4334 binder_inner_proc_unlock(proc); in binder_thread_write()
4337 binder_proc_unlock(proc); in binder_thread_write()
4348 binder_inner_proc_lock(proc); in binder_thread_write()
4349 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4363 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4367 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4368 binder_inner_proc_unlock(proc); in binder_thread_write()
4382 &proc->todo); in binder_thread_write()
4383 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4386 binder_inner_proc_unlock(proc); in binder_thread_write()
4391 proc->pid, thread->pid, cmd); in binder_thread_write()
4399 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4405 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4410 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4432 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4434 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4445 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4449 binder_inner_proc_lock(proc); in binder_wait_for_work()
4456 &proc->waiting_threads); in binder_wait_for_work()
4457 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4459 binder_inner_proc_lock(proc); in binder_wait_for_work()
4467 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4475 * @proc: binder_proc associated @t->buffer
4487 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4509 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4523 err = binder_alloc_copy_from_buffer(&proc->alloc, &fd, in binder_apply_fd_fixups()
4538 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4557 binder_inner_proc_lock(proc); in binder_thread_read()
4559 binder_inner_proc_unlock(proc); in binder_thread_read()
4565 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4570 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4574 binder_set_nice(proc->default_priority); in binder_thread_read()
4599 binder_inner_proc_lock(proc); in binder_thread_read()
4602 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4604 list = &proc->todo; in binder_thread_read()
4606 binder_inner_proc_unlock(proc); in binder_thread_read()
4615 binder_inner_proc_unlock(proc); in binder_thread_read()
4624 binder_inner_proc_unlock(proc); in binder_thread_read()
4632 binder_inner_proc_unlock(proc); in binder_thread_read()
4639 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4642 binder_inner_proc_unlock(proc); in binder_thread_read()
4650 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4653 proc->pid, thread->pid); in binder_thread_read()
4665 BUG_ON(proc != node->proc); in binder_thread_read()
4691 proc->pid, thread->pid, in binder_thread_read()
4695 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4696 binder_inner_proc_unlock(proc); in binder_thread_read()
4710 binder_inner_proc_unlock(proc); in binder_thread_read()
4714 proc, thread, &ptr, node_ptr, in binder_thread_read()
4719 proc, thread, &ptr, node_ptr, in binder_thread_read()
4724 proc, thread, &ptr, node_ptr, in binder_thread_read()
4729 proc, thread, &ptr, node_ptr, in binder_thread_read()
4735 proc->pid, thread->pid, in binder_thread_read()
4758 proc->pid, thread->pid, in binder_thread_read()
4764 binder_inner_proc_unlock(proc); in binder_thread_read()
4769 w, &proc->delivered_death); in binder_thread_read()
4770 binder_inner_proc_unlock(proc); in binder_thread_read()
4779 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4784 binder_inner_proc_unlock(proc); in binder_thread_read()
4786 proc->pid, thread->pid, w->type); in binder_thread_read()
4818 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4827 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
4838 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
4841 proc->pid, thread->pid, in binder_thread_read()
4850 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4889 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4892 proc->pid, thread->pid, in binder_thread_read()
4896 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
4906 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4909 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4912 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4916 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4926 binder_inner_proc_lock(proc); in binder_thread_read()
4927 if (proc->requested_threads == 0 && in binder_thread_read()
4928 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
4929 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
4933 proc->requested_threads++; in binder_thread_read()
4934 binder_inner_proc_unlock(proc); in binder_thread_read()
4937 proc->pid, thread->pid); in binder_thread_read()
4940 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
4942 binder_inner_proc_unlock(proc); in binder_thread_read()
4946 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
4953 binder_inner_proc_lock(proc); in binder_release_work()
4956 binder_inner_proc_unlock(proc); in binder_release_work()
5006 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
5010 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
5027 thread->proc = proc; in binder_get_thread_ilocked()
5033 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
5043 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
5048 binder_inner_proc_lock(proc); in binder_get_thread()
5049 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
5050 binder_inner_proc_unlock(proc); in binder_get_thread()
5055 binder_inner_proc_lock(proc); in binder_get_thread()
5056 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
5057 binder_inner_proc_unlock(proc); in binder_get_thread()
5064 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
5068 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
5069 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
5070 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
5072 kfree(proc->context->name); in binder_free_proc()
5075 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5076 put_task_struct(proc->tsk); in binder_free_proc()
5077 put_cred(proc->cred); in binder_free_proc()
5079 kfree(proc); in binder_free_proc()
5086 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5090 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5098 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5100 * take a ref on the proc so it survives in binder_thread_release()
5101 * after we remove this thread from proc->threads. in binder_thread_release()
5105 proc->tmp_ref++; in binder_thread_release()
5111 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5127 proc->pid, thread->pid, in binder_thread_release()
5160 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5174 binder_release_work(proc, &thread->todo); in binder_thread_release()
5182 struct binder_proc *proc = filp->private_data; in binder_poll() local
5186 thread = binder_get_thread(proc); in binder_poll()
5190 binder_inner_proc_lock(thread->proc); in binder_poll()
5194 binder_inner_proc_unlock(thread->proc); in binder_poll()
5209 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5224 proc->pid, thread->pid, in binder_ioctl_write_read()
5229 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5242 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5247 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5248 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5249 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5250 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5259 proc->pid, thread->pid, in binder_ioctl_write_read()
5274 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5275 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5285 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5300 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5318 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5322 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5328 proc->pid); in binder_ioctl_get_node_info_for_ref()
5335 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5341 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5354 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5362 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5363 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5374 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5382 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5388 proc->pid, current->pid, cmd, arg);*/ in binder_ioctl()
5390 binder_selftest_alloc(&proc->alloc); in binder_ioctl()
5398 thread = binder_get_thread(proc); in binder_ioctl()
5418 binder_inner_proc_lock(proc); in binder_ioctl()
5419 proc->max_threads = max_threads; in binder_ioctl()
5420 binder_inner_proc_unlock(proc); in binder_ioctl()
5442 proc->pid, thread->pid); in binder_ioctl()
5443 binder_thread_release(proc, thread); in binder_ioctl()
5468 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5487 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5519 binder_inner_proc_lock(proc); in binder_ioctl()
5522 binder_inner_proc_unlock(proc); in binder_ioctl()
5544 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5552 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5556 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5563 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5567 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5570 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5586 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5588 if (proc->tsk != current->group_leader) in binder_mmap()
5593 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5599 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5606 vma->vm_private_data = proc; in binder_mmap()
5608 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5613 struct binder_proc *proc, *itr; in binder_open() local
5622 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5623 if (proc == NULL) in binder_open()
5625 spin_lock_init(&proc->inner_lock); in binder_open()
5626 spin_lock_init(&proc->outer_lock); in binder_open()
5628 proc->tsk = current->group_leader; in binder_open()
5629 proc->cred = get_cred(filp->f_cred); in binder_open()
5630 INIT_LIST_HEAD(&proc->todo); in binder_open()
5631 proc->default_priority = task_nice(current); in binder_open()
5642 proc->context = &binder_dev->context; in binder_open()
5643 binder_alloc_init(&proc->alloc); in binder_open()
5646 proc->pid = current->group_leader->pid; in binder_open()
5647 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
5648 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
5649 filp->private_data = proc; in binder_open()
5653 if (itr->pid == proc->pid) { in binder_open()
5658 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
5664 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5666 * proc debug entries are shared between contexts. in binder_open()
5671 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
5673 (void *)(unsigned long)proc->pid, in binder_open()
5681 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5689 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
5691 proc->binderfs_entry = binderfs_entry; in binder_open()
5706 struct binder_proc *proc = filp->private_data; in binder_flush() local
5708 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
5713 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
5718 binder_inner_proc_lock(proc); in binder_deferred_flush()
5719 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
5728 binder_inner_proc_unlock(proc); in binder_deferred_flush()
5731 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
5737 struct binder_proc *proc = filp->private_data; in binder_release() local
5739 debugfs_remove(proc->debugfs_entry); in binder_release()
5741 if (proc->binderfs_entry) { in binder_release()
5742 binderfs_remove_file(proc->binderfs_entry); in binder_release()
5743 proc->binderfs_entry = NULL; in binder_release()
5746 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
5755 struct binder_proc *proc = node->proc; in binder_node_release() local
5757 binder_release_work(proc, &node->async_todo); in binder_node_release()
5760 binder_inner_proc_lock(proc); in binder_node_release()
5767 binder_inner_proc_unlock(proc); in binder_node_release()
5774 node->proc = NULL; in binder_node_release()
5777 binder_inner_proc_unlock(proc); in binder_node_release()
5791 binder_inner_proc_lock(ref->proc); in binder_node_release()
5793 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5802 &ref->proc->todo); in binder_node_release()
5803 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
5804 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5816 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
5818 struct binder_context *context = proc->context; in binder_deferred_release()
5823 hlist_del(&proc->proc_node); in binder_deferred_release()
5828 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
5831 __func__, proc->pid); in binder_deferred_release()
5835 binder_inner_proc_lock(proc); in binder_deferred_release()
5837 * Make sure proc stays alive after we in binder_deferred_release()
5840 proc->tmp_ref++; in binder_deferred_release()
5842 proc->is_dead = true; in binder_deferred_release()
5845 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
5849 binder_inner_proc_unlock(proc); in binder_deferred_release()
5851 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
5852 binder_inner_proc_lock(proc); in binder_deferred_release()
5857 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
5868 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
5869 binder_inner_proc_unlock(proc); in binder_deferred_release()
5871 binder_inner_proc_lock(proc); in binder_deferred_release()
5873 binder_inner_proc_unlock(proc); in binder_deferred_release()
5876 binder_proc_lock(proc); in binder_deferred_release()
5877 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
5883 binder_proc_unlock(proc); in binder_deferred_release()
5885 binder_proc_lock(proc); in binder_deferred_release()
5887 binder_proc_unlock(proc); in binder_deferred_release()
5889 binder_release_work(proc, &proc->todo); in binder_deferred_release()
5890 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
5894 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
5897 binder_proc_dec_tmpref(proc); in binder_deferred_release()
5902 struct binder_proc *proc; in binder_deferred_func() local
5909 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
5911 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
5912 defer = proc->deferred_work; in binder_deferred_func()
5913 proc->deferred_work = 0; in binder_deferred_func()
5915 proc = NULL; in binder_deferred_func()
5921 binder_deferred_flush(proc); in binder_deferred_func()
5924 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
5925 } while (proc); in binder_deferred_func()
5930 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
5933 proc->deferred_work |= defer; in binder_defer_work()
5934 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
5935 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
5943 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
5955 t->from ? t->from->proc->pid : 0, in print_binder_transaction_ilocked()
5962 if (proc != to_proc) { in print_binder_transaction_ilocked()
5965 * correct proc inner lock for this node in print_binder_transaction_ilocked()
5983 struct binder_proc *proc, in print_binder_work_ilocked() argument
5995 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6045 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6049 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6053 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6059 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6083 seq_puts(m, " proc"); in print_binder_node_nilocked()
6085 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6088 if (node->proc) { in print_binder_node_nilocked()
6090 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6101 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6108 struct binder_proc *proc, int print_all) in print_binder_proc() argument
6116 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6117 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6120 binder_inner_proc_lock(proc); in print_binder_proc()
6121 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
6125 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
6138 binder_inner_proc_unlock(proc); in print_binder_proc()
6145 binder_inner_proc_lock(proc); in print_binder_proc()
6147 binder_inner_proc_unlock(proc); in print_binder_proc()
6152 binder_proc_lock(proc); in print_binder_proc()
6153 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
6159 binder_proc_unlock(proc); in print_binder_proc()
6161 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6162 binder_inner_proc_lock(proc); in print_binder_proc()
6163 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6164 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6166 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6170 binder_inner_proc_unlock(proc); in print_binder_proc()
6219 "proc",
6271 struct binder_proc *proc) in print_binder_proc_stats() argument
6278 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6280 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6281 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6284 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6285 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6288 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6294 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6295 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6299 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6301 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6306 binder_proc_lock(proc); in print_binder_proc_stats()
6307 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
6314 binder_proc_unlock(proc); in print_binder_proc_stats()
6317 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6320 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6323 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6324 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6328 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6331 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6337 struct binder_proc *proc; in binder_state_show() local
6367 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_state_show()
6368 print_binder_proc(m, proc, 1); in binder_state_show()
6376 struct binder_proc *proc; in binder_stats_show() local
6383 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_stats_show()
6384 print_binder_proc_stats(m, proc); in binder_stats_show()
6392 struct binder_proc *proc; in binder_transactions_show() local
6396 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transactions_show()
6397 print_binder_proc(m, proc, 0); in binder_transactions_show()
6411 seq_puts(m, "binder proc state:\n"); in proc_show()
6525 binder_debugfs_dir_entry_proc = debugfs_create_dir("proc", in binder_init()