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);
239 * There are separate work lists for proc, thread, and node (async).
266 * (protected by @proc->inner_lock)
267 * @rb_node: element for proc->nodes tree
268 * (protected by @proc->inner_lock)
271 * @proc: binder_proc that owns this node
277 * (protected by @proc->inner_lock if @proc
280 * (protected by @proc->inner_lock if @proc
283 * (protected by @proc->inner_lock if @proc
286 * (protected by @proc->inner_lock while @proc
288 * if @proc is NULL. During inc/dec and node release
290 * as the node dies and @proc becomes NULL)
296 * (protected by @proc->inner_lock if @proc
299 * (protected by @proc->inner_lock if @proc
302 * (protected by @proc->inner_lock if @proc
305 * (protected by @proc->inner_lock if @proc
316 * (protected by @proc->inner_lock)
328 struct binder_proc *proc; member
339 * proc inner_lock
361 * (protected by inner_lock of the proc that
390 * @rb_node_desc: node for lookup by @data.desc in proc's rb_tree
391 * @rb_node_node: node for lookup by @node in proc's rb_tree
394 * @proc: binder_proc containing ref
402 * structure is unsafe to access without holding @proc->outer_lock.
406 /* node + proc => ref (transaction) */
407 /* desc + proc => ref (transaction, inc/dec ref) */
408 /* node => refs + procs (proc exit) */
413 struct binder_proc *proc; member
426 * @threads: rbtree of binder_threads in this proc
429 * this proc ordered by node->ptr
435 * @waiting_threads: threads currently waiting for proc work
465 * @tmp_ref: temporary reference to indicate proc is in use
471 * @context: binder_context for this proc
521 * @proc: binder process for this thread
523 * @rb_node: element for proc->threads rbtree
524 * (protected by @proc->inner_lock)
525 * @waiting_thread_node: element for @proc->waiting_threads list
526 * (protected by @proc->inner_lock)
534 * (protected by @proc->inner_lock)
536 * (protected by @proc->inner_lock)
538 * (protected by @proc->inner_lock)
542 * (protected by @proc->inner_lock)
547 * (atomic since @proc->inner_lock cannot
551 * (protected by @proc->inner_lock)
556 struct binder_proc *proc; member
652 * @proc: struct binder_proc to acquire
654 * Acquires proc->outer_lock. Used to protect binder_ref
655 * structures associated with the given proc.
657 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
659 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
660 __acquires(&proc->outer_lock) in _binder_proc_lock()
664 spin_lock(&proc->outer_lock); in _binder_proc_lock()
669 * @proc: struct binder_proc to acquire
675 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
676 __releases(&proc->outer_lock) in _binder_proc_unlock()
680 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
685 * @proc: struct binder_proc to acquire
687 * Acquires proc->inner_lock. Used to protect todo lists
689 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
691 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
692 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
696 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
701 * @proc: struct binder_proc to acquire
705 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
707 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
708 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
712 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
751 * Acquires node->lock. If node->proc also acquires
752 * proc->inner_lock. Used to protect binder_node fields
757 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
762 if (node->proc) in _binder_node_inner_lock()
763 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
766 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
778 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
780 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
784 if (proc) in _binder_node_inner_unlock()
785 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
788 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
799 * @proc: binder_proc associated with list
804 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
809 binder_inner_proc_lock(proc); in binder_worklist_empty()
811 binder_inner_proc_unlock(proc); in binder_worklist_empty()
823 * Requires the proc->inner_lock to be held.
843 * Requires the proc->inner_lock to be held.
861 * Requires the proc->inner_lock to be held.
884 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
886 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
897 * @proc: binder_proc associated with list
904 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
906 binder_inner_proc_lock(proc); in binder_dequeue_work()
908 binder_inner_proc_unlock(proc); in binder_dequeue_work()
923 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
925 static void binder_free_proc(struct binder_proc *proc);
944 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
951 binder_inner_proc_lock(thread->proc); in binder_has_work()
953 binder_inner_proc_unlock(thread->proc); in binder_has_work()
966 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
972 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
985 * binder_select_thread_ilocked() - selects a thread for doing proc work.
986 * @proc: process to select a thread from
997 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
1001 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
1002 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
1013 * binder_wakeup_thread_ilocked() - wakes up a thread for doing proc work.
1014 * @proc: process to wake up a thread in
1018 * This function wakes up a thread in the @proc process.
1028 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
1032 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
1042 /* Didn't find a thread waiting for proc work; this can happen in binder_wakeup_thread_ilocked()
1055 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
1058 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
1060 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
1062 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
1083 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
1086 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
1089 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
1111 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
1116 binder_inner_proc_lock(proc); in binder_get_node()
1117 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
1118 binder_inner_proc_unlock(proc); in binder_get_node()
1123 struct binder_proc *proc, in binder_init_node_ilocked() argument
1127 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
1134 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
1159 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
1161 node->proc = proc; in binder_init_node_ilocked()
1173 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
1179 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
1187 binder_inner_proc_lock(proc); in binder_new_node()
1188 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
1189 binder_inner_proc_unlock(proc); in binder_new_node()
1209 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
1212 if (proc) in binder_inc_node_nilocked()
1213 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
1218 !(node->proc && in binder_inc_node_nilocked()
1219 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
1269 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
1272 if (proc) in binder_dec_node_nilocked()
1273 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
1289 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
1291 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
1292 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
1297 if (proc) { in binder_dec_node_nilocked()
1299 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
1355 * (node->proc is NULL), use binder_dead_nodes_lock to protect
1363 if (node->proc) in binder_inc_node_tmpref()
1364 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
1368 if (node->proc) in binder_inc_node_tmpref()
1369 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
1386 if (!node->proc) in binder_dec_node_tmpref()
1392 if (!node->proc) in binder_dec_node_tmpref()
1413 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1416 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1438 * @proc: binder_proc that owns the ref
1446 * into the given proc rb_trees and node refs list.
1455 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1459 struct binder_context *context = proc->context; in binder_get_ref_for_node_olocked()
1460 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1481 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1484 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1487 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node_olocked()
1494 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1507 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1514 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1526 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1529 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1530 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1554 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1556 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1568 * Increment the ref. @ref->proc->outer_lock must be held on entry
1609 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1620 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1635 * binder_get_node_from_ref() - get the node from the given proc/desc
1636 * @proc: proc containing the ref
1641 * Given a proc and ref handle, return the associated binder_node
1646 struct binder_proc *proc, in binder_get_node_from_ref() argument
1653 binder_proc_lock(proc); in binder_get_node_from_ref()
1654 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1665 binder_proc_unlock(proc); in binder_get_node_from_ref()
1670 binder_proc_unlock(proc); in binder_get_node_from_ref()
1691 * @proc: proc containing the ref
1697 * Given a proc and ref handle, increment or decrement the ref
1702 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1710 binder_proc_lock(proc); in binder_update_ref_for_handle()
1711 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1723 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1730 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1736 * @proc: proc containing the ref
1745 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1748 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1753 * binder_inc_ref_for_node() - increment the ref for given proc/node
1754 * @proc: proc containing the ref
1760 * Given a proc and node, increment the ref. Create the ref if it
1765 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1775 binder_proc_lock(proc); in binder_inc_ref_for_node()
1776 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1778 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1782 binder_proc_lock(proc); in binder_inc_ref_for_node()
1783 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1799 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1813 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1839 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1842 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1846 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1850 * binder_proc_dec_tmpref() - decrement proc->tmp_ref
1851 * @proc: proc to decrement
1854 * handle a transaction. proc->tmp_ref is incremented when
1858 * proc if appropriate (proc has been released, all threads have
1861 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1863 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1864 proc->tmp_ref--; in binder_proc_dec_tmpref()
1865 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1866 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1867 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1868 binder_free_proc(proc); in binder_proc_dec_tmpref()
1871 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1901 * Same as binder_get_txn_from() except it also acquires the proc->inner_lock
1910 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1916 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1919 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1924 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1925 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1983 target_thread->proc->pid, in binder_send_failed_reply()
2003 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
2008 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
2050 * @proc: binder_proc owning the buffer
2064 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
2081 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
2116 * @proc: binder_proc owning the buffer
2137 struct binder_proc *proc, in binder_validate_ptr() argument
2153 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
2157 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
2168 * @proc: binder_proc owning the buffer
2205 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
2222 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
2238 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
2307 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
2318 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
2335 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
2338 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
2353 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2373 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2423 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2464 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2492 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2497 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2499 node = binder_new_node(proc, fp); in binder_translate_binder()
2505 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2511 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2544 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2550 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2554 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2557 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2563 if (node->proc == target_proc) { in binder_translate_handle()
2570 if (node->proc) in binder_translate_handle()
2571 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2573 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2577 if (node->proc) in binder_translate_handle()
2578 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2580 __release(&node->proc->inner_lock); in binder_translate_handle()
2618 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2631 proc->pid, thread->pid, in binder_translate_fd()
2641 proc->pid, thread->pid, fd); in binder_translate_fd()
2645 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2931 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2940 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2947 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2965 proc->pid, thread->pid); in binder_translate_fd_array()
2998 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
3012 proc->pid, thread->pid); in binder_fixup_parent()
3021 proc->pid, thread->pid); in binder_fixup_parent()
3029 proc->pid, thread->pid); in binder_fixup_parent()
3040 * @proc: process to send the transaction to
3041 * @thread: thread in @proc to send the transaction to (may be NULL)
3045 * wake it up. If no thread is found, the work is queued to the proc
3055 struct binder_proc *proc, in binder_proc_transaction() argument
3072 binder_inner_proc_lock(proc); in binder_proc_transaction()
3074 if (proc->is_dead || (thread && thread->is_dead)) { in binder_proc_transaction()
3075 binder_inner_proc_unlock(proc); in binder_proc_transaction()
3081 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
3086 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
3091 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
3093 binder_inner_proc_unlock(proc); in binder_proc_transaction()
3102 * @proc: returns @node->proc if valid
3103 * @error: if no @proc then returns BR_DEAD_REPLY
3113 * the transaction. We also need a tmpref on the proc while we are
3116 * Return: The target_node with refs taken or NULL if no @node->proc is NULL.
3117 * Also sets @proc if valid. If the @node->proc is NULL indicating that the
3118 * target proc has died, @error is set to BR_DEAD_REPLY
3128 if (node->proc) { in binder_get_node_refs_for_txn()
3132 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
3133 *procp = node->proc; in binder_get_node_refs_for_txn()
3141 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
3165 struct binder_context *context = proc->context; in binder_transaction()
3179 e->from_proc = proc->pid; in binder_transaction()
3184 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
3187 binder_inner_proc_lock(proc); in binder_transaction()
3190 binder_inner_proc_unlock(proc); in binder_transaction()
3192 proc->pid, thread->pid); in binder_transaction()
3201 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3207 binder_inner_proc_unlock(proc); in binder_transaction()
3215 binder_inner_proc_unlock(proc); in binder_transaction()
3220 __release(&target_thread->proc->inner_lock); in binder_transaction()
3227 proc->pid, thread->pid, in binder_transaction()
3231 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3239 target_proc = target_thread->proc; in binder_transaction()
3241 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3253 binder_proc_lock(proc); in binder_transaction()
3254 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3262 proc->pid, thread->pid); in binder_transaction()
3265 binder_proc_unlock(proc); in binder_transaction()
3276 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3278 proc->pid, thread->pid); in binder_transaction()
3294 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3300 if (security_binder_transaction(proc->cred, in binder_transaction()
3307 binder_inner_proc_lock(proc); in binder_transaction()
3318 * thread from proc->waiting_threads to enqueue in binder_transaction()
3323 proc->pid, thread->pid); in binder_transaction()
3324 binder_inner_proc_unlock(proc); in binder_transaction()
3338 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3343 binder_inner_proc_unlock(proc); in binder_transaction()
3354 if (from && from->proc == target_proc) { in binder_transaction()
3364 binder_inner_proc_unlock(proc); in binder_transaction()
3396 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3405 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3421 t->async_from_pid = thread->proc->pid; in binder_transaction()
3425 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3440 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3507 proc->pid, thread->pid); in binder_transaction()
3515 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3523 proc->pid, thread->pid, in binder_transaction()
3568 proc->pid, thread->pid); in binder_transaction()
3578 proc->pid, thread->pid, in binder_transaction()
3668 proc->pid, thread->pid); in binder_transaction()
3681 proc->pid, thread->pid); in binder_transaction()
3692 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3696 proc->pid, thread->pid, in binder_transaction()
3731 proc->pid, thread->pid); in binder_transaction()
3746 /* Fixup buffer pointer to target proc address space */ in binder_transaction()
3774 proc->pid, thread->pid, hdr->type); in binder_transaction()
3788 proc->pid, thread->pid); in binder_transaction()
3799 proc->pid, thread->pid); in binder_transaction()
3826 binder_inner_proc_lock(proc); in binder_transaction()
3841 binder_inner_proc_unlock(proc); in binder_transaction()
3843 binder_inner_proc_lock(proc); in binder_transaction()
3845 binder_inner_proc_unlock(proc); in binder_transaction()
3874 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3917 proc->pid, thread->pid, return_error, return_error_param, in binder_transaction()
3951 * @proc: binder proc that owns buffer
3961 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
3965 binder_inner_proc_lock(proc); in binder_free_buf()
3970 binder_inner_proc_unlock(proc); in binder_free_buf()
3978 BUG_ON(buf_node->proc != proc); in binder_free_buf()
3985 w, &proc->todo); in binder_free_buf()
3986 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
3991 binder_transaction_buffer_release(proc, thread, buffer, 0, is_failure); in binder_free_buf()
3992 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
3995 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
4001 struct binder_context *context = proc->context; in binder_thread_write()
4015 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
4039 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
4041 proc->pid, thread->pid); in binder_thread_write()
4046 proc, ctx_mgr_node, in binder_thread_write()
4053 proc, target, increment, strong, in binder_thread_write()
4057 proc->pid, thread->pid, in binder_thread_write()
4077 proc->pid, thread->pid, debug_string, in binder_thread_write()
4083 proc->pid, thread->pid, debug_string, in binder_thread_write()
4101 node = binder_get_node(proc, node_ptr); in binder_thread_write()
4104 proc->pid, thread->pid, in binder_thread_write()
4113 proc->pid, thread->pid, in binder_thread_write()
4125 proc->pid, thread->pid, in binder_thread_write()
4135 proc->pid, thread->pid, in binder_thread_write()
4148 proc->pid, thread->pid, in binder_thread_write()
4171 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4177 proc->pid, thread->pid, in binder_thread_write()
4182 proc->pid, thread->pid, in binder_thread_write()
4189 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
4192 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4203 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4214 binder_transaction(proc, thread, &tr, in binder_thread_write()
4222 proc->pid, thread->pid); in binder_thread_write()
4223 binder_inner_proc_lock(proc); in binder_thread_write()
4227 proc->pid, thread->pid); in binder_thread_write()
4228 } else if (proc->requested_threads == 0) { in binder_thread_write()
4231 proc->pid, thread->pid); in binder_thread_write()
4233 proc->requested_threads--; in binder_thread_write()
4234 proc->requested_threads_started++; in binder_thread_write()
4237 binder_inner_proc_unlock(proc); in binder_thread_write()
4242 proc->pid, thread->pid); in binder_thread_write()
4246 proc->pid, thread->pid); in binder_thread_write()
4253 proc->pid, thread->pid); in binder_thread_write()
4286 proc->pid, thread->pid); in binder_thread_write()
4290 binder_proc_lock(proc); in binder_thread_write()
4291 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4294 proc->pid, thread->pid, in binder_thread_write()
4299 binder_proc_unlock(proc); in binder_thread_write()
4306 proc->pid, thread->pid, in binder_thread_write()
4318 proc->pid, thread->pid); in binder_thread_write()
4320 binder_proc_unlock(proc); in binder_thread_write()
4328 if (ref->node->proc == NULL) { in binder_thread_write()
4331 binder_inner_proc_lock(proc); in binder_thread_write()
4333 &ref->death->work, &proc->todo); in binder_thread_write()
4334 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4335 binder_inner_proc_unlock(proc); in binder_thread_write()
4340 proc->pid, thread->pid); in binder_thread_write()
4342 binder_proc_unlock(proc); in binder_thread_write()
4348 proc->pid, thread->pid, in binder_thread_write()
4352 binder_proc_unlock(proc); in binder_thread_write()
4356 binder_inner_proc_lock(proc); in binder_thread_write()
4368 &proc->todo); in binder_thread_write()
4370 proc); in binder_thread_write()
4376 binder_inner_proc_unlock(proc); in binder_thread_write()
4379 binder_proc_unlock(proc); in binder_thread_write()
4390 binder_inner_proc_lock(proc); in binder_thread_write()
4391 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4405 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4409 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4410 binder_inner_proc_unlock(proc); in binder_thread_write()
4424 &proc->todo); in binder_thread_write()
4425 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4428 binder_inner_proc_unlock(proc); in binder_thread_write()
4433 proc->pid, thread->pid, cmd); in binder_thread_write()
4441 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4447 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4452 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4474 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4476 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4487 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4491 binder_inner_proc_lock(proc); in binder_wait_for_work()
4498 &proc->waiting_threads); in binder_wait_for_work()
4499 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4501 binder_inner_proc_lock(proc); in binder_wait_for_work()
4509 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4517 * @proc: binder_proc associated @t->buffer
4529 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4551 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4565 err = binder_alloc_copy_from_buffer(&proc->alloc, &fd, in binder_apply_fd_fixups()
4580 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4599 binder_inner_proc_lock(proc); in binder_thread_read()
4601 binder_inner_proc_unlock(proc); in binder_thread_read()
4607 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4612 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4616 binder_set_nice(proc->default_priority); in binder_thread_read()
4641 binder_inner_proc_lock(proc); in binder_thread_read()
4644 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4646 list = &proc->todo; in binder_thread_read()
4648 binder_inner_proc_unlock(proc); in binder_thread_read()
4657 binder_inner_proc_unlock(proc); in binder_thread_read()
4666 binder_inner_proc_unlock(proc); in binder_thread_read()
4674 binder_inner_proc_unlock(proc); in binder_thread_read()
4681 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4684 binder_inner_proc_unlock(proc); in binder_thread_read()
4692 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4695 proc->pid, thread->pid); in binder_thread_read()
4707 BUG_ON(proc != node->proc); in binder_thread_read()
4733 proc->pid, thread->pid, in binder_thread_read()
4737 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4738 binder_inner_proc_unlock(proc); in binder_thread_read()
4752 binder_inner_proc_unlock(proc); in binder_thread_read()
4756 proc, thread, &ptr, node_ptr, in binder_thread_read()
4761 proc, thread, &ptr, node_ptr, in binder_thread_read()
4766 proc, thread, &ptr, node_ptr, in binder_thread_read()
4771 proc, thread, &ptr, node_ptr, in binder_thread_read()
4777 proc->pid, thread->pid, in binder_thread_read()
4800 proc->pid, thread->pid, in binder_thread_read()
4806 binder_inner_proc_unlock(proc); in binder_thread_read()
4811 w, &proc->delivered_death); in binder_thread_read()
4812 binder_inner_proc_unlock(proc); in binder_thread_read()
4821 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4826 binder_inner_proc_unlock(proc); in binder_thread_read()
4828 proc->pid, thread->pid, w->type); in binder_thread_read()
4860 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4869 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
4880 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
4883 proc->pid, thread->pid, in binder_thread_read()
4892 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4931 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4934 proc->pid, thread->pid, in binder_thread_read()
4938 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
4948 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4951 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4954 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4958 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4968 binder_inner_proc_lock(proc); in binder_thread_read()
4969 if (proc->requested_threads == 0 && in binder_thread_read()
4970 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
4971 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
4975 proc->requested_threads++; in binder_thread_read()
4976 binder_inner_proc_unlock(proc); in binder_thread_read()
4979 proc->pid, thread->pid); in binder_thread_read()
4982 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
4984 binder_inner_proc_unlock(proc); in binder_thread_read()
4988 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
4995 binder_inner_proc_lock(proc); in binder_release_work()
4998 binder_inner_proc_unlock(proc); in binder_release_work()
5048 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
5052 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
5069 thread->proc = proc; in binder_get_thread_ilocked()
5075 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
5085 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
5090 binder_inner_proc_lock(proc); in binder_get_thread()
5091 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
5092 binder_inner_proc_unlock(proc); in binder_get_thread()
5097 binder_inner_proc_lock(proc); in binder_get_thread()
5098 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
5099 binder_inner_proc_unlock(proc); in binder_get_thread()
5106 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
5110 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
5111 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
5112 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
5114 kfree(proc->context->name); in binder_free_proc()
5117 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5118 put_task_struct(proc->tsk); in binder_free_proc()
5119 put_cred(proc->cred); in binder_free_proc()
5121 kfree(proc); in binder_free_proc()
5128 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5132 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5140 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5142 * take a ref on the proc so it survives in binder_thread_release()
5143 * after we remove this thread from proc->threads. in binder_thread_release()
5147 proc->tmp_ref++; in binder_thread_release()
5153 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5169 proc->pid, thread->pid, in binder_thread_release()
5206 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5220 binder_release_work(proc, &thread->todo); in binder_thread_release()
5228 struct binder_proc *proc = filp->private_data; in binder_poll() local
5232 thread = binder_get_thread(proc); in binder_poll()
5236 binder_inner_proc_lock(thread->proc); in binder_poll()
5240 binder_inner_proc_unlock(thread->proc); in binder_poll()
5255 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5270 proc->pid, thread->pid, in binder_ioctl_write_read()
5275 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5288 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5293 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5294 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5295 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5296 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5305 proc->pid, thread->pid, in binder_ioctl_write_read()
5320 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5321 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5331 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5346 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5364 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5368 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5374 proc->pid); in binder_ioctl_get_node_info_for_ref()
5381 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5387 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5400 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5408 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5409 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5420 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5428 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5434 proc->pid, current->pid, cmd, arg);*/ in binder_ioctl()
5436 binder_selftest_alloc(&proc->alloc); in binder_ioctl()
5444 thread = binder_get_thread(proc); in binder_ioctl()
5464 binder_inner_proc_lock(proc); in binder_ioctl()
5465 proc->max_threads = max_threads; in binder_ioctl()
5466 binder_inner_proc_unlock(proc); in binder_ioctl()
5488 proc->pid, thread->pid); in binder_ioctl()
5489 binder_thread_release(proc, thread); in binder_ioctl()
5514 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5533 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5565 binder_inner_proc_lock(proc); in binder_ioctl()
5568 binder_inner_proc_unlock(proc); in binder_ioctl()
5590 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5598 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5602 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5609 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5613 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5616 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5632 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5634 if (proc->tsk != current->group_leader) in binder_mmap()
5639 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5645 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5652 vma->vm_private_data = proc; in binder_mmap()
5654 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5659 struct binder_proc *proc, *itr; in binder_open() local
5668 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5669 if (proc == NULL) in binder_open()
5671 spin_lock_init(&proc->inner_lock); in binder_open()
5672 spin_lock_init(&proc->outer_lock); in binder_open()
5674 proc->tsk = current->group_leader; in binder_open()
5675 proc->cred = get_cred(filp->f_cred); in binder_open()
5676 INIT_LIST_HEAD(&proc->todo); in binder_open()
5677 proc->default_priority = task_nice(current); in binder_open()
5688 proc->context = &binder_dev->context; in binder_open()
5689 binder_alloc_init(&proc->alloc); in binder_open()
5692 proc->pid = current->group_leader->pid; in binder_open()
5693 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
5694 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
5695 filp->private_data = proc; in binder_open()
5699 if (itr->pid == proc->pid) { in binder_open()
5704 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
5710 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5712 * proc debug entries are shared between contexts. in binder_open()
5717 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
5719 (void *)(unsigned long)proc->pid, in binder_open()
5727 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5735 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
5737 proc->binderfs_entry = binderfs_entry; in binder_open()
5752 struct binder_proc *proc = filp->private_data; in binder_flush() local
5754 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
5759 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
5764 binder_inner_proc_lock(proc); in binder_deferred_flush()
5765 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
5774 binder_inner_proc_unlock(proc); in binder_deferred_flush()
5777 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
5783 struct binder_proc *proc = filp->private_data; in binder_release() local
5785 debugfs_remove(proc->debugfs_entry); in binder_release()
5787 if (proc->binderfs_entry) { in binder_release()
5788 binderfs_remove_file(proc->binderfs_entry); in binder_release()
5789 proc->binderfs_entry = NULL; in binder_release()
5792 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
5801 struct binder_proc *proc = node->proc; in binder_node_release() local
5803 binder_release_work(proc, &node->async_todo); in binder_node_release()
5806 binder_inner_proc_lock(proc); in binder_node_release()
5813 binder_inner_proc_unlock(proc); in binder_node_release()
5820 node->proc = NULL; in binder_node_release()
5823 binder_inner_proc_unlock(proc); in binder_node_release()
5837 binder_inner_proc_lock(ref->proc); in binder_node_release()
5839 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5848 &ref->proc->todo); in binder_node_release()
5849 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
5850 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5862 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
5864 struct binder_context *context = proc->context; in binder_deferred_release()
5869 hlist_del(&proc->proc_node); in binder_deferred_release()
5874 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
5877 __func__, proc->pid); in binder_deferred_release()
5881 binder_inner_proc_lock(proc); in binder_deferred_release()
5883 * Make sure proc stays alive after we in binder_deferred_release()
5886 proc->tmp_ref++; in binder_deferred_release()
5888 proc->is_dead = true; in binder_deferred_release()
5891 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
5895 binder_inner_proc_unlock(proc); in binder_deferred_release()
5897 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
5898 binder_inner_proc_lock(proc); in binder_deferred_release()
5903 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
5914 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
5915 binder_inner_proc_unlock(proc); in binder_deferred_release()
5917 binder_inner_proc_lock(proc); in binder_deferred_release()
5919 binder_inner_proc_unlock(proc); in binder_deferred_release()
5922 binder_proc_lock(proc); in binder_deferred_release()
5923 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
5929 binder_proc_unlock(proc); in binder_deferred_release()
5931 binder_proc_lock(proc); in binder_deferred_release()
5933 binder_proc_unlock(proc); in binder_deferred_release()
5935 binder_release_work(proc, &proc->todo); in binder_deferred_release()
5936 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
5940 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
5943 binder_proc_dec_tmpref(proc); in binder_deferred_release()
5948 struct binder_proc *proc; in binder_deferred_func() local
5955 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
5957 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
5958 defer = proc->deferred_work; in binder_deferred_func()
5959 proc->deferred_work = 0; in binder_deferred_func()
5961 proc = NULL; in binder_deferred_func()
5967 binder_deferred_flush(proc); in binder_deferred_func()
5970 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
5971 } while (proc); in binder_deferred_func()
5976 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
5979 proc->deferred_work |= defer; in binder_defer_work()
5980 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
5981 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
5989 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
6001 t->from ? t->from->proc->pid : 0, in print_binder_transaction_ilocked()
6008 if (proc != to_proc) { in print_binder_transaction_ilocked()
6011 * correct proc inner lock for this node in print_binder_transaction_ilocked()
6029 struct binder_proc *proc, in print_binder_work_ilocked() argument
6041 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6091 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6095 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6099 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6105 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6129 seq_puts(m, " proc"); in print_binder_node_nilocked()
6131 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6134 if (node->proc) { in print_binder_node_nilocked()
6136 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6147 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6154 struct binder_proc *proc, int print_all) in print_binder_proc() argument
6162 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6163 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6166 binder_inner_proc_lock(proc); in print_binder_proc()
6167 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
6171 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
6184 binder_inner_proc_unlock(proc); in print_binder_proc()
6191 binder_inner_proc_lock(proc); in print_binder_proc()
6193 binder_inner_proc_unlock(proc); in print_binder_proc()
6198 binder_proc_lock(proc); in print_binder_proc()
6199 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
6205 binder_proc_unlock(proc); in print_binder_proc()
6207 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6208 binder_inner_proc_lock(proc); in print_binder_proc()
6209 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6210 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6212 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6216 binder_inner_proc_unlock(proc); in print_binder_proc()
6265 "proc",
6317 struct binder_proc *proc) in print_binder_proc_stats() argument
6324 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6326 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6327 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6330 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6331 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6334 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6340 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6341 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6345 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6347 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6352 binder_proc_lock(proc); in print_binder_proc_stats()
6353 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
6360 binder_proc_unlock(proc); in print_binder_proc_stats()
6363 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6366 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6369 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6370 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6374 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6377 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6383 struct binder_proc *proc; in binder_state_show() local
6413 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_state_show()
6414 print_binder_proc(m, proc, 1); in binder_state_show()
6422 struct binder_proc *proc; in binder_stats_show() local
6429 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_stats_show()
6430 print_binder_proc_stats(m, proc); in binder_stats_show()
6438 struct binder_proc *proc; in binder_transactions_show() local
6442 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transactions_show()
6443 print_binder_proc(m, proc, 0); in binder_transactions_show()
6457 seq_puts(m, "binder proc state:\n"); in proc_show()
6540 from_pid = t->from ? (t->from->proc ? t->from->proc->pid : 0) : t->async_from_pid; in print_binder_transaction_brief_ilocked()
6574 struct binder_proc *proc, in print_binder_transaction_brief() argument
6584 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6585 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6601 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6610 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6618 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6620 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6630 struct binder_proc *proc) in print_binder_proc_brief() argument
6634 size_t free_async_space = binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_brief()
6636 seq_printf(m, "%d\t", proc->pid); in print_binder_proc_brief()
6637 seq_printf(m, "%s\t", proc->context->name); in print_binder_proc_brief()
6639 binder_inner_proc_lock(proc); in print_binder_proc_brief()
6640 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_brief()
6644 "\t%zd\n", proc->requested_threads, in print_binder_proc_brief()
6645 proc->requested_threads_started, proc->max_threads, in print_binder_proc_brief()
6648 binder_inner_proc_unlock(proc); in print_binder_proc_brief()
6653 struct binder_proc *proc = NULL; in binder_transaction_proc_show() local
6658 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6659 print_binder_transaction_brief(m, proc, now); in binder_transaction_proc_show()
6662 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6663 print_binder_proc_brief(m, proc); in binder_transaction_proc_show()
6717 binder_debugfs_dir_entry_proc = debugfs_create_dir("proc", in binder_init()