• Home
  • Raw
  • Download

Lines Matching full:proc

15  * 1) proc->outer_lock : protects binder_ref
21 * 3) proc->inner_lock : protects the thread and node lists
22 * (proc->threads, proc->waiting_threads, proc->nodes)
24 * (proc->todo, thread->todo, proc->delivered_death and
37 * foo_ilocked() : requires proc->inner_lock
38 * foo_oilocked(): requires proc->outer_lock and proc->inner_lock
39 * foo_nilocked(): requires node->lock and proc->inner_lock
97 DEFINE_SHOW_ATTRIBUTE(proc);
290 * @proc: struct binder_proc to acquire
292 * Acquires proc->outer_lock. Used to protect binder_ref
293 * structures associated with the given proc.
295 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
297 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
298 __acquires(&proc->outer_lock) in _binder_proc_lock()
302 spin_lock(&proc->outer_lock); in _binder_proc_lock()
307 * @proc: struct binder_proc to acquire
311 #define binder_proc_unlock(proc) _binder_proc_unlock(proc, __LINE__) argument
313 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
314 __releases(&proc->outer_lock) in _binder_proc_unlock()
318 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
323 * @proc: struct binder_proc to acquire
325 * Acquires proc->inner_lock. Used to protect todo lists
327 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
329 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
330 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
334 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
339 * @proc: struct binder_proc to acquire
343 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
345 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
346 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
350 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
389 * Acquires node->lock. If node->proc also acquires
390 * proc->inner_lock. Used to protect binder_node fields
395 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
400 if (node->proc) in _binder_node_inner_lock()
401 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
404 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
416 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
418 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
422 if (proc) in _binder_node_inner_unlock()
423 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
426 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
437 * @proc: binder_proc associated with list
442 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
447 binder_inner_proc_lock(proc); in binder_worklist_empty()
449 binder_inner_proc_unlock(proc); in binder_worklist_empty()
461 * Requires the proc->inner_lock to be held.
481 * Requires the proc->inner_lock to be held.
499 * Requires the proc->inner_lock to be held.
532 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
534 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
545 * @proc: binder_proc associated with list
552 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
554 binder_inner_proc_lock(proc); in binder_dequeue_work()
556 binder_inner_proc_unlock(proc); in binder_dequeue_work()
571 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
573 static void binder_free_proc(struct binder_proc *proc);
592 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
599 binder_inner_proc_lock(thread->proc); in binder_has_work()
601 binder_inner_proc_unlock(thread->proc); in binder_has_work()
614 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
620 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
633 * binder_select_thread_ilocked() - selects a thread for doing proc work.
634 * @proc: process to select a thread from
645 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
649 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
650 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
661 * binder_wakeup_thread_ilocked() - wakes up a thread for doing proc work.
662 * @proc: process to wake up a thread in
666 * This function wakes up a thread in the @proc process.
676 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
680 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
690 /* Didn't find a thread waiting for proc work; this can happen in binder_wakeup_thread_ilocked()
703 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
706 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
708 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
710 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
731 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
734 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
737 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
759 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
764 binder_inner_proc_lock(proc); in binder_get_node()
765 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
766 binder_inner_proc_unlock(proc); in binder_get_node()
771 struct binder_proc *proc, in binder_init_node_ilocked() argument
775 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
782 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
807 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
809 node->proc = proc; in binder_init_node_ilocked()
821 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
827 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
835 binder_inner_proc_lock(proc); in binder_new_node()
836 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
837 binder_inner_proc_unlock(proc); in binder_new_node()
857 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
860 if (proc) in binder_inc_node_nilocked()
861 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
866 !(node->proc && in binder_inc_node_nilocked()
867 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
917 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
920 if (proc) in binder_dec_node_nilocked()
921 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
937 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
939 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
940 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
945 if (proc) { in binder_dec_node_nilocked()
947 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
1003 * (node->proc is NULL), use binder_dead_nodes_lock to protect
1011 if (node->proc) in binder_inc_node_tmpref()
1012 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
1016 if (node->proc) in binder_inc_node_tmpref()
1017 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
1034 if (!node->proc) in binder_dec_node_tmpref()
1040 if (!node->proc) in binder_dec_node_tmpref()
1061 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1064 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1086 * @proc: binder_proc that owns the ref
1094 * into the given proc rb_trees and node refs list.
1103 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1107 struct binder_context *context = proc->context; in binder_get_ref_for_node_olocked()
1108 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1129 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1132 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1135 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node_olocked()
1142 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1155 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1162 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1174 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1177 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1178 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1202 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1204 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1216 * Increment the ref. @ref->proc->outer_lock must be held on entry
1257 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1268 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1283 * binder_get_node_from_ref() - get the node from the given proc/desc
1284 * @proc: proc containing the ref
1289 * Given a proc and ref handle, return the associated binder_node
1294 struct binder_proc *proc, in binder_get_node_from_ref() argument
1301 binder_proc_lock(proc); in binder_get_node_from_ref()
1302 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1313 binder_proc_unlock(proc); in binder_get_node_from_ref()
1318 binder_proc_unlock(proc); in binder_get_node_from_ref()
1339 * @proc: proc containing the ref
1345 * Given a proc and ref handle, increment or decrement the ref
1350 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1358 binder_proc_lock(proc); in binder_update_ref_for_handle()
1359 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1371 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1378 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1384 * @proc: proc containing the ref
1393 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1396 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1401 * binder_inc_ref_for_node() - increment the ref for given proc/node
1402 * @proc: proc containing the ref
1408 * Given a proc and node, increment the ref. Create the ref if it
1413 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1423 binder_proc_lock(proc); in binder_inc_ref_for_node()
1424 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1426 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1430 binder_proc_lock(proc); in binder_inc_ref_for_node()
1431 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1447 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1461 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1487 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1490 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1494 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1498 * binder_proc_dec_tmpref() - decrement proc->tmp_ref
1499 * @proc: proc to decrement
1502 * handle a transaction. proc->tmp_ref is incremented when
1506 * proc if appropriate (proc has been released, all threads have
1509 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1511 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1512 proc->tmp_ref--; in binder_proc_dec_tmpref()
1513 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1514 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1515 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1516 binder_free_proc(proc); in binder_proc_dec_tmpref()
1519 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1549 * Same as binder_get_txn_from() except it also acquires the proc->inner_lock
1558 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1564 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1567 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1572 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1573 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1606 from_proc = t->from ? t->from->proc->pid : 0; in binder_txn_latency_free()
1655 target_thread->proc->pid, in binder_send_failed_reply()
1675 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
1680 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
1722 * @proc: binder_proc owning the buffer
1736 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
1753 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
1788 * @proc: binder_proc owning the buffer
1809 struct binder_proc *proc, in binder_validate_ptr() argument
1825 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
1829 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
1840 * @proc: binder_proc owning the buffer
1877 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
1894 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
1910 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
1981 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
1992 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
2008 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
2011 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
2026 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2046 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2096 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2137 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2161 static inline void binder_release_entire_buffer(struct binder_proc *proc, in binder_release_entire_buffer() argument
2171 binder_transaction_buffer_release(proc, thread, buffer, in binder_release_entire_buffer()
2180 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2185 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2187 node = binder_new_node(proc, fp); in binder_translate_binder()
2193 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2199 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2232 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2238 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2242 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2245 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2251 if (node->proc == target_proc) { in binder_translate_handle()
2258 if (node->proc) in binder_translate_handle()
2259 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2261 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2265 if (node->proc) in binder_translate_handle()
2266 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2268 __release(&node->proc->inner_lock); in binder_translate_handle()
2306 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2319 proc->pid, thread->pid, in binder_translate_fd()
2329 proc->pid, thread->pid, fd); in binder_translate_fd()
2333 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2620 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2629 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2636 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2654 proc->pid, thread->pid); in binder_translate_fd_array()
2687 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
2701 proc->pid, thread->pid); in binder_fixup_parent()
2710 proc->pid, thread->pid); in binder_fixup_parent()
2718 proc->pid, thread->pid); in binder_fixup_parent()
2756 * Requires the proc->inner_lock to be held.
2779 * @proc: process to send the transaction to
2780 * @thread: thread in @proc to send the transaction to (may be NULL)
2784 * wake it up. If no thread is found, the work is queued to the proc
2798 struct binder_proc *proc, in binder_proc_transaction() argument
2817 binder_inner_proc_lock(proc); in binder_proc_transaction()
2818 if (proc->is_frozen) { in binder_proc_transaction()
2820 proc->sync_recv |= !oneway; in binder_proc_transaction()
2821 proc->async_recv |= oneway; in binder_proc_transaction()
2824 if ((frozen && !oneway) || proc->is_dead || in binder_proc_transaction()
2826 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2832 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
2837 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
2847 proc->outstanding_txns--; in binder_proc_transaction()
2854 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
2856 proc->outstanding_txns++; in binder_proc_transaction()
2857 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2870 binder_release_entire_buffer(proc, NULL, buffer, false); in binder_proc_transaction()
2871 binder_alloc_free_buf(&proc->alloc, buffer); in binder_proc_transaction()
2885 * @procp: returns @node->proc if valid
2896 * the transaction. We also need a tmpref on the proc while we are
2899 * Return: The target_node with refs taken or NULL if no @node->proc is NULL.
2900 * Also sets @procp if valid. If the @node->proc is NULL indicating that the
2901 * target proc has died, @error is set to BR_DEAD_REPLY.
2911 if (node->proc) { in binder_get_node_refs_for_txn()
2915 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
2916 *procp = node->proc; in binder_get_node_refs_for_txn()
2931 __release(&from->proc->inner_lock); in binder_set_txn_from_error()
2938 binder_inner_proc_unlock(from->proc); in binder_set_txn_from_error()
2942 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
2966 struct binder_context *context = proc->context; in binder_transaction()
2981 e->from_proc = proc->pid; in binder_transaction()
2986 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
2988 binder_inner_proc_lock(proc); in binder_transaction()
2990 binder_inner_proc_unlock(proc); in binder_transaction()
2993 binder_inner_proc_lock(proc); in binder_transaction()
2996 binder_inner_proc_unlock(proc); in binder_transaction()
2998 proc->pid, thread->pid); in binder_transaction()
3007 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3013 binder_inner_proc_unlock(proc); in binder_transaction()
3021 binder_inner_proc_unlock(proc); in binder_transaction()
3026 __release(&target_thread->proc->inner_lock); in binder_transaction()
3028 thread->pid, proc->pid); in binder_transaction()
3035 proc->pid, thread->pid, in binder_transaction()
3039 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3047 target_proc = target_thread->proc; in binder_transaction()
3049 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3061 binder_proc_lock(proc); in binder_transaction()
3062 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3070 proc->pid, thread->pid, tr->target.handle); in binder_transaction()
3073 binder_proc_unlock(proc); in binder_transaction()
3084 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3086 proc->pid, thread->pid); in binder_transaction()
3095 thread->pid, proc->pid); in binder_transaction()
3104 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3106 thread->pid, proc->pid); in binder_transaction()
3112 if (security_binder_transaction(proc->cred, in binder_transaction()
3115 thread->pid, proc->pid); in binder_transaction()
3121 binder_inner_proc_lock(proc); in binder_transaction()
3132 * thread from proc->waiting_threads to enqueue in binder_transaction()
3137 proc->pid, thread->pid); in binder_transaction()
3138 binder_inner_proc_unlock(proc); in binder_transaction()
3152 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3157 binder_inner_proc_unlock(proc); in binder_transaction()
3168 if (from && from->proc == target_proc) { in binder_transaction()
3178 binder_inner_proc_unlock(proc); in binder_transaction()
3188 thread->pid, proc->pid); in binder_transaction()
3201 thread->pid, proc->pid); in binder_transaction()
3215 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3224 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3240 t->from_pid = thread->proc->pid; in binder_transaction()
3245 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3260 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3264 thread->pid, proc->pid); in binder_transaction()
3274 thread->pid, proc->pid); in binder_transaction()
3336 proc->pid, thread->pid); in binder_transaction()
3344 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3352 proc->pid, thread->pid, in binder_transaction()
3380 thread->pid, proc->pid); in binder_transaction()
3399 proc->pid, thread->pid); in binder_transaction()
3409 proc->pid, thread->pid, in binder_transaction()
3440 thread->pid, proc->pid); in binder_transaction()
3459 thread->pid, proc->pid); in binder_transaction()
3481 thread->pid, proc->pid); in binder_transaction()
3505 proc->pid, thread->pid); in binder_transaction()
3518 proc->pid, thread->pid); in binder_transaction()
3529 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3533 proc->pid, thread->pid, in binder_transaction()
3552 thread->pid, proc->pid); in binder_transaction()
3570 proc->pid, thread->pid); in binder_transaction()
3581 thread->pid, proc->pid); in binder_transaction()
3587 /* Fixup buffer pointer to target proc address space */ in binder_transaction()
3606 thread->pid, proc->pid); in binder_transaction()
3617 proc->pid, thread->pid, hdr->type); in binder_transaction()
3631 proc->pid, thread->pid); in binder_transaction()
3642 proc->pid, thread->pid); in binder_transaction()
3674 binder_inner_proc_lock(proc); in binder_transaction()
3689 binder_inner_proc_unlock(proc); in binder_transaction()
3693 binder_inner_proc_lock(proc); in binder_transaction()
3695 binder_inner_proc_unlock(proc); in binder_transaction()
3732 thread->pid, proc->pid); in binder_transaction()
3734 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3775 proc->pid, thread->pid, reply ? "reply" : in binder_transaction()
3813 binder_inner_proc_lock(proc); in binder_transaction()
3816 binder_inner_proc_unlock(proc); in binder_transaction()
3824 * @proc: binder proc that owns buffer
3834 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
3838 binder_inner_proc_lock(proc); in binder_free_buf()
3843 binder_inner_proc_unlock(proc); in binder_free_buf()
3851 BUG_ON(buf_node->proc != proc); in binder_free_buf()
3858 w, &proc->todo); in binder_free_buf()
3859 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
3864 binder_release_entire_buffer(proc, thread, buffer, is_failure); in binder_free_buf()
3865 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
3868 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
3874 struct binder_context *context = proc->context; in binder_thread_write()
3888 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
3913 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
3915 proc->pid, thread->pid); in binder_thread_write()
3920 proc, ctx_mgr_node, in binder_thread_write()
3927 proc, target, increment, strong, in binder_thread_write()
3931 proc->pid, thread->pid, in binder_thread_write()
3951 proc->pid, thread->pid, debug_string, in binder_thread_write()
3957 proc->pid, thread->pid, debug_string, in binder_thread_write()
3975 node = binder_get_node(proc, node_ptr); in binder_thread_write()
3978 proc->pid, thread->pid, in binder_thread_write()
3987 proc->pid, thread->pid, in binder_thread_write()
3999 proc->pid, thread->pid, in binder_thread_write()
4009 proc->pid, thread->pid, in binder_thread_write()
4022 proc->pid, thread->pid, in binder_thread_write()
4045 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4051 proc->pid, thread->pid, in binder_thread_write()
4056 proc->pid, thread->pid, in binder_thread_write()
4063 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
4066 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4077 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4088 binder_transaction(proc, thread, &tr, in binder_thread_write()
4096 proc->pid, thread->pid); in binder_thread_write()
4097 binder_inner_proc_lock(proc); in binder_thread_write()
4101 proc->pid, thread->pid); in binder_thread_write()
4102 } else if (proc->requested_threads == 0) { in binder_thread_write()
4105 proc->pid, thread->pid); in binder_thread_write()
4107 proc->requested_threads--; in binder_thread_write()
4108 proc->requested_threads_started++; in binder_thread_write()
4111 binder_inner_proc_unlock(proc); in binder_thread_write()
4116 proc->pid, thread->pid); in binder_thread_write()
4120 proc->pid, thread->pid); in binder_thread_write()
4127 proc->pid, thread->pid); in binder_thread_write()
4160 proc->pid, thread->pid); in binder_thread_write()
4164 binder_proc_lock(proc); in binder_thread_write()
4165 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4168 proc->pid, thread->pid, in binder_thread_write()
4173 binder_proc_unlock(proc); in binder_thread_write()
4180 proc->pid, thread->pid, in binder_thread_write()
4192 proc->pid, thread->pid); in binder_thread_write()
4194 binder_proc_unlock(proc); in binder_thread_write()
4202 if (ref->node->proc == NULL) { in binder_thread_write()
4205 binder_inner_proc_lock(proc); in binder_thread_write()
4207 &ref->death->work, &proc->todo); in binder_thread_write()
4208 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4209 binder_inner_proc_unlock(proc); in binder_thread_write()
4214 proc->pid, thread->pid); in binder_thread_write()
4216 binder_proc_unlock(proc); in binder_thread_write()
4222 proc->pid, thread->pid, in binder_thread_write()
4226 binder_proc_unlock(proc); in binder_thread_write()
4230 binder_inner_proc_lock(proc); in binder_thread_write()
4242 &proc->todo); in binder_thread_write()
4244 proc); in binder_thread_write()
4250 binder_inner_proc_unlock(proc); in binder_thread_write()
4253 binder_proc_unlock(proc); in binder_thread_write()
4264 binder_inner_proc_lock(proc); in binder_thread_write()
4265 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4279 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4283 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4284 binder_inner_proc_unlock(proc); in binder_thread_write()
4298 &proc->todo); in binder_thread_write()
4299 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4302 binder_inner_proc_unlock(proc); in binder_thread_write()
4307 proc->pid, thread->pid, cmd); in binder_thread_write()
4315 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4321 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4326 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4348 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4350 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4361 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4364 binder_inner_proc_lock(proc); in binder_wait_for_work()
4371 &proc->waiting_threads); in binder_wait_for_work()
4372 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4374 binder_inner_proc_lock(proc); in binder_wait_for_work()
4382 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4389 * @proc: binder_proc associated @t->buffer
4400 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4421 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4441 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4460 binder_inner_proc_lock(proc); in binder_thread_read()
4462 binder_inner_proc_unlock(proc); in binder_thread_read()
4468 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4473 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4477 binder_set_nice(proc->default_priority); in binder_thread_read()
4502 binder_inner_proc_lock(proc); in binder_thread_read()
4505 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4507 list = &proc->todo; in binder_thread_read()
4509 binder_inner_proc_unlock(proc); in binder_thread_read()
4518 binder_inner_proc_unlock(proc); in binder_thread_read()
4527 binder_inner_proc_unlock(proc); in binder_thread_read()
4535 binder_inner_proc_unlock(proc); in binder_thread_read()
4542 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4547 if (proc->oneway_spam_detection_enabled && in binder_thread_read()
4554 binder_inner_proc_unlock(proc); in binder_thread_read()
4561 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4564 proc->pid, thread->pid); in binder_thread_read()
4576 BUG_ON(proc != node->proc); in binder_thread_read()
4602 proc->pid, thread->pid, in binder_thread_read()
4606 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4607 binder_inner_proc_unlock(proc); in binder_thread_read()
4621 binder_inner_proc_unlock(proc); in binder_thread_read()
4625 proc, thread, &ptr, node_ptr, in binder_thread_read()
4630 proc, thread, &ptr, node_ptr, in binder_thread_read()
4635 proc, thread, &ptr, node_ptr, in binder_thread_read()
4640 proc, thread, &ptr, node_ptr, in binder_thread_read()
4646 proc->pid, thread->pid, in binder_thread_read()
4669 proc->pid, thread->pid, in binder_thread_read()
4675 binder_inner_proc_unlock(proc); in binder_thread_read()
4680 w, &proc->delivered_death); in binder_thread_read()
4681 binder_inner_proc_unlock(proc); in binder_thread_read()
4690 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4695 binder_inner_proc_unlock(proc); in binder_thread_read()
4697 proc->pid, thread->pid, w->type); in binder_thread_read()
4729 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4735 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4737 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4742 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4744 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4748 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
4759 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
4762 proc->pid, thread->pid, in binder_thread_read()
4771 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4810 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4813 proc->pid, thread->pid, in binder_thread_read()
4817 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
4827 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4830 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4833 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4837 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4847 binder_inner_proc_lock(proc); in binder_thread_read()
4848 if (proc->requested_threads == 0 && in binder_thread_read()
4849 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
4850 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
4854 proc->requested_threads++; in binder_thread_read()
4855 binder_inner_proc_unlock(proc); in binder_thread_read()
4858 proc->pid, thread->pid); in binder_thread_read()
4861 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
4863 binder_inner_proc_unlock(proc); in binder_thread_read()
4867 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
4874 binder_inner_proc_lock(proc); in binder_release_work()
4877 binder_inner_proc_unlock(proc); in binder_release_work()
4929 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
4933 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
4950 thread->proc = proc; in binder_get_thread_ilocked()
4956 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
4967 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
4972 binder_inner_proc_lock(proc); in binder_get_thread()
4973 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
4974 binder_inner_proc_unlock(proc); in binder_get_thread()
4979 binder_inner_proc_lock(proc); in binder_get_thread()
4980 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
4981 binder_inner_proc_unlock(proc); in binder_get_thread()
4988 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
4992 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
4993 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
4994 if (proc->outstanding_txns) in binder_free_proc()
4996 __func__, proc->outstanding_txns); in binder_free_proc()
4997 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
4999 kfree(proc->context->name); in binder_free_proc()
5002 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5003 put_task_struct(proc->tsk); in binder_free_proc()
5004 put_cred(proc->cred); in binder_free_proc()
5006 kfree(proc); in binder_free_proc()
5013 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5017 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5025 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5027 * take a ref on the proc so it survives in binder_thread_release()
5028 * after we remove this thread from proc->threads. in binder_thread_release()
5032 proc->tmp_ref++; in binder_thread_release()
5038 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5054 proc->pid, thread->pid, in binder_thread_release()
5059 thread->proc->outstanding_txns--; in binder_thread_release()
5092 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5106 binder_release_work(proc, &thread->todo); in binder_thread_release()
5114 struct binder_proc *proc = filp->private_data; in binder_poll() local
5118 thread = binder_get_thread(proc); in binder_poll()
5122 binder_inner_proc_lock(thread->proc); in binder_poll()
5126 binder_inner_proc_unlock(thread->proc); in binder_poll()
5141 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5157 proc->pid, thread->pid, in binder_ioctl_write_read()
5162 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5175 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5180 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5181 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5182 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5183 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5192 proc->pid, thread->pid, in binder_ioctl_write_read()
5207 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5208 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5218 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5233 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5251 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5255 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5261 proc->pid); in binder_ioctl_get_node_info_for_ref()
5268 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5274 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5287 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5295 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5296 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5307 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5312 static bool binder_txns_pending_ilocked(struct binder_proc *proc) in binder_txns_pending_ilocked() argument
5317 if (proc->outstanding_txns > 0) in binder_txns_pending_ilocked()
5320 for (n = rb_first(&proc->threads); n; n = rb_next(n)) { in binder_txns_pending_ilocked()
5411 binder_inner_proc_lock(thread->proc); in binder_ioctl_get_extended_error()
5414 binder_inner_proc_unlock(thread->proc); in binder_ioctl_get_extended_error()
5425 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5431 proc->pid, current->pid, cmd, arg);*/ in binder_ioctl()
5433 binder_selftest_alloc(&proc->alloc); in binder_ioctl()
5441 thread = binder_get_thread(proc); in binder_ioctl()
5461 binder_inner_proc_lock(proc); in binder_ioctl()
5462 proc->max_threads = max_threads; in binder_ioctl()
5463 binder_inner_proc_unlock(proc); in binder_ioctl()
5485 proc->pid, thread->pid); in binder_ioctl()
5486 binder_thread_release(proc, thread); in binder_ioctl()
5511 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5530 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5625 binder_inner_proc_lock(proc); in binder_ioctl()
5626 proc->oneway_spam_detection_enabled = (bool)enable; in binder_ioctl()
5627 binder_inner_proc_unlock(proc); in binder_ioctl()
5657 binder_inner_proc_lock(proc); in binder_ioctl()
5660 binder_inner_proc_unlock(proc); in binder_ioctl()
5681 binder_inner_proc_lock(proc); in binder_ioctl()
5687 binder_inner_proc_unlock(proc); in binder_ioctl()
5715 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5723 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5727 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5734 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5738 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5741 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5757 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5759 if (proc->tsk != current->group_leader) in binder_mmap()
5764 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5770 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5776 vma->vm_private_data = proc; in binder_mmap()
5778 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5783 struct binder_proc *proc, *itr; in binder_open() local
5792 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5793 if (proc == NULL) in binder_open()
5795 spin_lock_init(&proc->inner_lock); in binder_open()
5796 spin_lock_init(&proc->outer_lock); in binder_open()
5798 proc->tsk = current->group_leader; in binder_open()
5799 proc->cred = get_cred(filp->f_cred); in binder_open()
5800 INIT_LIST_HEAD(&proc->todo); in binder_open()
5801 init_waitqueue_head(&proc->freeze_wait); in binder_open()
5802 proc->default_priority = task_nice(current); in binder_open()
5813 proc->context = &binder_dev->context; in binder_open()
5814 binder_alloc_init(&proc->alloc); in binder_open()
5817 proc->pid = current->group_leader->pid; in binder_open()
5818 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
5819 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
5820 filp->private_data = proc; in binder_open()
5824 if (itr->pid == proc->pid) { in binder_open()
5829 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
5835 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5837 * proc debug entries are shared between contexts. in binder_open()
5842 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
5844 (void *)(unsigned long)proc->pid, in binder_open()
5852 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5860 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
5862 proc->binderfs_entry = binderfs_entry; in binder_open()
5877 struct binder_proc *proc = filp->private_data; in binder_flush() local
5879 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
5884 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
5889 binder_inner_proc_lock(proc); in binder_deferred_flush()
5890 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
5899 binder_inner_proc_unlock(proc); in binder_deferred_flush()
5902 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
5908 struct binder_proc *proc = filp->private_data; in binder_release() local
5910 debugfs_remove(proc->debugfs_entry); in binder_release()
5912 if (proc->binderfs_entry) { in binder_release()
5913 binderfs_remove_file(proc->binderfs_entry); in binder_release()
5914 proc->binderfs_entry = NULL; in binder_release()
5917 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
5926 struct binder_proc *proc = node->proc; in binder_node_release() local
5928 binder_release_work(proc, &node->async_todo); in binder_node_release()
5931 binder_inner_proc_lock(proc); in binder_node_release()
5938 binder_inner_proc_unlock(proc); in binder_node_release()
5945 node->proc = NULL; in binder_node_release()
5948 binder_inner_proc_unlock(proc); in binder_node_release()
5962 binder_inner_proc_lock(ref->proc); in binder_node_release()
5964 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5973 &ref->proc->todo); in binder_node_release()
5974 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
5975 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5987 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
5989 struct binder_context *context = proc->context; in binder_deferred_release()
5994 hlist_del(&proc->proc_node); in binder_deferred_release()
5999 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
6002 __func__, proc->pid); in binder_deferred_release()
6006 binder_inner_proc_lock(proc); in binder_deferred_release()
6008 * Make sure proc stays alive after we in binder_deferred_release()
6011 proc->tmp_ref++; in binder_deferred_release()
6013 proc->is_dead = true; in binder_deferred_release()
6014 proc->is_frozen = false; in binder_deferred_release()
6015 proc->sync_recv = false; in binder_deferred_release()
6016 proc->async_recv = false; in binder_deferred_release()
6019 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
6023 binder_inner_proc_unlock(proc); in binder_deferred_release()
6025 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
6026 binder_inner_proc_lock(proc); in binder_deferred_release()
6031 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
6042 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
6043 binder_inner_proc_unlock(proc); in binder_deferred_release()
6045 binder_inner_proc_lock(proc); in binder_deferred_release()
6047 binder_inner_proc_unlock(proc); in binder_deferred_release()
6050 binder_proc_lock(proc); in binder_deferred_release()
6051 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
6057 binder_proc_unlock(proc); in binder_deferred_release()
6059 binder_proc_lock(proc); in binder_deferred_release()
6061 binder_proc_unlock(proc); in binder_deferred_release()
6063 binder_release_work(proc, &proc->todo); in binder_deferred_release()
6064 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
6068 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
6071 binder_proc_dec_tmpref(proc); in binder_deferred_release()
6076 struct binder_proc *proc; in binder_deferred_func() local
6083 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
6085 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
6086 defer = proc->deferred_work; in binder_deferred_func()
6087 proc->deferred_work = 0; in binder_deferred_func()
6089 proc = NULL; in binder_deferred_func()
6095 binder_deferred_flush(proc); in binder_deferred_func()
6098 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
6099 } while (proc); in binder_deferred_func()
6104 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
6107 proc->deferred_work |= defer; in binder_defer_work()
6108 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
6109 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
6117 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
6138 if (proc != to_proc) { in print_binder_transaction_ilocked()
6141 * correct proc inner lock for this node in print_binder_transaction_ilocked()
6159 struct binder_proc *proc, in print_binder_work_ilocked() argument
6171 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6221 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6225 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6229 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6235 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6259 seq_puts(m, " proc"); in print_binder_node_nilocked()
6261 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6264 if (node->proc) { in print_binder_node_nilocked()
6266 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6277 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6284 struct binder_proc *proc, int print_all) in print_binder_proc() argument
6292 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6293 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6296 binder_inner_proc_lock(proc); in print_binder_proc()
6297 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
6301 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
6314 binder_inner_proc_unlock(proc); in print_binder_proc()
6321 binder_inner_proc_lock(proc); in print_binder_proc()
6323 binder_inner_proc_unlock(proc); in print_binder_proc()
6328 binder_proc_lock(proc); in print_binder_proc()
6329 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
6335 binder_proc_unlock(proc); in print_binder_proc()
6337 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6338 binder_inner_proc_lock(proc); in print_binder_proc()
6339 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6340 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6342 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6346 binder_inner_proc_unlock(proc); in print_binder_proc()
6398 "proc",
6450 struct binder_proc *proc) in print_binder_proc_stats() argument
6457 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6459 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6460 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6463 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6464 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6467 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6473 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6474 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6478 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6480 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6485 binder_proc_lock(proc); in print_binder_proc_stats()
6486 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
6493 binder_proc_unlock(proc); in print_binder_proc_stats()
6496 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6499 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6502 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6503 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6507 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6510 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6515 struct binder_proc *proc; in state_show() local
6545 hlist_for_each_entry(proc, &binder_procs, proc_node) in state_show()
6546 print_binder_proc(m, proc, 1); in state_show()
6554 struct binder_proc *proc; in stats_show() local
6561 hlist_for_each_entry(proc, &binder_procs, proc_node) in stats_show()
6562 print_binder_proc_stats(m, proc); in stats_show()
6570 struct binder_proc *proc; in transactions_show() local
6574 hlist_for_each_entry(proc, &binder_procs, proc_node) in transactions_show()
6575 print_binder_proc(m, proc, 0); in transactions_show()
6589 seq_puts(m, "binder proc state:\n"); in proc_show()
6710 from_pid = t->from ? (t->from->proc ? t->from->proc->pid : 0) : t->from_pid; in print_binder_transaction_brief_ilocked()
6744 struct binder_proc *proc, in print_binder_transaction_brief() argument
6754 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6755 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6771 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6780 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6788 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6790 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6800 struct binder_proc *proc) in print_binder_proc_brief() argument
6804 size_t free_async_space = binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_brief()
6806 seq_printf(m, "%d\t", proc->pid); in print_binder_proc_brief()
6807 seq_printf(m, "%s\t", proc->context->name); in print_binder_proc_brief()
6809 binder_inner_proc_lock(proc); in print_binder_proc_brief()
6810 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_brief()
6814 "\t%zd\n", proc->requested_threads, in print_binder_proc_brief()
6815 proc->requested_threads_started, proc->max_threads, in print_binder_proc_brief()
6818 binder_inner_proc_unlock(proc); in print_binder_proc_brief()
6823 struct binder_proc *proc = NULL; in binder_transaction_proc_show() local
6828 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6829 print_binder_transaction_brief(m, proc, now); in binder_transaction_proc_show()
6832 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6833 print_binder_proc_brief(m, proc); in binder_transaction_proc_show()
6894 binder_debugfs_dir_entry_proc = debugfs_create_dir("proc", in binder_init()