Lines Matching refs:proc

97 DEFINE_SHOW_ATTRIBUTE(proc);
273 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
275 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
276 __acquires(&proc->outer_lock) in _binder_proc_lock()
280 spin_lock(&proc->outer_lock); in _binder_proc_lock()
289 #define binder_proc_unlock(proc) _binder_proc_unlock(proc, __LINE__) argument
291 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
292 __releases(&proc->outer_lock) in _binder_proc_unlock()
296 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
305 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
307 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
308 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
312 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
321 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
323 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
324 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
328 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
373 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
378 if (node->proc) in _binder_node_inner_lock()
379 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
382 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
394 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
396 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
400 if (proc) in _binder_node_inner_unlock()
401 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
404 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
420 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
425 binder_inner_proc_lock(proc); in binder_worklist_empty()
427 binder_inner_proc_unlock(proc); in binder_worklist_empty()
510 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
512 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
530 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
532 binder_inner_proc_lock(proc); in binder_dequeue_work()
534 binder_inner_proc_unlock(proc); in binder_dequeue_work()
549 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
551 static void binder_free_proc(struct binder_proc *proc);
560 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
567 binder_inner_proc_lock(thread->proc); in binder_has_work()
569 binder_inner_proc_unlock(thread->proc); in binder_has_work()
580 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
586 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
611 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
615 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
616 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
642 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
646 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
669 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
672 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
674 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
676 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
697 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
700 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
703 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
725 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
730 binder_inner_proc_lock(proc); in binder_get_node()
731 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
732 binder_inner_proc_unlock(proc); in binder_get_node()
737 struct binder_proc *proc, in binder_init_node_ilocked() argument
741 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
748 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
773 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
775 node->proc = proc; in binder_init_node_ilocked()
787 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
793 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
801 binder_inner_proc_lock(proc); in binder_new_node()
802 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
803 binder_inner_proc_unlock(proc); in binder_new_node()
823 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
826 if (proc) in binder_inc_node_nilocked()
827 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
832 !(node->proc && in binder_inc_node_nilocked()
833 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
883 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
886 if (proc) in binder_dec_node_nilocked()
887 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
903 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
905 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
906 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
911 if (proc) { in binder_dec_node_nilocked()
913 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
977 if (node->proc) in binder_inc_node_tmpref()
978 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
982 if (node->proc) in binder_inc_node_tmpref()
983 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
1000 if (!node->proc) in binder_dec_node_tmpref()
1006 if (!node->proc) in binder_dec_node_tmpref()
1027 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1030 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1051 static u32 slow_desc_lookup_olocked(struct binder_proc *proc, u32 offset) in slow_desc_lookup_olocked() argument
1058 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) { in slow_desc_lookup_olocked()
1073 static int get_ref_desc_olocked(struct binder_proc *proc, in get_ref_desc_olocked() argument
1077 struct dbitmap *dmap = &proc->dmap; in get_ref_desc_olocked()
1082 offset = (node == proc->context->binder_context_mgr_node) ? 0 : 1; in get_ref_desc_olocked()
1085 *desc = slow_desc_lookup_olocked(proc, offset); in get_ref_desc_olocked()
1099 binder_proc_unlock(proc); in get_ref_desc_olocked()
1101 binder_proc_lock(proc); in get_ref_desc_olocked()
1126 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1136 p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1153 if (get_ref_desc_olocked(proc, node, &desc) == -EAGAIN) in binder_get_ref_for_node_olocked()
1158 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1161 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1164 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1177 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1184 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1192 struct dbitmap *dmap = &ref->proc->dmap; in binder_cleanup_ref_olocked()
1197 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1202 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1203 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1227 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1229 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1234 binder_dequeue_work(ref->proc, &ref->freeze->work); in binder_cleanup_ref_olocked()
1288 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1299 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1325 struct binder_proc *proc, in binder_get_node_from_ref() argument
1332 binder_proc_lock(proc); in binder_get_node_from_ref()
1333 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1344 binder_proc_unlock(proc); in binder_get_node_from_ref()
1349 binder_proc_unlock(proc); in binder_get_node_from_ref()
1370 static void try_shrink_dmap(struct binder_proc *proc) in try_shrink_dmap() argument
1375 binder_proc_lock(proc); in try_shrink_dmap()
1376 nbits = dbitmap_shrink_nbits(&proc->dmap); in try_shrink_dmap()
1377 binder_proc_unlock(proc); in try_shrink_dmap()
1383 binder_proc_lock(proc); in try_shrink_dmap()
1384 dbitmap_shrink(&proc->dmap, new, nbits); in try_shrink_dmap()
1385 binder_proc_unlock(proc); in try_shrink_dmap()
1401 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1409 binder_proc_lock(proc); in binder_update_ref_for_handle()
1410 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1422 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1426 try_shrink_dmap(proc); in binder_update_ref_for_handle()
1431 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1446 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1449 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1466 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1476 binder_proc_lock(proc); in binder_inc_ref_for_node()
1477 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1479 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1483 binder_proc_lock(proc); in binder_inc_ref_for_node()
1484 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1500 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1514 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1540 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1543 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1547 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1562 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1564 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1565 proc->tmp_ref--; in binder_proc_dec_tmpref()
1566 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1567 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1568 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1569 binder_free_proc(proc); in binder_proc_dec_tmpref()
1572 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1610 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1616 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1619 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1624 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1625 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1658 from_proc = t->from ? t->from->proc->pid : 0; in binder_txn_latency_free()
1707 target_thread->proc->pid, in binder_send_failed_reply()
1727 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
1732 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
1788 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
1807 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
1863 struct binder_proc *proc, in binder_validate_ptr() argument
1879 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
1883 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
1931 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
1948 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
1964 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
2035 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
2046 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
2062 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
2065 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
2080 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2100 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2150 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2190 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2214 static inline void binder_release_entire_buffer(struct binder_proc *proc, in binder_release_entire_buffer() argument
2224 binder_transaction_buffer_release(proc, thread, buffer, in binder_release_entire_buffer()
2233 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2238 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2240 node = binder_new_node(proc, fp); in binder_translate_binder()
2246 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2252 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2285 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2291 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2295 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2298 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2304 if (node->proc == target_proc) { in binder_translate_handle()
2311 if (node->proc) in binder_translate_handle()
2312 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2314 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2318 if (node->proc) in binder_translate_handle()
2319 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2321 __release(&node->proc->inner_lock); in binder_translate_handle()
2359 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2372 proc->pid, thread->pid, in binder_translate_fd()
2382 proc->pid, thread->pid, fd); in binder_translate_fd()
2386 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2673 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2682 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2689 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2707 proc->pid, thread->pid); in binder_translate_fd_array()
2740 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
2754 proc->pid, thread->pid); in binder_fixup_parent()
2763 proc->pid, thread->pid); in binder_fixup_parent()
2771 proc->pid, thread->pid); in binder_fixup_parent()
2852 struct binder_proc *proc, in binder_proc_transaction() argument
2871 binder_inner_proc_lock(proc); in binder_proc_transaction()
2872 if (proc->is_frozen) { in binder_proc_transaction()
2874 proc->sync_recv |= !oneway; in binder_proc_transaction()
2875 proc->async_recv |= oneway; in binder_proc_transaction()
2878 if ((frozen && !oneway) || proc->is_dead || in binder_proc_transaction()
2880 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2886 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
2891 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
2901 proc->outstanding_txns--; in binder_proc_transaction()
2908 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
2910 proc->outstanding_txns++; in binder_proc_transaction()
2911 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2924 binder_release_entire_buffer(proc, NULL, buffer, false); in binder_proc_transaction()
2925 binder_alloc_free_buf(&proc->alloc, buffer); in binder_proc_transaction()
2965 if (node->proc) { in binder_get_node_refs_for_txn()
2969 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
2970 *procp = node->proc; in binder_get_node_refs_for_txn()
2985 __release(&from->proc->inner_lock); in binder_set_txn_from_error()
2992 binder_inner_proc_unlock(from->proc); in binder_set_txn_from_error()
2996 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
3020 struct binder_context *context = proc->context; in binder_transaction()
3034 e->from_proc = proc->pid; in binder_transaction()
3039 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
3041 binder_inner_proc_lock(proc); in binder_transaction()
3043 binder_inner_proc_unlock(proc); in binder_transaction()
3046 binder_inner_proc_lock(proc); in binder_transaction()
3049 binder_inner_proc_unlock(proc); in binder_transaction()
3051 proc->pid, thread->pid); in binder_transaction()
3060 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3066 binder_inner_proc_unlock(proc); in binder_transaction()
3074 binder_inner_proc_unlock(proc); in binder_transaction()
3079 __release(&target_thread->proc->inner_lock); in binder_transaction()
3081 thread->pid, proc->pid); in binder_transaction()
3088 proc->pid, thread->pid, in binder_transaction()
3092 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3100 target_proc = target_thread->proc; in binder_transaction()
3102 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3114 binder_proc_lock(proc); in binder_transaction()
3115 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3123 proc->pid, thread->pid, tr->target.handle); in binder_transaction()
3126 binder_proc_unlock(proc); in binder_transaction()
3137 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3139 proc->pid, thread->pid); in binder_transaction()
3148 proc->pid, thread->pid); in binder_transaction()
3155 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3157 thread->pid, proc->pid); in binder_transaction()
3163 if (security_binder_transaction(proc->cred, in binder_transaction()
3166 thread->pid, proc->pid); in binder_transaction()
3172 binder_inner_proc_lock(proc); in binder_transaction()
3188 proc->pid, thread->pid); in binder_transaction()
3189 binder_inner_proc_unlock(proc); in binder_transaction()
3203 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3208 binder_inner_proc_unlock(proc); in binder_transaction()
3219 if (from && from->proc == target_proc) { in binder_transaction()
3229 binder_inner_proc_unlock(proc); in binder_transaction()
3239 thread->pid, proc->pid); in binder_transaction()
3252 thread->pid, proc->pid); in binder_transaction()
3266 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3273 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3282 t->from_pid = proc->pid; in binder_transaction()
3284 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3295 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3299 thread->pid, proc->pid); in binder_transaction()
3309 thread->pid, proc->pid); in binder_transaction()
3371 proc->pid, thread->pid); in binder_transaction()
3379 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3387 proc->pid, thread->pid, in binder_transaction()
3415 thread->pid, proc->pid); in binder_transaction()
3435 proc->pid, thread->pid); in binder_transaction()
3445 proc->pid, thread->pid, in binder_transaction()
3476 thread->pid, proc->pid); in binder_transaction()
3495 thread->pid, proc->pid); in binder_transaction()
3517 thread->pid, proc->pid); in binder_transaction()
3541 proc->pid, thread->pid); in binder_transaction()
3554 proc->pid, thread->pid); in binder_transaction()
3565 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3569 proc->pid, thread->pid, in binder_transaction()
3588 thread->pid, proc->pid); in binder_transaction()
3606 proc->pid, thread->pid); in binder_transaction()
3617 thread->pid, proc->pid); in binder_transaction()
3641 thread->pid, proc->pid); in binder_transaction()
3652 proc->pid, thread->pid, hdr->type); in binder_transaction()
3666 proc->pid, thread->pid); in binder_transaction()
3677 proc->pid, thread->pid); in binder_transaction()
3706 binder_inner_proc_lock(proc); in binder_transaction()
3718 binder_inner_proc_unlock(proc); in binder_transaction()
3722 binder_inner_proc_lock(proc); in binder_transaction()
3724 binder_inner_proc_unlock(proc); in binder_transaction()
3758 thread->pid, proc->pid); in binder_transaction()
3760 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3801 proc->pid, thread->pid, reply ? "reply" : in binder_transaction()
3839 binder_inner_proc_lock(proc); in binder_transaction()
3842 binder_inner_proc_unlock(proc); in binder_transaction()
3849 binder_request_freeze_notification(struct binder_proc *proc, in binder_request_freeze_notification() argument
3859 binder_proc_lock(proc); in binder_request_freeze_notification()
3860 ref = binder_get_ref_olocked(proc, handle_cookie->handle, false); in binder_request_freeze_notification()
3863 proc->pid, thread->pid, handle_cookie->handle); in binder_request_freeze_notification()
3864 binder_proc_unlock(proc); in binder_request_freeze_notification()
3872 proc->pid, thread->pid); in binder_request_freeze_notification()
3874 binder_proc_unlock(proc); in binder_request_freeze_notification()
3885 if (ref->node->proc) { in binder_request_freeze_notification()
3886 binder_inner_proc_lock(ref->node->proc); in binder_request_freeze_notification()
3887 freeze->is_frozen = ref->node->proc->is_frozen; in binder_request_freeze_notification()
3888 binder_inner_proc_unlock(ref->node->proc); in binder_request_freeze_notification()
3890 binder_inner_proc_lock(proc); in binder_request_freeze_notification()
3891 binder_enqueue_work_ilocked(&freeze->work, &proc->todo); in binder_request_freeze_notification()
3892 binder_wakeup_proc_ilocked(proc); in binder_request_freeze_notification()
3893 binder_inner_proc_unlock(proc); in binder_request_freeze_notification()
3897 binder_proc_unlock(proc); in binder_request_freeze_notification()
3902 binder_clear_freeze_notification(struct binder_proc *proc, in binder_clear_freeze_notification() argument
3909 binder_proc_lock(proc); in binder_clear_freeze_notification()
3910 ref = binder_get_ref_olocked(proc, handle_cookie->handle, false); in binder_clear_freeze_notification()
3913 proc->pid, thread->pid, handle_cookie->handle); in binder_clear_freeze_notification()
3914 binder_proc_unlock(proc); in binder_clear_freeze_notification()
3922 proc->pid, thread->pid); in binder_clear_freeze_notification()
3924 binder_proc_unlock(proc); in binder_clear_freeze_notification()
3928 binder_inner_proc_lock(proc); in binder_clear_freeze_notification()
3931 proc->pid, thread->pid, (u64)freeze->cookie, in binder_clear_freeze_notification()
3933 binder_inner_proc_unlock(proc); in binder_clear_freeze_notification()
3935 binder_proc_unlock(proc); in binder_clear_freeze_notification()
3949 binder_enqueue_work_ilocked(&freeze->work, &proc->todo); in binder_clear_freeze_notification()
3950 binder_wakeup_proc_ilocked(proc); in binder_clear_freeze_notification()
3954 binder_inner_proc_unlock(proc); in binder_clear_freeze_notification()
3956 binder_proc_unlock(proc); in binder_clear_freeze_notification()
3961 binder_freeze_notification_done(struct binder_proc *proc, in binder_freeze_notification_done() argument
3968 binder_inner_proc_lock(proc); in binder_freeze_notification_done()
3969 list_for_each_entry(w, &proc->delivered_freeze, entry) { in binder_freeze_notification_done()
3980 proc->pid, thread->pid, (u64)cookie); in binder_freeze_notification_done()
3981 binder_inner_proc_unlock(proc); in binder_freeze_notification_done()
3988 binder_enqueue_work_ilocked(&freeze->work, &proc->todo); in binder_freeze_notification_done()
3989 binder_wakeup_proc_ilocked(proc); in binder_freeze_notification_done()
3991 binder_inner_proc_unlock(proc); in binder_freeze_notification_done()
4007 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
4011 binder_inner_proc_lock(proc); in binder_free_buf()
4016 binder_inner_proc_unlock(proc); in binder_free_buf()
4024 BUG_ON(buf_node->proc != proc); in binder_free_buf()
4031 w, &proc->todo); in binder_free_buf()
4032 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
4037 binder_release_entire_buffer(proc, thread, buffer, is_failure); in binder_free_buf()
4038 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
4041 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
4047 struct binder_context *context = proc->context; in binder_thread_write()
4061 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
4086 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
4088 proc->pid, thread->pid); in binder_thread_write()
4093 proc, ctx_mgr_node, in binder_thread_write()
4100 proc, target, increment, strong, in binder_thread_write()
4104 proc->pid, thread->pid, in binder_thread_write()
4124 proc->pid, thread->pid, debug_string, in binder_thread_write()
4130 proc->pid, thread->pid, debug_string, in binder_thread_write()
4148 node = binder_get_node(proc, node_ptr); in binder_thread_write()
4151 proc->pid, thread->pid, in binder_thread_write()
4160 proc->pid, thread->pid, in binder_thread_write()
4172 proc->pid, thread->pid, in binder_thread_write()
4182 proc->pid, thread->pid, in binder_thread_write()
4195 proc->pid, thread->pid, in binder_thread_write()
4218 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4224 proc->pid, thread->pid, in binder_thread_write()
4225 (unsigned long)data_ptr - proc->alloc.vm_start); in binder_thread_write()
4229 proc->pid, thread->pid, in binder_thread_write()
4230 (unsigned long)data_ptr - proc->alloc.vm_start); in binder_thread_write()
4236 proc->pid, thread->pid, in binder_thread_write()
4237 (unsigned long)data_ptr - proc->alloc.vm_start, in binder_thread_write()
4240 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4251 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4262 binder_transaction(proc, thread, &tr, in binder_thread_write()
4270 proc->pid, thread->pid); in binder_thread_write()
4271 binder_inner_proc_lock(proc); in binder_thread_write()
4275 proc->pid, thread->pid); in binder_thread_write()
4276 } else if (proc->requested_threads == 0) { in binder_thread_write()
4279 proc->pid, thread->pid); in binder_thread_write()
4281 proc->requested_threads--; in binder_thread_write()
4282 proc->requested_threads_started++; in binder_thread_write()
4285 binder_inner_proc_unlock(proc); in binder_thread_write()
4290 proc->pid, thread->pid); in binder_thread_write()
4294 proc->pid, thread->pid); in binder_thread_write()
4301 proc->pid, thread->pid); in binder_thread_write()
4334 proc->pid, thread->pid); in binder_thread_write()
4338 binder_proc_lock(proc); in binder_thread_write()
4339 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4342 proc->pid, thread->pid, in binder_thread_write()
4347 binder_proc_unlock(proc); in binder_thread_write()
4354 proc->pid, thread->pid, in binder_thread_write()
4366 proc->pid, thread->pid); in binder_thread_write()
4368 binder_proc_unlock(proc); in binder_thread_write()
4376 if (ref->node->proc == NULL) { in binder_thread_write()
4379 binder_inner_proc_lock(proc); in binder_thread_write()
4381 &ref->death->work, &proc->todo); in binder_thread_write()
4382 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4383 binder_inner_proc_unlock(proc); in binder_thread_write()
4388 proc->pid, thread->pid); in binder_thread_write()
4390 binder_proc_unlock(proc); in binder_thread_write()
4396 proc->pid, thread->pid, in binder_thread_write()
4400 binder_proc_unlock(proc); in binder_thread_write()
4404 binder_inner_proc_lock(proc); in binder_thread_write()
4416 &proc->todo); in binder_thread_write()
4418 proc); in binder_thread_write()
4424 binder_inner_proc_unlock(proc); in binder_thread_write()
4427 binder_proc_unlock(proc); in binder_thread_write()
4438 binder_inner_proc_lock(proc); in binder_thread_write()
4439 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4453 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4457 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4458 binder_inner_proc_unlock(proc); in binder_thread_write()
4472 &proc->todo); in binder_thread_write()
4473 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4476 binder_inner_proc_unlock(proc); in binder_thread_write()
4486 error = binder_request_freeze_notification(proc, thread, in binder_thread_write()
4499 error = binder_clear_freeze_notification(proc, thread, &handle_cookie); in binder_thread_write()
4512 error = binder_freeze_notification_done(proc, thread, cookie); in binder_thread_write()
4519 proc->pid, thread->pid, cmd); in binder_thread_write()
4527 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4533 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4538 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4560 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4562 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4573 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4576 binder_inner_proc_lock(proc); in binder_wait_for_work()
4583 &proc->waiting_threads); in binder_wait_for_work()
4584 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4586 binder_inner_proc_lock(proc); in binder_wait_for_work()
4594 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4612 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4633 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4653 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4672 binder_inner_proc_lock(proc); in binder_thread_read()
4674 binder_inner_proc_unlock(proc); in binder_thread_read()
4680 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4685 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4689 binder_set_nice(proc->default_priority); in binder_thread_read()
4714 binder_inner_proc_lock(proc); in binder_thread_read()
4717 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4719 list = &proc->todo; in binder_thread_read()
4721 binder_inner_proc_unlock(proc); in binder_thread_read()
4730 binder_inner_proc_unlock(proc); in binder_thread_read()
4739 binder_inner_proc_unlock(proc); in binder_thread_read()
4747 binder_inner_proc_unlock(proc); in binder_thread_read()
4754 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4759 if (proc->oneway_spam_detection_enabled && in binder_thread_read()
4766 binder_inner_proc_unlock(proc); in binder_thread_read()
4773 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4776 proc->pid, thread->pid); in binder_thread_read()
4788 BUG_ON(proc != node->proc); in binder_thread_read()
4814 proc->pid, thread->pid, in binder_thread_read()
4818 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4819 binder_inner_proc_unlock(proc); in binder_thread_read()
4833 binder_inner_proc_unlock(proc); in binder_thread_read()
4837 proc, thread, &ptr, node_ptr, in binder_thread_read()
4842 proc, thread, &ptr, node_ptr, in binder_thread_read()
4847 proc, thread, &ptr, node_ptr, in binder_thread_read()
4852 proc, thread, &ptr, node_ptr, in binder_thread_read()
4858 proc->pid, thread->pid, in binder_thread_read()
4881 proc->pid, thread->pid, in binder_thread_read()
4887 binder_inner_proc_unlock(proc); in binder_thread_read()
4892 w, &proc->delivered_death); in binder_thread_read()
4893 binder_inner_proc_unlock(proc); in binder_thread_read()
4902 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4916 binder_enqueue_work_ilocked(w, &proc->delivered_freeze); in binder_thread_read()
4917 binder_inner_proc_unlock(proc); in binder_thread_read()
4925 binder_stat_br(proc, thread, BR_FROZEN_BINDER); in binder_thread_read()
4934 binder_inner_proc_unlock(proc); in binder_thread_read()
4943 binder_stat_br(proc, thread, BR_CLEAR_FREEZE_NOTIFICATION_DONE); in binder_thread_read()
4947 binder_inner_proc_unlock(proc); in binder_thread_read()
4949 proc->pid, thread->pid, w->type); in binder_thread_read()
4981 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
4990 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
5001 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
5004 proc->pid, thread->pid, in binder_thread_read()
5013 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5052 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5055 proc->pid, thread->pid, in binder_thread_read()
5059 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
5067 binder_inner_proc_lock(thread->proc); in binder_thread_read()
5071 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
5081 binder_inner_proc_lock(proc); in binder_thread_read()
5082 if (proc->requested_threads == 0 && in binder_thread_read()
5083 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
5084 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
5088 proc->requested_threads++; in binder_thread_read()
5089 binder_inner_proc_unlock(proc); in binder_thread_read()
5092 proc->pid, thread->pid); in binder_thread_read()
5095 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
5097 binder_inner_proc_unlock(proc); in binder_thread_read()
5101 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
5108 binder_inner_proc_lock(proc); in binder_release_work()
5111 binder_inner_proc_unlock(proc); in binder_release_work()
5173 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
5177 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
5194 thread->proc = proc; in binder_get_thread_ilocked()
5200 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
5211 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
5216 binder_inner_proc_lock(proc); in binder_get_thread()
5217 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
5218 binder_inner_proc_unlock(proc); in binder_get_thread()
5223 binder_inner_proc_lock(proc); in binder_get_thread()
5224 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
5225 binder_inner_proc_unlock(proc); in binder_get_thread()
5232 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
5236 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
5237 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
5238 if (proc->outstanding_txns) in binder_free_proc()
5240 __func__, proc->outstanding_txns); in binder_free_proc()
5241 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
5244 kfree(proc->context->name); in binder_free_proc()
5247 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5248 put_task_struct(proc->tsk); in binder_free_proc()
5249 put_cred(proc->cred); in binder_free_proc()
5251 dbitmap_free(&proc->dmap); in binder_free_proc()
5252 kfree(proc); in binder_free_proc()
5259 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5263 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5271 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5278 proc->tmp_ref++; in binder_thread_release()
5284 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5300 proc->pid, thread->pid, in binder_thread_release()
5305 thread->proc->outstanding_txns--; in binder_thread_release()
5334 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5348 binder_release_work(proc, &thread->todo); in binder_thread_release()
5356 struct binder_proc *proc = filp->private_data; in binder_poll() local
5360 thread = binder_get_thread(proc); in binder_poll()
5364 binder_inner_proc_lock(thread->proc); in binder_poll()
5368 binder_inner_proc_unlock(thread->proc); in binder_poll()
5382 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5391 proc->pid, thread->pid, in binder_ioctl_write_read()
5396 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5407 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5412 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5413 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5414 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5415 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5421 proc->pid, thread->pid, in binder_ioctl_write_read()
5434 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5435 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5444 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5458 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5472 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5476 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5482 proc->pid); in binder_ioctl_get_node_info_for_ref()
5489 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5495 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5508 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5516 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5517 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5528 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5533 static bool binder_txns_pending_ilocked(struct binder_proc *proc) in binder_txns_pending_ilocked() argument
5538 if (proc->outstanding_txns > 0) in binder_txns_pending_ilocked()
5541 for (n = rb_first(&proc->threads); n; n = rb_next(n)) { in binder_txns_pending_ilocked()
5549 static void binder_add_freeze_work(struct binder_proc *proc, bool is_frozen) in binder_add_freeze_work() argument
5555 binder_inner_proc_lock(proc); in binder_add_freeze_work()
5556 for (n = rb_first(&proc->nodes); n; n = rb_next(n)) { in binder_add_freeze_work()
5561 binder_inner_proc_unlock(proc); in binder_add_freeze_work()
5572 binder_inner_proc_lock(ref->proc); in binder_add_freeze_work()
5574 binder_inner_proc_unlock(ref->proc); in binder_add_freeze_work()
5580 binder_enqueue_work_ilocked(&ref->freeze->work, &ref->proc->todo); in binder_add_freeze_work()
5581 binder_wakeup_proc_ilocked(ref->proc); in binder_add_freeze_work()
5587 binder_inner_proc_unlock(ref->proc); in binder_add_freeze_work()
5591 binder_inner_proc_lock(proc); in binder_add_freeze_work()
5592 if (proc->is_dead) in binder_add_freeze_work()
5595 binder_inner_proc_unlock(proc); in binder_add_freeze_work()
5686 binder_inner_proc_lock(thread->proc); in binder_ioctl_get_extended_error()
5689 binder_inner_proc_unlock(thread->proc); in binder_ioctl_get_extended_error()
5700 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5710 thread = binder_get_thread(proc); in binder_ioctl()
5730 binder_inner_proc_lock(proc); in binder_ioctl()
5731 proc->max_threads = max_threads; in binder_ioctl()
5732 binder_inner_proc_unlock(proc); in binder_ioctl()
5754 proc->pid, thread->pid); in binder_ioctl()
5755 binder_thread_release(proc, thread); in binder_ioctl()
5776 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5795 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5890 binder_inner_proc_lock(proc); in binder_ioctl()
5891 proc->oneway_spam_detection_enabled = (bool)enable; in binder_ioctl()
5892 binder_inner_proc_unlock(proc); in binder_ioctl()
5910 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5918 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5922 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5929 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5933 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5936 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
5953 struct binder_proc *proc = filp->private_data; in binder_mmap() local
5955 if (proc->tsk != current->group_leader) in binder_mmap()
5960 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
5966 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
5972 vma->vm_private_data = proc; in binder_mmap()
5974 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
5979 struct binder_proc *proc, *itr; in binder_open() local
5988 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
5989 if (proc == NULL) in binder_open()
5992 dbitmap_init(&proc->dmap); in binder_open()
5993 spin_lock_init(&proc->inner_lock); in binder_open()
5994 spin_lock_init(&proc->outer_lock); in binder_open()
5996 proc->tsk = current->group_leader; in binder_open()
5997 proc->cred = get_cred(filp->f_cred); in binder_open()
5998 INIT_LIST_HEAD(&proc->todo); in binder_open()
5999 init_waitqueue_head(&proc->freeze_wait); in binder_open()
6000 proc->default_priority = task_nice(current); in binder_open()
6011 proc->context = &binder_dev->context; in binder_open()
6012 binder_alloc_init(&proc->alloc); in binder_open()
6015 proc->pid = current->group_leader->pid; in binder_open()
6016 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
6017 INIT_LIST_HEAD(&proc->delivered_freeze); in binder_open()
6018 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
6019 filp->private_data = proc; in binder_open()
6023 if (itr->pid == proc->pid) { in binder_open()
6028 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
6034 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
6041 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
6043 (void *)(unsigned long)proc->pid, in binder_open()
6051 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
6059 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
6061 proc->binderfs_entry = binderfs_entry; in binder_open()
6076 struct binder_proc *proc = filp->private_data; in binder_flush() local
6078 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
6083 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
6088 binder_inner_proc_lock(proc); in binder_deferred_flush()
6089 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
6098 binder_inner_proc_unlock(proc); in binder_deferred_flush()
6101 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
6107 struct binder_proc *proc = filp->private_data; in binder_release() local
6109 debugfs_remove(proc->debugfs_entry); in binder_release()
6111 if (proc->binderfs_entry) { in binder_release()
6112 simple_recursive_removal(proc->binderfs_entry, NULL); in binder_release()
6113 proc->binderfs_entry = NULL; in binder_release()
6116 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
6125 struct binder_proc *proc = node->proc; in binder_node_release() local
6127 binder_release_work(proc, &node->async_todo); in binder_node_release()
6130 binder_inner_proc_lock(proc); in binder_node_release()
6137 binder_inner_proc_unlock(proc); in binder_node_release()
6144 node->proc = NULL; in binder_node_release()
6147 binder_inner_proc_unlock(proc); in binder_node_release()
6161 binder_inner_proc_lock(ref->proc); in binder_node_release()
6163 binder_inner_proc_unlock(ref->proc); in binder_node_release()
6172 &ref->proc->todo); in binder_node_release()
6173 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
6174 binder_inner_proc_unlock(ref->proc); in binder_node_release()
6186 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
6188 struct binder_context *context = proc->context; in binder_deferred_release()
6193 hlist_del(&proc->proc_node); in binder_deferred_release()
6198 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
6201 __func__, proc->pid); in binder_deferred_release()
6205 binder_inner_proc_lock(proc); in binder_deferred_release()
6210 proc->tmp_ref++; in binder_deferred_release()
6212 proc->is_dead = true; in binder_deferred_release()
6213 proc->is_frozen = false; in binder_deferred_release()
6214 proc->sync_recv = false; in binder_deferred_release()
6215 proc->async_recv = false; in binder_deferred_release()
6218 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
6222 binder_inner_proc_unlock(proc); in binder_deferred_release()
6224 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
6225 binder_inner_proc_lock(proc); in binder_deferred_release()
6230 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
6241 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
6242 binder_inner_proc_unlock(proc); in binder_deferred_release()
6244 binder_inner_proc_lock(proc); in binder_deferred_release()
6246 binder_inner_proc_unlock(proc); in binder_deferred_release()
6249 binder_proc_lock(proc); in binder_deferred_release()
6250 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
6256 binder_proc_unlock(proc); in binder_deferred_release()
6258 binder_proc_lock(proc); in binder_deferred_release()
6260 binder_proc_unlock(proc); in binder_deferred_release()
6262 binder_release_work(proc, &proc->todo); in binder_deferred_release()
6263 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
6264 binder_release_work(proc, &proc->delivered_freeze); in binder_deferred_release()
6268 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
6271 binder_proc_dec_tmpref(proc); in binder_deferred_release()
6276 struct binder_proc *proc; in binder_deferred_func() local
6283 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
6285 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
6286 defer = proc->deferred_work; in binder_deferred_func()
6287 proc->deferred_work = 0; in binder_deferred_func()
6289 proc = NULL; in binder_deferred_func()
6295 binder_deferred_flush(proc); in binder_deferred_func()
6298 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
6299 } while (proc); in binder_deferred_func()
6304 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
6307 proc->deferred_work |= defer; in binder_defer_work()
6308 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
6309 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
6316 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
6337 if (proc != to_proc) { in print_binder_transaction_ilocked()
6354 buffer->user_data - proc->alloc.vm_start); in print_binder_transaction_ilocked()
6358 struct binder_proc *proc, in print_binder_work_ilocked() argument
6370 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6432 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6436 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6440 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6446 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6477 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6480 if (node->proc) { in print_binder_node_nilocked()
6482 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6494 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6517 print_next_binder_node_ilocked(struct seq_file *m, struct binder_proc *proc, in print_next_binder_node_ilocked() argument
6530 if (proc) in print_next_binder_node_ilocked()
6531 binder_inner_proc_unlock(proc); in print_next_binder_node_ilocked()
6539 if (proc) in print_next_binder_node_ilocked()
6540 binder_inner_proc_lock(proc); in print_next_binder_node_ilocked()
6546 static void print_binder_proc(struct seq_file *m, struct binder_proc *proc, in print_binder_proc() argument
6555 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6556 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6559 binder_inner_proc_lock(proc); in print_binder_proc()
6560 for (n = rb_first(&proc->threads); n; n = rb_next(n)) in print_binder_proc()
6564 for (n = rb_first(&proc->nodes); n; n = rb_next(n)) { in print_binder_proc()
6570 last_node = print_next_binder_node_ilocked(m, proc, node, in print_binder_proc()
6574 binder_inner_proc_unlock(proc); in print_binder_proc()
6579 binder_proc_lock(proc); in print_binder_proc()
6580 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) in print_binder_proc()
6584 binder_proc_unlock(proc); in print_binder_proc()
6586 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6587 binder_inner_proc_lock(proc); in print_binder_proc()
6588 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6589 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6592 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6596 list_for_each_entry(w, &proc->delivered_freeze, entry) { in print_binder_proc()
6600 binder_inner_proc_unlock(proc); in print_binder_proc()
6710 struct binder_proc *proc) in print_binder_proc_stats() argument
6717 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6719 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6720 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6723 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6724 for (n = rb_first(&proc->threads); n; n = rb_next(n)) in print_binder_proc_stats()
6727 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6733 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6734 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6738 for (n = rb_first(&proc->nodes); n; n = rb_next(n)) in print_binder_proc_stats()
6740 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6745 binder_proc_lock(proc); in print_binder_proc_stats()
6746 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) { in print_binder_proc_stats()
6753 binder_proc_unlock(proc); in print_binder_proc_stats()
6756 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6759 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6762 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6763 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6767 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6770 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6775 struct binder_proc *proc; in print_binder_state() local
6793 hlist_for_each_entry(proc, &binder_procs, proc_node) in print_binder_state()
6794 print_binder_proc(m, proc, true, hash_ptrs); in print_binder_state()
6800 struct binder_proc *proc; in print_binder_transactions() local
6804 hlist_for_each_entry(proc, &binder_procs, proc_node) in print_binder_transactions()
6805 print_binder_proc(m, proc, false, hash_ptrs); in print_binder_transactions()
6823 struct binder_proc *proc; in stats_show() local
6830 hlist_for_each_entry(proc, &binder_procs, proc_node) in stats_show()
6831 print_binder_proc_stats(m, proc); in stats_show()