• 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()
612 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
618 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
631 * binder_select_thread_ilocked() - selects a thread for doing proc work.
632 * @proc: process to select a thread from
643 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
647 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
648 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
659 * binder_wakeup_thread_ilocked() - wakes up a thread for doing proc work.
660 * @proc: process to wake up a thread in
664 * This function wakes up a thread in the @proc process.
674 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
678 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
688 /* Didn't find a thread waiting for proc work; this can happen in binder_wakeup_thread_ilocked()
701 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
704 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
706 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
708 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
729 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
732 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
735 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
757 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
762 binder_inner_proc_lock(proc); in binder_get_node()
763 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
764 binder_inner_proc_unlock(proc); in binder_get_node()
769 struct binder_proc *proc, in binder_init_node_ilocked() argument
773 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
780 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
805 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
807 node->proc = proc; in binder_init_node_ilocked()
819 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
825 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
833 binder_inner_proc_lock(proc); in binder_new_node()
834 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
835 binder_inner_proc_unlock(proc); in binder_new_node()
855 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
858 if (proc) in binder_inc_node_nilocked()
859 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
864 !(node->proc && in binder_inc_node_nilocked()
865 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
915 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
918 if (proc) in binder_dec_node_nilocked()
919 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
935 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
937 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
938 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
943 if (proc) { in binder_dec_node_nilocked()
945 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
1001 * (node->proc is NULL), use binder_dead_nodes_lock to protect
1009 if (node->proc) in binder_inc_node_tmpref()
1010 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
1014 if (node->proc) in binder_inc_node_tmpref()
1015 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
1032 if (!node->proc) in binder_dec_node_tmpref()
1038 if (!node->proc) in binder_dec_node_tmpref()
1059 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1062 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1084 * @proc: binder_proc that owns the ref
1092 * into the given proc rb_trees and node refs list.
1101 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1105 struct binder_context *context = proc->context; in binder_get_ref_for_node_olocked()
1106 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1127 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1130 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1133 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node_olocked()
1140 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1153 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1160 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1172 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1175 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1176 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1200 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1202 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1214 * Increment the ref. @ref->proc->outer_lock must be held on entry
1255 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1266 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1281 * binder_get_node_from_ref() - get the node from the given proc/desc
1282 * @proc: proc containing the ref
1287 * Given a proc and ref handle, return the associated binder_node
1292 struct binder_proc *proc, in binder_get_node_from_ref() argument
1299 binder_proc_lock(proc); in binder_get_node_from_ref()
1300 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1311 binder_proc_unlock(proc); in binder_get_node_from_ref()
1316 binder_proc_unlock(proc); in binder_get_node_from_ref()
1337 * @proc: proc containing the ref
1343 * Given a proc and ref handle, increment or decrement the ref
1348 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1356 binder_proc_lock(proc); in binder_update_ref_for_handle()
1357 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1369 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1376 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1382 * @proc: proc containing the ref
1391 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1394 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1399 * binder_inc_ref_for_node() - increment the ref for given proc/node
1400 * @proc: proc containing the ref
1406 * Given a proc and node, increment the ref. Create the ref if it
1411 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1421 binder_proc_lock(proc); in binder_inc_ref_for_node()
1422 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1424 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1428 binder_proc_lock(proc); in binder_inc_ref_for_node()
1429 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1445 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1459 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1485 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1488 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1492 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1496 * binder_proc_dec_tmpref() - decrement proc->tmp_ref
1497 * @proc: proc to decrement
1500 * handle a transaction. proc->tmp_ref is incremented when
1504 * proc if appropriate (proc has been released, all threads have
1507 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1509 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1510 proc->tmp_ref--; in binder_proc_dec_tmpref()
1511 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1512 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1513 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1514 binder_free_proc(proc); in binder_proc_dec_tmpref()
1517 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1547 * Same as binder_get_txn_from() except it also acquires the proc->inner_lock
1556 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1562 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1565 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1570 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1571 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1604 from_proc = t->from ? t->from->proc->pid : 0; in binder_txn_latency_free()
1653 target_thread->proc->pid, in binder_send_failed_reply()
1673 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
1678 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
1720 * @proc: binder_proc owning the buffer
1734 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()
3400 proc->pid, thread->pid); in binder_transaction()
3410 proc->pid, thread->pid, in binder_transaction()
3441 thread->pid, proc->pid); in binder_transaction()
3460 thread->pid, proc->pid); in binder_transaction()
3482 thread->pid, proc->pid); in binder_transaction()
3506 proc->pid, thread->pid); in binder_transaction()
3519 proc->pid, thread->pid); in binder_transaction()
3530 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3534 proc->pid, thread->pid, in binder_transaction()
3553 thread->pid, proc->pid); in binder_transaction()
3571 proc->pid, thread->pid); in binder_transaction()
3582 thread->pid, proc->pid); in binder_transaction()
3588 /* Fixup buffer pointer to target proc address space */ in binder_transaction()
3607 thread->pid, proc->pid); in binder_transaction()
3618 proc->pid, thread->pid, hdr->type); in binder_transaction()
3632 proc->pid, thread->pid); in binder_transaction()
3643 proc->pid, thread->pid); in binder_transaction()
3675 binder_inner_proc_lock(proc); in binder_transaction()
3690 binder_inner_proc_unlock(proc); in binder_transaction()
3694 binder_inner_proc_lock(proc); in binder_transaction()
3696 binder_inner_proc_unlock(proc); in binder_transaction()
3733 thread->pid, proc->pid); in binder_transaction()
3735 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3776 proc->pid, thread->pid, reply ? "reply" : in binder_transaction()
3814 binder_inner_proc_lock(proc); in binder_transaction()
3817 binder_inner_proc_unlock(proc); in binder_transaction()
3825 * @proc: binder proc that owns buffer
3835 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
3839 binder_inner_proc_lock(proc); in binder_free_buf()
3844 binder_inner_proc_unlock(proc); in binder_free_buf()
3852 BUG_ON(buf_node->proc != proc); in binder_free_buf()
3859 w, &proc->todo); in binder_free_buf()
3860 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
3865 binder_release_entire_buffer(proc, thread, buffer, is_failure); in binder_free_buf()
3866 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
3869 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
3875 struct binder_context *context = proc->context; in binder_thread_write()
3889 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
3914 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
3916 proc->pid, thread->pid); in binder_thread_write()
3921 proc, ctx_mgr_node, in binder_thread_write()
3928 proc, target, increment, strong, in binder_thread_write()
3932 proc->pid, thread->pid, in binder_thread_write()
3952 proc->pid, thread->pid, debug_string, in binder_thread_write()
3958 proc->pid, thread->pid, debug_string, in binder_thread_write()
3976 node = binder_get_node(proc, node_ptr); in binder_thread_write()
3979 proc->pid, thread->pid, in binder_thread_write()
3988 proc->pid, thread->pid, in binder_thread_write()
4000 proc->pid, thread->pid, in binder_thread_write()
4010 proc->pid, thread->pid, in binder_thread_write()
4023 proc->pid, thread->pid, in binder_thread_write()
4046 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4052 proc->pid, thread->pid, in binder_thread_write()
4057 proc->pid, thread->pid, in binder_thread_write()
4064 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
4067 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4078 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4089 binder_transaction(proc, thread, &tr, in binder_thread_write()
4097 proc->pid, thread->pid); in binder_thread_write()
4098 binder_inner_proc_lock(proc); in binder_thread_write()
4102 proc->pid, thread->pid); in binder_thread_write()
4103 } else if (proc->requested_threads == 0) { in binder_thread_write()
4106 proc->pid, thread->pid); in binder_thread_write()
4108 proc->requested_threads--; in binder_thread_write()
4109 proc->requested_threads_started++; in binder_thread_write()
4112 binder_inner_proc_unlock(proc); in binder_thread_write()
4117 proc->pid, thread->pid); in binder_thread_write()
4121 proc->pid, thread->pid); in binder_thread_write()
4128 proc->pid, thread->pid); in binder_thread_write()
4161 proc->pid, thread->pid); in binder_thread_write()
4165 binder_proc_lock(proc); in binder_thread_write()
4166 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4169 proc->pid, thread->pid, in binder_thread_write()
4174 binder_proc_unlock(proc); in binder_thread_write()
4181 proc->pid, thread->pid, in binder_thread_write()
4193 proc->pid, thread->pid); in binder_thread_write()
4195 binder_proc_unlock(proc); in binder_thread_write()
4203 if (ref->node->proc == NULL) { in binder_thread_write()
4206 binder_inner_proc_lock(proc); in binder_thread_write()
4208 &ref->death->work, &proc->todo); in binder_thread_write()
4209 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4210 binder_inner_proc_unlock(proc); in binder_thread_write()
4215 proc->pid, thread->pid); in binder_thread_write()
4217 binder_proc_unlock(proc); in binder_thread_write()
4223 proc->pid, thread->pid, in binder_thread_write()
4227 binder_proc_unlock(proc); in binder_thread_write()
4231 binder_inner_proc_lock(proc); in binder_thread_write()
4243 &proc->todo); in binder_thread_write()
4245 proc); in binder_thread_write()
4251 binder_inner_proc_unlock(proc); in binder_thread_write()
4254 binder_proc_unlock(proc); in binder_thread_write()
4265 binder_inner_proc_lock(proc); in binder_thread_write()
4266 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4280 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4284 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4285 binder_inner_proc_unlock(proc); in binder_thread_write()
4299 &proc->todo); in binder_thread_write()
4300 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4303 binder_inner_proc_unlock(proc); in binder_thread_write()
4308 proc->pid, thread->pid, cmd); in binder_thread_write()
4316 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4322 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4327 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4349 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4351 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4362 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4365 binder_inner_proc_lock(proc); in binder_wait_for_work()
4372 &proc->waiting_threads); in binder_wait_for_work()
4373 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4375 binder_inner_proc_lock(proc); in binder_wait_for_work()
4383 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4390 * @proc: binder_proc associated @t->buffer
4401 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4422 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4442 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4461 binder_inner_proc_lock(proc); in binder_thread_read()
4463 binder_inner_proc_unlock(proc); in binder_thread_read()
4469 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4474 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4478 binder_set_nice(proc->default_priority); in binder_thread_read()
4503 binder_inner_proc_lock(proc); in binder_thread_read()
4506 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4508 list = &proc->todo; in binder_thread_read()
4510 binder_inner_proc_unlock(proc); in binder_thread_read()
4519 binder_inner_proc_unlock(proc); in binder_thread_read()
4528 binder_inner_proc_unlock(proc); in binder_thread_read()
4536 binder_inner_proc_unlock(proc); in binder_thread_read()
4543 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4548 if (proc->oneway_spam_detection_enabled && in binder_thread_read()
4555 binder_inner_proc_unlock(proc); in binder_thread_read()
4562 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4565 proc->pid, thread->pid); in binder_thread_read()
4577 BUG_ON(proc != node->proc); in binder_thread_read()
4603 proc->pid, thread->pid, in binder_thread_read()
4607 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4608 binder_inner_proc_unlock(proc); in binder_thread_read()
4622 binder_inner_proc_unlock(proc); in binder_thread_read()
4626 proc, thread, &ptr, node_ptr, in binder_thread_read()
4631 proc, thread, &ptr, node_ptr, in binder_thread_read()
4636 proc, thread, &ptr, node_ptr, in binder_thread_read()
4641 proc, thread, &ptr, node_ptr, in binder_thread_read()
4647 proc->pid, thread->pid, in binder_thread_read()
4670 proc->pid, thread->pid, in binder_thread_read()
4676 binder_inner_proc_unlock(proc); in binder_thread_read()
4681 w, &proc->delivered_death); in binder_thread_read()
4682 binder_inner_proc_unlock(proc); in binder_thread_read()
4691 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4696 binder_inner_proc_unlock(proc); in binder_thread_read()
4698 proc->pid, thread->pid, w->type); in binder_thread_read()
4730 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4736 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4738 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4743 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4745 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4749 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
4760 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
4763 proc->pid, thread->pid, in binder_thread_read()
4772 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4811 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4814 proc->pid, thread->pid, in binder_thread_read()
4818 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
4828 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4831 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4834 binder_inner_proc_lock(thread->proc); in binder_thread_read()
4838 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
4848 binder_inner_proc_lock(proc); in binder_thread_read()
4849 if (proc->requested_threads == 0 && in binder_thread_read()
4850 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
4851 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
4855 proc->requested_threads++; in binder_thread_read()
4856 binder_inner_proc_unlock(proc); in binder_thread_read()
4859 proc->pid, thread->pid); in binder_thread_read()
4862 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
4864 binder_inner_proc_unlock(proc); in binder_thread_read()
4868 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
4875 binder_inner_proc_lock(proc); in binder_release_work()
4878 binder_inner_proc_unlock(proc); in binder_release_work()
4930 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
4934 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
4951 thread->proc = proc; in binder_get_thread_ilocked()
4957 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
4968 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
4973 binder_inner_proc_lock(proc); in binder_get_thread()
4974 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
4975 binder_inner_proc_unlock(proc); in binder_get_thread()
4980 binder_inner_proc_lock(proc); in binder_get_thread()
4981 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
4982 binder_inner_proc_unlock(proc); in binder_get_thread()
4989 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
4993 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
4994 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
4995 if (proc->outstanding_txns) in binder_free_proc()
4997 __func__, proc->outstanding_txns); in binder_free_proc()
4998 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
5000 kfree(proc->context->name); in binder_free_proc()
5003 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5004 put_task_struct(proc->tsk); in binder_free_proc()
5005 put_cred(proc->cred); in binder_free_proc()
5007 kfree(proc); in binder_free_proc()
5014 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5018 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5026 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5028 * take a ref on the proc so it survives in binder_thread_release()
5029 * after we remove this thread from proc->threads. in binder_thread_release()
5033 proc->tmp_ref++; in binder_thread_release()
5039 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5055 proc->pid, thread->pid, in binder_thread_release()
5060 thread->proc->outstanding_txns--; in binder_thread_release()
5093 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5107 binder_release_work(proc, &thread->todo); in binder_thread_release()
5115 struct binder_proc *proc = filp->private_data; in binder_poll() local
5119 thread = binder_get_thread(proc); in binder_poll()
5123 binder_inner_proc_lock(thread->proc); in binder_poll()
5127 binder_inner_proc_unlock(thread->proc); in binder_poll()
5142 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5158 proc->pid, thread->pid, in binder_ioctl_write_read()
5163 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5176 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5181 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5182 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5183 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5184 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5193 proc->pid, thread->pid, in binder_ioctl_write_read()
5208 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5209 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5219 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5234 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5252 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5256 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5262 proc->pid); in binder_ioctl_get_node_info_for_ref()
5269 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5275 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5288 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5296 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5297 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5308 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5313 static bool binder_txns_pending_ilocked(struct binder_proc *proc) in binder_txns_pending_ilocked() argument
5318 if (proc->outstanding_txns > 0) in binder_txns_pending_ilocked()
5321 for (n = rb_first(&proc->threads); n; n = rb_next(n)) { in binder_txns_pending_ilocked()
5412 binder_inner_proc_lock(thread->proc); in binder_ioctl_get_extended_error()
5415 binder_inner_proc_unlock(thread->proc); in binder_ioctl_get_extended_error()
5426 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5432 proc->pid, current->pid, cmd, arg);*/ in binder_ioctl()
5434 binder_selftest_alloc(&proc->alloc); in binder_ioctl()
5442 thread = binder_get_thread(proc); in binder_ioctl()
5462 binder_inner_proc_lock(proc); in binder_ioctl()
5463 proc->max_threads = max_threads; in binder_ioctl()
5464 binder_inner_proc_unlock(proc); in binder_ioctl()
5486 proc->pid, thread->pid); in binder_ioctl()
5487 binder_thread_release(proc, thread); in binder_ioctl()
5512 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5531 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5626 binder_inner_proc_lock(proc); in binder_ioctl()
5627 proc->oneway_spam_detection_enabled = (bool)enable; in binder_ioctl()
5628 binder_inner_proc_unlock(proc); in binder_ioctl()
5658 binder_inner_proc_lock(proc); in binder_ioctl()
5661 binder_inner_proc_unlock(proc); in binder_ioctl()
5682 binder_inner_proc_lock(proc); in binder_ioctl()
5688 binder_inner_proc_unlock(proc); in binder_ioctl()
5716 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5724 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5728 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5735 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5739 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5742 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5758 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5760 if (proc->tsk != current->group_leader) in binder_mmap()
5765 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5771 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5777 vma->vm_private_data = proc; in binder_mmap()
5779 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5784 struct binder_proc *proc, *itr; in binder_open() local
5793 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5794 if (proc == NULL) in binder_open()
5796 spin_lock_init(&proc->inner_lock); in binder_open()
5797 spin_lock_init(&proc->outer_lock); in binder_open()
5799 proc->tsk = current->group_leader; in binder_open()
5800 proc->cred = get_cred(filp->f_cred); in binder_open()
5801 INIT_LIST_HEAD(&proc->todo); in binder_open()
5802 init_waitqueue_head(&proc->freeze_wait); in binder_open()
5803 proc->default_priority = task_nice(current); in binder_open()
5814 proc->context = &binder_dev->context; in binder_open()
5815 binder_alloc_init(&proc->alloc); in binder_open()
5818 proc->pid = current->group_leader->pid; in binder_open()
5819 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
5820 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
5821 filp->private_data = proc; in binder_open()
5825 if (itr->pid == proc->pid) { in binder_open()
5830 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
5836 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5838 * proc debug entries are shared between contexts. in binder_open()
5843 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
5845 (void *)(unsigned long)proc->pid, in binder_open()
5853 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
5861 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
5863 proc->binderfs_entry = binderfs_entry; in binder_open()
5878 struct binder_proc *proc = filp->private_data; in binder_flush() local
5880 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
5885 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
5890 binder_inner_proc_lock(proc); in binder_deferred_flush()
5891 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
5900 binder_inner_proc_unlock(proc); in binder_deferred_flush()
5903 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
5909 struct binder_proc *proc = filp->private_data; in binder_release() local
5911 debugfs_remove(proc->debugfs_entry); in binder_release()
5913 if (proc->binderfs_entry) { in binder_release()
5914 binderfs_remove_file(proc->binderfs_entry); in binder_release()
5915 proc->binderfs_entry = NULL; in binder_release()
5918 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
5927 struct binder_proc *proc = node->proc; in binder_node_release() local
5929 binder_release_work(proc, &node->async_todo); in binder_node_release()
5932 binder_inner_proc_lock(proc); in binder_node_release()
5939 binder_inner_proc_unlock(proc); in binder_node_release()
5946 node->proc = NULL; in binder_node_release()
5949 binder_inner_proc_unlock(proc); in binder_node_release()
5963 binder_inner_proc_lock(ref->proc); in binder_node_release()
5965 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5974 &ref->proc->todo); in binder_node_release()
5975 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
5976 binder_inner_proc_unlock(ref->proc); in binder_node_release()
5988 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
5990 struct binder_context *context = proc->context; in binder_deferred_release()
5995 hlist_del(&proc->proc_node); in binder_deferred_release()
6000 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
6003 __func__, proc->pid); in binder_deferred_release()
6007 binder_inner_proc_lock(proc); in binder_deferred_release()
6009 * Make sure proc stays alive after we in binder_deferred_release()
6012 proc->tmp_ref++; in binder_deferred_release()
6014 proc->is_dead = true; in binder_deferred_release()
6015 proc->is_frozen = false; in binder_deferred_release()
6016 proc->sync_recv = false; in binder_deferred_release()
6017 proc->async_recv = false; in binder_deferred_release()
6020 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
6024 binder_inner_proc_unlock(proc); in binder_deferred_release()
6026 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
6027 binder_inner_proc_lock(proc); in binder_deferred_release()
6032 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
6043 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
6044 binder_inner_proc_unlock(proc); in binder_deferred_release()
6046 binder_inner_proc_lock(proc); in binder_deferred_release()
6048 binder_inner_proc_unlock(proc); in binder_deferred_release()
6051 binder_proc_lock(proc); in binder_deferred_release()
6052 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
6058 binder_proc_unlock(proc); in binder_deferred_release()
6060 binder_proc_lock(proc); in binder_deferred_release()
6062 binder_proc_unlock(proc); in binder_deferred_release()
6064 binder_release_work(proc, &proc->todo); in binder_deferred_release()
6065 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
6069 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
6072 binder_proc_dec_tmpref(proc); in binder_deferred_release()
6077 struct binder_proc *proc; in binder_deferred_func() local
6084 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
6086 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
6087 defer = proc->deferred_work; in binder_deferred_func()
6088 proc->deferred_work = 0; in binder_deferred_func()
6090 proc = NULL; in binder_deferred_func()
6096 binder_deferred_flush(proc); in binder_deferred_func()
6099 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
6100 } while (proc); in binder_deferred_func()
6105 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
6108 proc->deferred_work |= defer; in binder_defer_work()
6109 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
6110 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
6118 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
6139 if (proc != to_proc) { in print_binder_transaction_ilocked()
6142 * correct proc inner lock for this node in print_binder_transaction_ilocked()
6160 struct binder_proc *proc, in print_binder_work_ilocked() argument
6172 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6222 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6226 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6230 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6236 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6260 seq_puts(m, " proc"); in print_binder_node_nilocked()
6262 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6265 if (node->proc) { in print_binder_node_nilocked()
6267 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6278 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6285 struct binder_proc *proc, int print_all) in print_binder_proc() argument
6293 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6294 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6297 binder_inner_proc_lock(proc); in print_binder_proc()
6298 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
6302 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
6315 binder_inner_proc_unlock(proc); in print_binder_proc()
6322 binder_inner_proc_lock(proc); in print_binder_proc()
6324 binder_inner_proc_unlock(proc); in print_binder_proc()
6329 binder_proc_lock(proc); in print_binder_proc()
6330 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
6336 binder_proc_unlock(proc); in print_binder_proc()
6338 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6339 binder_inner_proc_lock(proc); in print_binder_proc()
6340 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6341 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6343 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6347 binder_inner_proc_unlock(proc); in print_binder_proc()
6399 "proc",
6451 struct binder_proc *proc) in print_binder_proc_stats() argument
6458 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6460 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6461 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6464 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6465 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6468 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6474 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6475 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6479 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
6481 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6486 binder_proc_lock(proc); in print_binder_proc_stats()
6487 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
6494 binder_proc_unlock(proc); in print_binder_proc_stats()
6497 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6500 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6503 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6504 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6508 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6511 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6516 struct binder_proc *proc; in state_show() local
6546 hlist_for_each_entry(proc, &binder_procs, proc_node) in state_show()
6547 print_binder_proc(m, proc, 1); in state_show()
6555 struct binder_proc *proc; in stats_show() local
6562 hlist_for_each_entry(proc, &binder_procs, proc_node) in stats_show()
6563 print_binder_proc_stats(m, proc); in stats_show()
6571 struct binder_proc *proc; in transactions_show() local
6575 hlist_for_each_entry(proc, &binder_procs, proc_node) in transactions_show()
6576 print_binder_proc(m, proc, 0); in transactions_show()
6590 seq_puts(m, "binder proc state:\n"); in proc_show()
6711 from_pid = t->from ? (t->from->proc ? t->from->proc->pid : 0) : t->from_pid; in print_binder_transaction_brief_ilocked()
6745 struct binder_proc *proc, in print_binder_transaction_brief() argument
6755 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6756 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6772 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_transaction_brief()
6781 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6789 binder_inner_proc_lock(proc); in print_binder_transaction_brief()
6791 binder_inner_proc_unlock(proc); in print_binder_transaction_brief()
6801 struct binder_proc *proc) in print_binder_proc_brief() argument
6805 size_t free_async_space = binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_brief()
6807 seq_printf(m, "%d\t", proc->pid); in print_binder_proc_brief()
6808 seq_printf(m, "%s\t", proc->context->name); in print_binder_proc_brief()
6810 binder_inner_proc_lock(proc); in print_binder_proc_brief()
6811 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_brief()
6815 "\t%zd\n", proc->requested_threads, in print_binder_proc_brief()
6816 proc->requested_threads_started, proc->max_threads, in print_binder_proc_brief()
6819 binder_inner_proc_unlock(proc); in print_binder_proc_brief()
6824 struct binder_proc *proc = NULL; in binder_transaction_proc_show() local
6829 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6830 print_binder_transaction_brief(m, proc, now); in binder_transaction_proc_show()
6833 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transaction_proc_show()
6834 print_binder_proc_brief(m, proc); in binder_transaction_proc_show()
6895 binder_debugfs_dir_entry_proc = debugfs_create_dir("proc", in binder_init()