Lines Matching refs:proc

98 DEFINE_SHOW_ATTRIBUTE(proc);
274 #define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__) argument
276 _binder_proc_lock(struct binder_proc *proc, int line) in _binder_proc_lock() argument
277 __acquires(&proc->outer_lock) in _binder_proc_lock()
281 spin_lock(&proc->outer_lock); in _binder_proc_lock()
290 #define binder_proc_unlock(proc) _binder_proc_unlock(proc, __LINE__) argument
292 _binder_proc_unlock(struct binder_proc *proc, int line) in _binder_proc_unlock() argument
293 __releases(&proc->outer_lock) in _binder_proc_unlock()
297 spin_unlock(&proc->outer_lock); in _binder_proc_unlock()
306 #define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__) argument
308 _binder_inner_proc_lock(struct binder_proc *proc, int line) in _binder_inner_proc_lock() argument
309 __acquires(&proc->inner_lock) in _binder_inner_proc_lock()
313 spin_lock(&proc->inner_lock); in _binder_inner_proc_lock()
322 #define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__) argument
324 _binder_inner_proc_unlock(struct binder_proc *proc, int line) in _binder_inner_proc_unlock() argument
325 __releases(&proc->inner_lock) in _binder_inner_proc_unlock()
329 spin_unlock(&proc->inner_lock); in _binder_inner_proc_unlock()
374 __acquires(&node->lock) __acquires(&node->proc->inner_lock) in _binder_node_inner_lock()
379 if (node->proc) in _binder_node_inner_lock()
380 binder_inner_proc_lock(node->proc); in _binder_node_inner_lock()
383 __acquire(&node->proc->inner_lock); in _binder_node_inner_lock()
395 __releases(&node->lock) __releases(&node->proc->inner_lock) in _binder_node_inner_unlock()
397 struct binder_proc *proc = node->proc; in _binder_node_inner_unlock() local
401 if (proc) in _binder_node_inner_unlock()
402 binder_inner_proc_unlock(proc); in _binder_node_inner_unlock()
405 __release(&node->proc->inner_lock); in _binder_node_inner_unlock()
421 static bool binder_worklist_empty(struct binder_proc *proc, in binder_worklist_empty() argument
426 binder_inner_proc_lock(proc); in binder_worklist_empty()
428 binder_inner_proc_unlock(proc); in binder_worklist_empty()
511 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
513 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
531 binder_dequeue_work(struct binder_proc *proc, struct binder_work *work) in binder_dequeue_work() argument
533 binder_inner_proc_lock(proc); in binder_dequeue_work()
535 binder_inner_proc_unlock(proc); in binder_dequeue_work()
550 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
552 static void binder_free_proc(struct binder_proc *proc);
561 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
568 binder_inner_proc_lock(thread->proc); in binder_has_work()
570 binder_inner_proc_unlock(thread->proc); in binder_has_work()
581 static void binder_wakeup_poll_threads_ilocked(struct binder_proc *proc, in binder_wakeup_poll_threads_ilocked() argument
587 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_wakeup_poll_threads_ilocked()
612 binder_select_thread_ilocked(struct binder_proc *proc) in binder_select_thread_ilocked() argument
616 assert_spin_locked(&proc->inner_lock); in binder_select_thread_ilocked()
617 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
643 static void binder_wakeup_thread_ilocked(struct binder_proc *proc, in binder_wakeup_thread_ilocked() argument
647 assert_spin_locked(&proc->inner_lock); in binder_wakeup_thread_ilocked()
670 binder_wakeup_poll_threads_ilocked(proc, sync); in binder_wakeup_thread_ilocked()
673 static void binder_wakeup_proc_ilocked(struct binder_proc *proc) in binder_wakeup_proc_ilocked() argument
675 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked()
677 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
698 static struct binder_node *binder_get_node_ilocked(struct binder_proc *proc, in binder_get_node_ilocked() argument
701 struct rb_node *n = proc->nodes.rb_node; in binder_get_node_ilocked()
704 assert_spin_locked(&proc->inner_lock); in binder_get_node_ilocked()
726 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
731 binder_inner_proc_lock(proc); in binder_get_node()
732 node = binder_get_node_ilocked(proc, ptr); in binder_get_node()
733 binder_inner_proc_unlock(proc); in binder_get_node()
738 struct binder_proc *proc, in binder_init_node_ilocked() argument
742 struct rb_node **p = &proc->nodes.rb_node; in binder_init_node_ilocked()
749 assert_spin_locked(&proc->inner_lock); in binder_init_node_ilocked()
774 rb_insert_color(&node->rb_node, &proc->nodes); in binder_init_node_ilocked()
776 node->proc = proc; in binder_init_node_ilocked()
788 proc->pid, current->pid, node->debug_id, in binder_init_node_ilocked()
794 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
802 binder_inner_proc_lock(proc); in binder_new_node()
803 node = binder_init_node_ilocked(proc, new_node, fp); in binder_new_node()
804 binder_inner_proc_unlock(proc); in binder_new_node()
824 struct binder_proc *proc = node->proc; in binder_inc_node_nilocked() local
827 if (proc) in binder_inc_node_nilocked()
828 assert_spin_locked(&proc->inner_lock); in binder_inc_node_nilocked()
833 !(node->proc && in binder_inc_node_nilocked()
834 node == node->proc->context->binder_context_mgr_node && in binder_inc_node_nilocked()
875 struct binder_proc *proc = node->proc; in binder_dec_node_nilocked() local
878 if (proc) in binder_dec_node_nilocked()
879 assert_spin_locked(&proc->inner_lock); in binder_dec_node_nilocked()
895 if (proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node_nilocked()
897 binder_enqueue_work_ilocked(&node->work, &proc->todo); in binder_dec_node_nilocked()
898 binder_wakeup_proc_ilocked(proc); in binder_dec_node_nilocked()
903 if (proc) { in binder_dec_node_nilocked()
905 rb_erase(&node->rb_node, &proc->nodes); in binder_dec_node_nilocked()
969 if (node->proc) in binder_inc_node_tmpref()
970 binder_inner_proc_lock(node->proc); in binder_inc_node_tmpref()
974 if (node->proc) in binder_inc_node_tmpref()
975 binder_inner_proc_unlock(node->proc); in binder_inc_node_tmpref()
992 if (!node->proc) in binder_dec_node_tmpref()
998 if (!node->proc) in binder_dec_node_tmpref()
1019 static struct binder_ref *binder_get_ref_olocked(struct binder_proc *proc, in binder_get_ref_olocked() argument
1022 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref_olocked()
1043 static u32 slow_desc_lookup_olocked(struct binder_proc *proc, u32 offset) in slow_desc_lookup_olocked() argument
1050 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) { in slow_desc_lookup_olocked()
1065 static int get_ref_desc_olocked(struct binder_proc *proc, in get_ref_desc_olocked() argument
1069 struct dbitmap *dmap = &proc->dmap; in get_ref_desc_olocked()
1074 offset = (node == proc->context->binder_context_mgr_node) ? 0 : 1; in get_ref_desc_olocked()
1077 *desc = slow_desc_lookup_olocked(proc, offset); in get_ref_desc_olocked()
1091 binder_proc_unlock(proc); in get_ref_desc_olocked()
1093 binder_proc_lock(proc); in get_ref_desc_olocked()
1118 struct binder_proc *proc, in binder_get_ref_for_node_olocked() argument
1128 p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node_olocked()
1145 if (get_ref_desc_olocked(proc, node, &desc) == -EAGAIN) in binder_get_ref_for_node_olocked()
1150 new_ref->proc = proc; in binder_get_ref_for_node_olocked()
1153 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node_olocked()
1156 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node_olocked()
1169 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node_olocked()
1176 proc->pid, new_ref->data.debug_id, new_ref->data.desc, in binder_get_ref_for_node_olocked()
1184 struct dbitmap *dmap = &ref->proc->dmap; in binder_cleanup_ref_olocked()
1189 ref->proc->pid, ref->data.debug_id, ref->data.desc, in binder_cleanup_ref_olocked()
1194 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_cleanup_ref_olocked()
1195 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_cleanup_ref_olocked()
1219 ref->proc->pid, ref->data.debug_id, in binder_cleanup_ref_olocked()
1221 binder_dequeue_work(ref->proc, &ref->death->work); in binder_cleanup_ref_olocked()
1226 binder_dequeue_work(ref->proc, &ref->freeze->work); in binder_cleanup_ref_olocked()
1280 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1291 ref->proc->pid, ref->data.debug_id, in binder_dec_ref_olocked()
1317 struct binder_proc *proc, in binder_get_node_from_ref() argument
1324 binder_proc_lock(proc); in binder_get_node_from_ref()
1325 ref = binder_get_ref_olocked(proc, desc, need_strong_ref); in binder_get_node_from_ref()
1336 binder_proc_unlock(proc); in binder_get_node_from_ref()
1341 binder_proc_unlock(proc); in binder_get_node_from_ref()
1362 static void try_shrink_dmap(struct binder_proc *proc) in try_shrink_dmap() argument
1367 binder_proc_lock(proc); in try_shrink_dmap()
1368 nbits = dbitmap_shrink_nbits(&proc->dmap); in try_shrink_dmap()
1369 binder_proc_unlock(proc); in try_shrink_dmap()
1375 binder_proc_lock(proc); in try_shrink_dmap()
1376 dbitmap_shrink(&proc->dmap, new, nbits); in try_shrink_dmap()
1377 binder_proc_unlock(proc); in try_shrink_dmap()
1393 static int binder_update_ref_for_handle(struct binder_proc *proc, in binder_update_ref_for_handle() argument
1401 binder_proc_lock(proc); in binder_update_ref_for_handle()
1402 ref = binder_get_ref_olocked(proc, desc, strong); in binder_update_ref_for_handle()
1414 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1418 try_shrink_dmap(proc); in binder_update_ref_for_handle()
1423 binder_proc_unlock(proc); in binder_update_ref_for_handle()
1438 static int binder_dec_ref_for_handle(struct binder_proc *proc, in binder_dec_ref_for_handle() argument
1441 return binder_update_ref_for_handle(proc, desc, false, strong, rdata); in binder_dec_ref_for_handle()
1458 static int binder_inc_ref_for_node(struct binder_proc *proc, in binder_inc_ref_for_node() argument
1468 binder_proc_lock(proc); in binder_inc_ref_for_node()
1469 ref = binder_get_ref_for_node_olocked(proc, node, NULL); in binder_inc_ref_for_node()
1471 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1475 binder_proc_lock(proc); in binder_inc_ref_for_node()
1476 ref = binder_get_ref_for_node_olocked(proc, node, new_ref); in binder_inc_ref_for_node()
1492 binder_proc_unlock(proc); in binder_inc_ref_for_node()
1506 assert_spin_locked(&target_thread->proc->inner_lock); in binder_pop_transaction_ilocked()
1532 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1535 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1539 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1554 static void binder_proc_dec_tmpref(struct binder_proc *proc) in binder_proc_dec_tmpref() argument
1556 binder_inner_proc_lock(proc); in binder_proc_dec_tmpref()
1557 proc->tmp_ref--; in binder_proc_dec_tmpref()
1558 if (proc->is_dead && RB_EMPTY_ROOT(&proc->threads) && in binder_proc_dec_tmpref()
1559 !proc->tmp_ref) { in binder_proc_dec_tmpref()
1560 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1561 binder_free_proc(proc); in binder_proc_dec_tmpref()
1564 binder_inner_proc_unlock(proc); in binder_proc_dec_tmpref()
1602 __acquires(&t->from->proc->inner_lock) in binder_get_txn_from_and_acq_inner()
1608 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1611 binder_inner_proc_lock(from->proc); in binder_get_txn_from_and_acq_inner()
1616 binder_inner_proc_unlock(from->proc); in binder_get_txn_from_and_acq_inner()
1617 __acquire(&from->proc->inner_lock); in binder_get_txn_from_and_acq_inner()
1650 from_proc = t->from ? t->from->proc->pid : 0; in binder_txn_latency_free()
1699 target_thread->proc->pid, in binder_send_failed_reply()
1719 binder_inner_proc_unlock(target_thread->proc); in binder_send_failed_reply()
1724 __release(&target_thread->proc->inner_lock); in binder_send_failed_reply()
1780 static size_t binder_get_object(struct binder_proc *proc, in binder_get_object() argument
1799 if (binder_alloc_copy_from_buffer(&proc->alloc, object, buffer, in binder_get_object()
1855 struct binder_proc *proc, in binder_validate_ptr() argument
1871 if (binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_validate_ptr()
1875 object_size = binder_get_object(proc, NULL, b, object_offset, object); in binder_validate_ptr()
1923 static bool binder_validate_fixup(struct binder_proc *proc, in binder_validate_fixup() argument
1940 size_t object_size = binder_get_object(proc, NULL, b, in binder_validate_fixup()
1956 if (binder_alloc_copy_from_buffer(&proc->alloc, in binder_validate_fixup()
2027 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
2038 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
2054 if (!binder_alloc_copy_from_buffer(&proc->alloc, &object_offset, in binder_transaction_buffer_release()
2057 object_size = binder_get_object(proc, NULL, buffer, in binder_transaction_buffer_release()
2072 node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
2092 ret = binder_dec_ref_for_handle(proc, fp->handle, in binder_transaction_buffer_release()
2142 parent = binder_validate_ptr(proc, buffer, &ptr_object, in binder_transaction_buffer_release()
2182 &proc->alloc, &fd, buffer, in binder_transaction_buffer_release()
2206 static inline void binder_release_entire_buffer(struct binder_proc *proc, in binder_release_entire_buffer() argument
2216 binder_transaction_buffer_release(proc, thread, buffer, in binder_release_entire_buffer()
2225 struct binder_proc *proc = thread->proc; in binder_translate_binder() local
2230 node = binder_get_node(proc, fp->binder); in binder_translate_binder()
2232 node = binder_new_node(proc, fp); in binder_translate_binder()
2238 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2244 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_binder()
2277 struct binder_proc *proc = thread->proc; in binder_translate_handle() local
2283 node = binder_get_node_from_ref(proc, fp->handle, in binder_translate_handle()
2287 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2290 if (security_binder_transfer_binder(proc->cred, target_proc->cred)) { in binder_translate_handle()
2296 if (node->proc == target_proc) { in binder_translate_handle()
2303 if (node->proc) in binder_translate_handle()
2304 binder_inner_proc_lock(node->proc); in binder_translate_handle()
2306 __acquire(&node->proc->inner_lock); in binder_translate_handle()
2310 if (node->proc) in binder_translate_handle()
2311 binder_inner_proc_unlock(node->proc); in binder_translate_handle()
2313 __release(&node->proc->inner_lock); in binder_translate_handle()
2351 struct binder_proc *proc = thread->proc; in binder_translate_fd() local
2364 proc->pid, thread->pid, in binder_translate_fd()
2374 proc->pid, thread->pid, fd); in binder_translate_fd()
2378 ret = security_binder_transfer_file(proc->cred, target_proc->cred, file); in binder_translate_fd()
2665 struct binder_proc *proc = thread->proc; in binder_translate_fd_array() local
2674 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2681 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2699 proc->pid, thread->pid); in binder_translate_fd_array()
2732 struct binder_proc *proc = thread->proc; in binder_fixup_parent() local
2746 proc->pid, thread->pid); in binder_fixup_parent()
2755 proc->pid, thread->pid); in binder_fixup_parent()
2763 proc->pid, thread->pid); in binder_fixup_parent()
2844 struct binder_proc *proc, in binder_proc_transaction() argument
2863 binder_inner_proc_lock(proc); in binder_proc_transaction()
2864 if (proc->is_frozen) { in binder_proc_transaction()
2866 proc->sync_recv |= !oneway; in binder_proc_transaction()
2867 proc->async_recv |= oneway; in binder_proc_transaction()
2870 if ((frozen && !oneway) || proc->is_dead || in binder_proc_transaction()
2872 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2878 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
2883 binder_enqueue_work_ilocked(&t->work, &proc->todo); in binder_proc_transaction()
2893 proc->outstanding_txns--; in binder_proc_transaction()
2900 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
2902 proc->outstanding_txns++; in binder_proc_transaction()
2903 binder_inner_proc_unlock(proc); in binder_proc_transaction()
2916 binder_release_entire_buffer(proc, NULL, buffer, false); in binder_proc_transaction()
2917 binder_alloc_free_buf(&proc->alloc, buffer); in binder_proc_transaction()
2957 if (node->proc) { in binder_get_node_refs_for_txn()
2961 node->proc->tmp_ref++; in binder_get_node_refs_for_txn()
2962 *procp = node->proc; in binder_get_node_refs_for_txn()
2977 __release(&from->proc->inner_lock); in binder_set_txn_from_error()
2984 binder_inner_proc_unlock(from->proc); in binder_set_txn_from_error()
2995 static void binder_netlink_report(struct binder_proc *proc, in binder_netlink_report() argument
3000 const char *context = proc->context->name; in binder_netlink_report()
3051 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
3075 struct binder_context *context = proc->context; in binder_transaction()
3089 e->from_proc = proc->pid; in binder_transaction()
3094 strscpy(e->context_name, proc->context->name, BINDERFS_MAX_NAME); in binder_transaction()
3096 binder_inner_proc_lock(proc); in binder_transaction()
3098 binder_inner_proc_unlock(proc); in binder_transaction()
3103 thread->pid, proc->pid); in binder_transaction()
3114 t->from_pid = proc->pid; in binder_transaction()
3116 t->sender_euid = task_euid(proc->tsk); in binder_transaction()
3127 binder_inner_proc_lock(proc); in binder_transaction()
3130 binder_inner_proc_unlock(proc); in binder_transaction()
3132 proc->pid, thread->pid); in binder_transaction()
3141 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3147 binder_inner_proc_unlock(proc); in binder_transaction()
3155 binder_inner_proc_unlock(proc); in binder_transaction()
3160 __release(&target_thread->proc->inner_lock); in binder_transaction()
3162 thread->pid, proc->pid); in binder_transaction()
3169 proc->pid, thread->pid, in binder_transaction()
3173 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3181 target_proc = target_thread->proc; in binder_transaction()
3183 binder_inner_proc_unlock(target_thread->proc); in binder_transaction()
3195 binder_proc_lock(proc); in binder_transaction()
3196 ref = binder_get_ref_olocked(proc, tr->target.handle, in binder_transaction()
3204 proc->pid, thread->pid, tr->target.handle); in binder_transaction()
3207 binder_proc_unlock(proc); in binder_transaction()
3218 if (target_node && target_proc->pid == proc->pid) { in binder_transaction()
3220 proc->pid, thread->pid); in binder_transaction()
3229 proc->pid, thread->pid); in binder_transaction()
3236 if (WARN_ON(proc == target_proc)) { in binder_transaction()
3238 thread->pid, proc->pid); in binder_transaction()
3244 if (security_binder_transaction(proc->cred, in binder_transaction()
3247 thread->pid, proc->pid); in binder_transaction()
3253 binder_inner_proc_lock(proc); in binder_transaction()
3269 proc->pid, thread->pid); in binder_transaction()
3270 binder_inner_proc_unlock(proc); in binder_transaction()
3284 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3289 binder_inner_proc_unlock(proc); in binder_transaction()
3300 if (from && from->proc == target_proc) { in binder_transaction()
3310 binder_inner_proc_unlock(proc); in binder_transaction()
3322 thread->pid, proc->pid); in binder_transaction()
3333 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3340 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3349 security_cred_getsecid(proc->cred, &secid); in binder_transaction()
3353 thread->pid, proc->pid); in binder_transaction()
3363 thread->pid, proc->pid); in binder_transaction()
3425 proc->pid, thread->pid); in binder_transaction()
3433 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3441 proc->pid, thread->pid, in binder_transaction()
3469 thread->pid, proc->pid); in binder_transaction()
3489 proc->pid, thread->pid); in binder_transaction()
3499 proc->pid, thread->pid, in binder_transaction()
3530 thread->pid, proc->pid); in binder_transaction()
3549 thread->pid, proc->pid); in binder_transaction()
3571 thread->pid, proc->pid); in binder_transaction()
3595 proc->pid, thread->pid); in binder_transaction()
3608 proc->pid, thread->pid); in binder_transaction()
3619 binder_get_object(proc, user_buffer, t->buffer, in binder_transaction()
3623 proc->pid, thread->pid, in binder_transaction()
3642 thread->pid, proc->pid); in binder_transaction()
3660 proc->pid, thread->pid); in binder_transaction()
3671 thread->pid, proc->pid); in binder_transaction()
3695 thread->pid, proc->pid); in binder_transaction()
3706 proc->pid, thread->pid, hdr->type); in binder_transaction()
3720 proc->pid, thread->pid); in binder_transaction()
3731 proc->pid, thread->pid); in binder_transaction()
3739 binder_netlink_report(proc, t, tr->data_size, in binder_transaction()
3762 binder_inner_proc_lock(proc); in binder_transaction()
3773 binder_inner_proc_unlock(proc); in binder_transaction()
3777 binder_inner_proc_lock(proc); in binder_transaction()
3779 binder_inner_proc_unlock(proc); in binder_transaction()
3793 binder_netlink_report(proc, t, tr->data_size, in binder_transaction()
3816 thread->pid, proc->pid); in binder_transaction()
3818 binder_dequeue_work(proc, tcomplete); in binder_transaction()
3854 binder_netlink_report(proc, t, tr->data_size, return_error); in binder_transaction()
3861 proc->pid, thread->pid, reply ? "reply" : in binder_transaction()
3899 binder_inner_proc_lock(proc); in binder_transaction()
3902 binder_inner_proc_unlock(proc); in binder_transaction()
3909 binder_request_freeze_notification(struct binder_proc *proc, in binder_request_freeze_notification() argument
3919 binder_proc_lock(proc); in binder_request_freeze_notification()
3920 ref = binder_get_ref_olocked(proc, handle_cookie->handle, false); in binder_request_freeze_notification()
3923 proc->pid, thread->pid, handle_cookie->handle); in binder_request_freeze_notification()
3924 binder_proc_unlock(proc); in binder_request_freeze_notification()
3932 proc->pid, thread->pid); in binder_request_freeze_notification()
3934 binder_proc_unlock(proc); in binder_request_freeze_notification()
3945 if (ref->node->proc) { in binder_request_freeze_notification()
3946 binder_inner_proc_lock(ref->node->proc); in binder_request_freeze_notification()
3947 freeze->is_frozen = ref->node->proc->is_frozen; in binder_request_freeze_notification()
3948 binder_inner_proc_unlock(ref->node->proc); in binder_request_freeze_notification()
3950 binder_inner_proc_lock(proc); in binder_request_freeze_notification()
3951 binder_enqueue_work_ilocked(&freeze->work, &proc->todo); in binder_request_freeze_notification()
3952 binder_wakeup_proc_ilocked(proc); in binder_request_freeze_notification()
3953 binder_inner_proc_unlock(proc); in binder_request_freeze_notification()
3957 binder_proc_unlock(proc); in binder_request_freeze_notification()
3962 binder_clear_freeze_notification(struct binder_proc *proc, in binder_clear_freeze_notification() argument
3969 binder_proc_lock(proc); in binder_clear_freeze_notification()
3970 ref = binder_get_ref_olocked(proc, handle_cookie->handle, false); in binder_clear_freeze_notification()
3973 proc->pid, thread->pid, handle_cookie->handle); in binder_clear_freeze_notification()
3974 binder_proc_unlock(proc); in binder_clear_freeze_notification()
3982 proc->pid, thread->pid); in binder_clear_freeze_notification()
3984 binder_proc_unlock(proc); in binder_clear_freeze_notification()
3988 binder_inner_proc_lock(proc); in binder_clear_freeze_notification()
3991 proc->pid, thread->pid, (u64)freeze->cookie, in binder_clear_freeze_notification()
3993 binder_inner_proc_unlock(proc); in binder_clear_freeze_notification()
3995 binder_proc_unlock(proc); in binder_clear_freeze_notification()
4009 binder_enqueue_work_ilocked(&freeze->work, &proc->todo); in binder_clear_freeze_notification()
4010 binder_wakeup_proc_ilocked(proc); in binder_clear_freeze_notification()
4014 binder_inner_proc_unlock(proc); in binder_clear_freeze_notification()
4016 binder_proc_unlock(proc); in binder_clear_freeze_notification()
4021 binder_freeze_notification_done(struct binder_proc *proc, in binder_freeze_notification_done() argument
4028 binder_inner_proc_lock(proc); in binder_freeze_notification_done()
4029 list_for_each_entry(w, &proc->delivered_freeze, entry) { in binder_freeze_notification_done()
4040 proc->pid, thread->pid, (u64)cookie); in binder_freeze_notification_done()
4041 binder_inner_proc_unlock(proc); in binder_freeze_notification_done()
4048 binder_enqueue_work_ilocked(&freeze->work, &proc->todo); in binder_freeze_notification_done()
4049 binder_wakeup_proc_ilocked(proc); in binder_freeze_notification_done()
4051 binder_inner_proc_unlock(proc); in binder_freeze_notification_done()
4068 binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
4072 binder_inner_proc_lock(proc); in binder_free_buf()
4077 binder_inner_proc_unlock(proc); in binder_free_buf()
4085 BUG_ON(buf_node->proc != proc); in binder_free_buf()
4092 w, &proc->todo); in binder_free_buf()
4093 binder_wakeup_proc_ilocked(proc); in binder_free_buf()
4098 binder_release_entire_buffer(proc, thread, buffer, is_failure); in binder_free_buf()
4099 binder_alloc_free_buf(&proc->alloc, buffer); in binder_free_buf()
4102 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
4108 struct binder_context *context = proc->context; in binder_thread_write()
4122 atomic_inc(&proc->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
4147 if (ctx_mgr_node->proc == proc) { in binder_thread_write()
4149 proc->pid, thread->pid); in binder_thread_write()
4154 proc, ctx_mgr_node, in binder_thread_write()
4161 proc, target, increment, strong, in binder_thread_write()
4165 proc->pid, thread->pid, in binder_thread_write()
4185 proc->pid, thread->pid, debug_string, in binder_thread_write()
4191 proc->pid, thread->pid, debug_string, in binder_thread_write()
4209 node = binder_get_node(proc, node_ptr); in binder_thread_write()
4212 proc->pid, thread->pid, in binder_thread_write()
4221 proc->pid, thread->pid, in binder_thread_write()
4233 proc->pid, thread->pid, in binder_thread_write()
4243 proc->pid, thread->pid, in binder_thread_write()
4256 proc->pid, thread->pid, in binder_thread_write()
4279 buffer = binder_alloc_prepare_to_free(&proc->alloc, in binder_thread_write()
4285 proc->pid, thread->pid, in binder_thread_write()
4286 (unsigned long)data_ptr - proc->alloc.vm_start); in binder_thread_write()
4290 proc->pid, thread->pid, in binder_thread_write()
4291 (unsigned long)data_ptr - proc->alloc.vm_start); in binder_thread_write()
4297 proc->pid, thread->pid, in binder_thread_write()
4298 (unsigned long)data_ptr - proc->alloc.vm_start, in binder_thread_write()
4301 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4312 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4323 binder_transaction(proc, thread, &tr, in binder_thread_write()
4331 proc->pid, thread->pid); in binder_thread_write()
4332 binder_inner_proc_lock(proc); in binder_thread_write()
4336 proc->pid, thread->pid); in binder_thread_write()
4337 } else if (proc->requested_threads == 0) { in binder_thread_write()
4340 proc->pid, thread->pid); in binder_thread_write()
4342 proc->requested_threads--; in binder_thread_write()
4343 proc->requested_threads_started++; in binder_thread_write()
4346 binder_inner_proc_unlock(proc); in binder_thread_write()
4351 proc->pid, thread->pid); in binder_thread_write()
4355 proc->pid, thread->pid); in binder_thread_write()
4362 proc->pid, thread->pid); in binder_thread_write()
4395 proc->pid, thread->pid); in binder_thread_write()
4399 binder_proc_lock(proc); in binder_thread_write()
4400 ref = binder_get_ref_olocked(proc, target, false); in binder_thread_write()
4403 proc->pid, thread->pid, in binder_thread_write()
4408 binder_proc_unlock(proc); in binder_thread_write()
4415 proc->pid, thread->pid, in binder_thread_write()
4427 proc->pid, thread->pid); in binder_thread_write()
4429 binder_proc_unlock(proc); in binder_thread_write()
4437 if (ref->node->proc == NULL) { in binder_thread_write()
4440 binder_inner_proc_lock(proc); in binder_thread_write()
4442 &ref->death->work, &proc->todo); in binder_thread_write()
4443 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4444 binder_inner_proc_unlock(proc); in binder_thread_write()
4449 proc->pid, thread->pid); in binder_thread_write()
4451 binder_proc_unlock(proc); in binder_thread_write()
4457 proc->pid, thread->pid, in binder_thread_write()
4461 binder_proc_unlock(proc); in binder_thread_write()
4465 binder_inner_proc_lock(proc); in binder_thread_write()
4477 &proc->todo); in binder_thread_write()
4479 proc); in binder_thread_write()
4485 binder_inner_proc_unlock(proc); in binder_thread_write()
4488 binder_proc_unlock(proc); in binder_thread_write()
4499 binder_inner_proc_lock(proc); in binder_thread_write()
4500 list_for_each_entry(w, &proc->delivered_death, in binder_thread_write()
4514 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4518 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4519 binder_inner_proc_unlock(proc); in binder_thread_write()
4533 &proc->todo); in binder_thread_write()
4534 binder_wakeup_proc_ilocked(proc); in binder_thread_write()
4537 binder_inner_proc_unlock(proc); in binder_thread_write()
4547 error = binder_request_freeze_notification(proc, thread, in binder_thread_write()
4560 error = binder_clear_freeze_notification(proc, thread, &handle_cookie); in binder_thread_write()
4573 error = binder_freeze_notification_done(proc, thread, cookie); in binder_thread_write()
4580 proc->pid, thread->pid, cmd); in binder_thread_write()
4588 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
4594 atomic_inc(&proc->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4599 static int binder_put_node_cmd(struct binder_proc *proc, in binder_put_node_cmd() argument
4621 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4623 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4634 struct binder_proc *proc = thread->proc; in binder_wait_for_work() local
4637 binder_inner_proc_lock(proc); in binder_wait_for_work()
4644 &proc->waiting_threads); in binder_wait_for_work()
4645 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4647 binder_inner_proc_lock(proc); in binder_wait_for_work()
4655 binder_inner_proc_unlock(proc); in binder_wait_for_work()
4675 static int binder_apply_fd_fixups(struct binder_proc *proc, in binder_apply_fd_fixups() argument
4696 if (binder_alloc_copy_to_buffer(&proc->alloc, t->buffer, in binder_apply_fd_fixups()
4716 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
4735 binder_inner_proc_lock(proc); in binder_thread_read()
4737 binder_inner_proc_unlock(proc); in binder_thread_read()
4743 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4748 proc->pid, thread->pid, thread->looper); in binder_thread_read()
4752 binder_set_nice(proc->default_priority); in binder_thread_read()
4777 binder_inner_proc_lock(proc); in binder_thread_read()
4780 else if (!binder_worklist_empty_ilocked(&proc->todo) && in binder_thread_read()
4782 list = &proc->todo; in binder_thread_read()
4784 binder_inner_proc_unlock(proc); in binder_thread_read()
4793 binder_inner_proc_unlock(proc); in binder_thread_read()
4802 binder_inner_proc_unlock(proc); in binder_thread_read()
4810 binder_inner_proc_unlock(proc); in binder_thread_read()
4817 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4822 if (proc->oneway_spam_detection_enabled && in binder_thread_read()
4829 binder_inner_proc_unlock(proc); in binder_thread_read()
4836 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4839 proc->pid, thread->pid); in binder_thread_read()
4851 BUG_ON(proc != node->proc); in binder_thread_read()
4877 proc->pid, thread->pid, in binder_thread_read()
4881 rb_erase(&node->rb_node, &proc->nodes); in binder_thread_read()
4882 binder_inner_proc_unlock(proc); in binder_thread_read()
4896 binder_inner_proc_unlock(proc); in binder_thread_read()
4900 proc, thread, &ptr, node_ptr, in binder_thread_read()
4905 proc, thread, &ptr, node_ptr, in binder_thread_read()
4910 proc, thread, &ptr, node_ptr, in binder_thread_read()
4915 proc, thread, &ptr, node_ptr, in binder_thread_read()
4921 proc->pid, thread->pid, in binder_thread_read()
4944 proc->pid, thread->pid, in binder_thread_read()
4950 binder_inner_proc_unlock(proc); in binder_thread_read()
4955 w, &proc->delivered_death); in binder_thread_read()
4956 binder_inner_proc_unlock(proc); in binder_thread_read()
4965 binder_stat_br(proc, thread, cmd); in binder_thread_read()
4979 binder_enqueue_work_ilocked(w, &proc->delivered_freeze); in binder_thread_read()
4980 binder_inner_proc_unlock(proc); in binder_thread_read()
4988 binder_stat_br(proc, thread, BR_FROZEN_BINDER); in binder_thread_read()
4997 binder_inner_proc_unlock(proc); in binder_thread_read()
5006 binder_stat_br(proc, thread, BR_CLEAR_FREEZE_NOTIFICATION_DONE); in binder_thread_read()
5010 binder_inner_proc_unlock(proc); in binder_thread_read()
5012 proc->pid, thread->pid, w->type); in binder_thread_read()
5044 struct task_struct *sender = t_from->proc->tsk; in binder_thread_read()
5053 ret = binder_apply_fd_fixups(proc, t); in binder_thread_read()
5064 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
5067 proc->pid, thread->pid, in binder_thread_read()
5076 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5115 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5118 proc->pid, thread->pid, in binder_thread_read()
5122 t->debug_id, t_from ? t_from->proc->pid : 0, in binder_thread_read()
5130 binder_inner_proc_lock(thread->proc); in binder_thread_read()
5134 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
5144 binder_inner_proc_lock(proc); in binder_thread_read()
5145 if (proc->requested_threads == 0 && in binder_thread_read()
5146 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
5147 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
5151 proc->requested_threads++; in binder_thread_read()
5152 binder_inner_proc_unlock(proc); in binder_thread_read()
5155 proc->pid, thread->pid); in binder_thread_read()
5158 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
5160 binder_inner_proc_unlock(proc); in binder_thread_read()
5164 static void binder_release_work(struct binder_proc *proc, in binder_release_work() argument
5171 binder_inner_proc_lock(proc); in binder_release_work()
5174 binder_inner_proc_unlock(proc); in binder_release_work()
5236 struct binder_proc *proc, struct binder_thread *new_thread) in binder_get_thread_ilocked() argument
5240 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread_ilocked()
5257 thread->proc = proc; in binder_get_thread_ilocked()
5263 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
5274 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
5279 binder_inner_proc_lock(proc); in binder_get_thread()
5280 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
5281 binder_inner_proc_unlock(proc); in binder_get_thread()
5286 binder_inner_proc_lock(proc); in binder_get_thread()
5287 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
5288 binder_inner_proc_unlock(proc); in binder_get_thread()
5295 static void binder_free_proc(struct binder_proc *proc) in binder_free_proc() argument
5299 BUG_ON(!list_empty(&proc->todo)); in binder_free_proc()
5300 BUG_ON(!list_empty(&proc->delivered_death)); in binder_free_proc()
5301 if (proc->outstanding_txns) in binder_free_proc()
5303 __func__, proc->outstanding_txns); in binder_free_proc()
5304 device = container_of(proc->context, struct binder_device, context); in binder_free_proc()
5307 kfree(proc->context->name); in binder_free_proc()
5310 binder_alloc_deferred_release(&proc->alloc); in binder_free_proc()
5311 put_task_struct(proc->tsk); in binder_free_proc()
5312 put_cred(proc->cred); in binder_free_proc()
5314 dbitmap_free(&proc->dmap); in binder_free_proc()
5315 kfree(proc); in binder_free_proc()
5322 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5326 static int binder_thread_release(struct binder_proc *proc, in binder_thread_release() argument
5334 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5341 proc->tmp_ref++; in binder_thread_release()
5347 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5363 proc->pid, thread->pid, in binder_thread_release()
5368 thread->proc->outstanding_txns--; in binder_thread_release()
5397 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5411 binder_release_work(proc, &thread->todo); in binder_thread_release()
5419 struct binder_proc *proc = filp->private_data; in binder_poll() local
5423 thread = binder_get_thread(proc); in binder_poll()
5427 binder_inner_proc_lock(thread->proc); in binder_poll()
5431 binder_inner_proc_unlock(thread->proc); in binder_poll()
5445 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
5454 proc->pid, thread->pid, in binder_ioctl_write_read()
5459 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5470 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5475 binder_inner_proc_lock(proc); in binder_ioctl_write_read()
5476 if (!binder_worklist_empty_ilocked(&proc->todo)) in binder_ioctl_write_read()
5477 binder_wakeup_proc_ilocked(proc); in binder_ioctl_write_read()
5478 binder_inner_proc_unlock(proc); in binder_ioctl_write_read()
5484 proc->pid, thread->pid, in binder_ioctl_write_read()
5497 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
5498 struct binder_context *context = proc->context; in binder_ioctl_set_ctx_mgr()
5507 ret = security_binder_set_context_mgr(proc->cred); in binder_ioctl_set_ctx_mgr()
5521 new_node = binder_new_node(proc, fbo); in binder_ioctl_set_ctx_mgr()
5535 static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, in binder_ioctl_get_node_info_for_ref() argument
5539 struct binder_context *context = proc->context; in binder_ioctl_get_node_info_for_ref()
5545 proc->pid); in binder_ioctl_get_node_info_for_ref()
5552 context->binder_context_mgr_node->proc != proc) { in binder_ioctl_get_node_info_for_ref()
5558 node = binder_get_node_from_ref(proc, handle, true, NULL); in binder_ioctl_get_node_info_for_ref()
5571 static int binder_ioctl_get_node_debug_info(struct binder_proc *proc, in binder_ioctl_get_node_debug_info() argument
5579 binder_inner_proc_lock(proc); in binder_ioctl_get_node_debug_info()
5580 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in binder_ioctl_get_node_debug_info()
5591 binder_inner_proc_unlock(proc); in binder_ioctl_get_node_debug_info()
5596 static bool binder_txns_pending_ilocked(struct binder_proc *proc) in binder_txns_pending_ilocked() argument
5601 if (proc->outstanding_txns > 0) in binder_txns_pending_ilocked()
5604 for (n = rb_first(&proc->threads); n; n = rb_next(n)) { in binder_txns_pending_ilocked()
5612 static void binder_add_freeze_work(struct binder_proc *proc, bool is_frozen) in binder_add_freeze_work() argument
5618 binder_inner_proc_lock(proc); in binder_add_freeze_work()
5619 for (n = rb_first(&proc->nodes); n; n = rb_next(n)) { in binder_add_freeze_work()
5624 binder_inner_proc_unlock(proc); in binder_add_freeze_work()
5635 binder_inner_proc_lock(ref->proc); in binder_add_freeze_work()
5637 binder_inner_proc_unlock(ref->proc); in binder_add_freeze_work()
5643 binder_enqueue_work_ilocked(&ref->freeze->work, &ref->proc->todo); in binder_add_freeze_work()
5644 binder_wakeup_proc_ilocked(ref->proc); in binder_add_freeze_work()
5650 binder_inner_proc_unlock(ref->proc); in binder_add_freeze_work()
5654 binder_inner_proc_lock(proc); in binder_add_freeze_work()
5655 if (proc->is_dead) in binder_add_freeze_work()
5658 binder_inner_proc_unlock(proc); in binder_add_freeze_work()
5749 binder_inner_proc_lock(thread->proc); in binder_ioctl_get_extended_error()
5752 binder_inner_proc_unlock(thread->proc); in binder_ioctl_get_extended_error()
5763 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
5773 thread = binder_get_thread(proc); in binder_ioctl()
5793 binder_inner_proc_lock(proc); in binder_ioctl()
5794 proc->max_threads = max_threads; in binder_ioctl()
5795 binder_inner_proc_unlock(proc); in binder_ioctl()
5817 proc->pid, thread->pid); in binder_ioctl()
5818 binder_thread_release(proc, thread); in binder_ioctl()
5839 ret = binder_ioctl_get_node_info_for_ref(proc, &info); in binder_ioctl()
5858 ret = binder_ioctl_get_node_debug_info(proc, &info); in binder_ioctl()
5953 binder_inner_proc_lock(proc); in binder_ioctl()
5954 proc->oneway_spam_detection_enabled = (bool)enable; in binder_ioctl()
5955 binder_inner_proc_unlock(proc); in binder_ioctl()
5973 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
5981 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
5985 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
5992 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
5996 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
5999 binder_alloc_vma_close(&proc->alloc); in binder_vma_close()
6016 struct binder_proc *proc = filp->private_data; in binder_mmap() local
6018 if (proc->tsk != current->group_leader) in binder_mmap()
6023 __func__, proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
6029 proc->pid, vma->vm_start, vma->vm_end, "bad vm_flags", -EPERM); in binder_mmap()
6035 vma->vm_private_data = proc; in binder_mmap()
6037 return binder_alloc_mmap_handler(&proc->alloc, vma); in binder_mmap()
6042 struct binder_proc *proc, *itr; in binder_open() local
6051 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
6052 if (proc == NULL) in binder_open()
6055 dbitmap_init(&proc->dmap); in binder_open()
6056 spin_lock_init(&proc->inner_lock); in binder_open()
6057 spin_lock_init(&proc->outer_lock); in binder_open()
6059 proc->tsk = current->group_leader; in binder_open()
6060 proc->cred = get_cred(filp->f_cred); in binder_open()
6061 INIT_LIST_HEAD(&proc->todo); in binder_open()
6062 init_waitqueue_head(&proc->freeze_wait); in binder_open()
6063 proc->default_priority = task_nice(current); in binder_open()
6074 proc->context = &binder_dev->context; in binder_open()
6075 binder_alloc_init(&proc->alloc); in binder_open()
6078 proc->pid = current->group_leader->pid; in binder_open()
6079 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
6080 INIT_LIST_HEAD(&proc->delivered_freeze); in binder_open()
6081 INIT_LIST_HEAD(&proc->waiting_threads); in binder_open()
6082 filp->private_data = proc; in binder_open()
6086 if (itr->pid == proc->pid) { in binder_open()
6091 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
6097 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
6104 proc->debugfs_entry = debugfs_create_file(strbuf, 0444, in binder_open()
6106 (void *)(unsigned long)proc->pid, in binder_open()
6114 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
6122 strbuf, &proc_fops, (void *)(unsigned long)proc->pid); in binder_open()
6124 proc->binderfs_entry = binderfs_entry; in binder_open()
6139 struct binder_proc *proc = filp->private_data; in binder_flush() local
6141 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
6146 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
6151 binder_inner_proc_lock(proc); in binder_deferred_flush()
6152 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
6161 binder_inner_proc_unlock(proc); in binder_deferred_flush()
6164 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
6170 struct binder_proc *proc = filp->private_data; in binder_release() local
6172 debugfs_remove(proc->debugfs_entry); in binder_release()
6174 if (proc->binderfs_entry) { in binder_release()
6175 simple_recursive_removal(proc->binderfs_entry, NULL); in binder_release()
6176 proc->binderfs_entry = NULL; in binder_release()
6179 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
6188 struct binder_proc *proc = node->proc; in binder_node_release() local
6190 binder_release_work(proc, &node->async_todo); in binder_node_release()
6193 binder_inner_proc_lock(proc); in binder_node_release()
6200 binder_inner_proc_unlock(proc); in binder_node_release()
6207 node->proc = NULL; in binder_node_release()
6210 binder_inner_proc_unlock(proc); in binder_node_release()
6224 binder_inner_proc_lock(ref->proc); in binder_node_release()
6226 binder_inner_proc_unlock(ref->proc); in binder_node_release()
6235 &ref->proc->todo); in binder_node_release()
6236 binder_wakeup_proc_ilocked(ref->proc); in binder_node_release()
6237 binder_inner_proc_unlock(ref->proc); in binder_node_release()
6249 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
6251 struct binder_context *context = proc->context; in binder_deferred_release()
6256 hlist_del(&proc->proc_node); in binder_deferred_release()
6261 context->binder_context_mgr_node->proc == proc) { in binder_deferred_release()
6264 __func__, proc->pid); in binder_deferred_release()
6268 binder_inner_proc_lock(proc); in binder_deferred_release()
6273 proc->tmp_ref++; in binder_deferred_release()
6275 proc->is_dead = true; in binder_deferred_release()
6276 proc->is_frozen = false; in binder_deferred_release()
6277 proc->sync_recv = false; in binder_deferred_release()
6278 proc->async_recv = false; in binder_deferred_release()
6281 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
6285 binder_inner_proc_unlock(proc); in binder_deferred_release()
6287 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
6288 binder_inner_proc_lock(proc); in binder_deferred_release()
6293 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
6304 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
6305 binder_inner_proc_unlock(proc); in binder_deferred_release()
6307 binder_inner_proc_lock(proc); in binder_deferred_release()
6309 binder_inner_proc_unlock(proc); in binder_deferred_release()
6312 binder_proc_lock(proc); in binder_deferred_release()
6313 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
6319 binder_proc_unlock(proc); in binder_deferred_release()
6321 binder_proc_lock(proc); in binder_deferred_release()
6323 binder_proc_unlock(proc); in binder_deferred_release()
6325 binder_release_work(proc, &proc->todo); in binder_deferred_release()
6326 binder_release_work(proc, &proc->delivered_death); in binder_deferred_release()
6327 binder_release_work(proc, &proc->delivered_freeze); in binder_deferred_release()
6331 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
6334 binder_proc_dec_tmpref(proc); in binder_deferred_release()
6339 struct binder_proc *proc; in binder_deferred_func() local
6346 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
6348 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
6349 defer = proc->deferred_work; in binder_deferred_func()
6350 proc->deferred_work = 0; in binder_deferred_func()
6352 proc = NULL; in binder_deferred_func()
6358 binder_deferred_flush(proc); in binder_deferred_func()
6361 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
6362 } while (proc); in binder_deferred_func()
6367 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
6370 proc->deferred_work |= defer; in binder_defer_work()
6371 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
6372 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
6379 struct binder_proc *proc, in print_binder_transaction_ilocked() argument
6400 if (proc != to_proc) { in print_binder_transaction_ilocked()
6417 buffer->user_data - proc->alloc.vm_start); in print_binder_transaction_ilocked()
6421 struct binder_proc *proc, in print_binder_work_ilocked() argument
6433 m, proc, transaction_prefix, t); in print_binder_work_ilocked()
6495 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6499 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6503 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6509 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
6540 seq_printf(m, " %d", ref->proc->pid); in print_binder_node_nilocked()
6543 if (node->proc) { in print_binder_node_nilocked()
6545 print_binder_work_ilocked(m, node->proc, " ", in print_binder_node_nilocked()
6557 ref->node->proc ? "" : "dead ", in print_binder_ref_olocked()
6580 print_next_binder_node_ilocked(struct seq_file *m, struct binder_proc *proc, in print_next_binder_node_ilocked() argument
6593 if (proc) in print_next_binder_node_ilocked()
6594 binder_inner_proc_unlock(proc); in print_next_binder_node_ilocked()
6602 if (proc) in print_next_binder_node_ilocked()
6603 binder_inner_proc_lock(proc); in print_next_binder_node_ilocked()
6609 static void print_binder_proc(struct seq_file *m, struct binder_proc *proc, in print_binder_proc() argument
6618 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
6619 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc()
6622 binder_inner_proc_lock(proc); in print_binder_proc()
6623 for (n = rb_first(&proc->threads); n; n = rb_next(n)) in print_binder_proc()
6627 for (n = rb_first(&proc->nodes); n; n = rb_next(n)) { in print_binder_proc()
6633 last_node = print_next_binder_node_ilocked(m, proc, node, in print_binder_proc()
6637 binder_inner_proc_unlock(proc); in print_binder_proc()
6642 binder_proc_lock(proc); in print_binder_proc()
6643 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) in print_binder_proc()
6647 binder_proc_unlock(proc); in print_binder_proc()
6649 binder_alloc_print_allocated(m, &proc->alloc); in print_binder_proc()
6650 binder_inner_proc_lock(proc); in print_binder_proc()
6651 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
6652 print_binder_work_ilocked(m, proc, " ", in print_binder_proc()
6655 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
6659 list_for_each_entry(w, &proc->delivered_freeze, entry) { in print_binder_proc()
6663 binder_inner_proc_unlock(proc); in print_binder_proc()
6773 struct binder_proc *proc) in print_binder_proc_stats() argument
6780 binder_alloc_get_free_async_space(&proc->alloc); in print_binder_proc_stats()
6782 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
6783 seq_printf(m, "context %s\n", proc->context->name); in print_binder_proc_stats()
6786 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6787 for (n = rb_first(&proc->threads); n; n = rb_next(n)) in print_binder_proc_stats()
6790 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()
6796 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
6797 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
6801 for (n = rb_first(&proc->nodes); n; n = rb_next(n)) in print_binder_proc_stats()
6803 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6808 binder_proc_lock(proc); in print_binder_proc_stats()
6809 for (n = rb_first(&proc->refs_by_desc); n; n = rb_next(n)) { in print_binder_proc_stats()
6816 binder_proc_unlock(proc); in print_binder_proc_stats()
6819 count = binder_alloc_get_allocated_count(&proc->alloc); in print_binder_proc_stats()
6822 binder_alloc_print_pages(m, &proc->alloc); in print_binder_proc_stats()
6825 binder_inner_proc_lock(proc); in print_binder_proc_stats()
6826 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
6830 binder_inner_proc_unlock(proc); in print_binder_proc_stats()
6833 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
6838 struct binder_proc *proc; in print_binder_state() local
6856 hlist_for_each_entry(proc, &binder_procs, proc_node) in print_binder_state()
6857 print_binder_proc(m, proc, true, hash_ptrs); in print_binder_state()
6863 struct binder_proc *proc; in print_binder_transactions() local
6867 hlist_for_each_entry(proc, &binder_procs, proc_node) in print_binder_transactions()
6868 print_binder_proc(m, proc, false, hash_ptrs); in print_binder_transactions()
6886 struct binder_proc *proc; in stats_show() local
6893 hlist_for_each_entry(proc, &binder_procs, proc_node) in stats_show()
6894 print_binder_proc_stats(m, proc); in stats_show()