• Home
  • Raw
  • Download

Lines Matching refs:thread

464 binder_enqueue_deferred_thread_work_ilocked(struct binder_thread *thread,  in binder_enqueue_deferred_thread_work_ilocked()  argument
467 WARN_ON(!list_empty(&thread->waiting_thread_node)); in binder_enqueue_deferred_thread_work_ilocked()
468 binder_enqueue_work_ilocked(work, &thread->todo); in binder_enqueue_deferred_thread_work_ilocked()
482 binder_enqueue_thread_work_ilocked(struct binder_thread *thread, in binder_enqueue_thread_work_ilocked() argument
485 WARN_ON(!list_empty(&thread->waiting_thread_node)); in binder_enqueue_thread_work_ilocked()
486 binder_enqueue_work_ilocked(work, &thread->todo); in binder_enqueue_thread_work_ilocked()
493 if (thread->looper & BINDER_LOOPER_STATE_POLL && in binder_enqueue_thread_work_ilocked()
494 thread->pid == current->pid && !thread->process_todo) in binder_enqueue_thread_work_ilocked()
495 wake_up_interruptible_sync(&thread->wait); in binder_enqueue_thread_work_ilocked()
497 thread->process_todo = true; in binder_enqueue_thread_work_ilocked()
509 binder_enqueue_thread_work(struct binder_thread *thread, in binder_enqueue_thread_work() argument
512 binder_inner_proc_lock(thread->proc); in binder_enqueue_thread_work()
513 binder_enqueue_thread_work_ilocked(thread, work); in binder_enqueue_thread_work()
514 binder_inner_proc_unlock(thread->proc); in binder_enqueue_thread_work()
552 static void binder_free_thread(struct binder_thread *thread);
556 static bool binder_has_work_ilocked(struct binder_thread *thread, in binder_has_work_ilocked() argument
559 bool has_work = thread->process_todo || in binder_has_work_ilocked()
560 thread->looper_need_return || in binder_has_work_ilocked()
562 !binder_worklist_empty_ilocked(&thread->proc->todo)); in binder_has_work_ilocked()
563 trace_android_vh_binder_has_special_work_ilocked(thread, do_proc_work, &has_work); in binder_has_work_ilocked()
567 static bool binder_has_work(struct binder_thread *thread, bool do_proc_work) in binder_has_work() argument
571 binder_inner_proc_lock(thread->proc); in binder_has_work()
572 has_work = binder_has_work_ilocked(thread, do_proc_work); in binder_has_work()
573 binder_inner_proc_unlock(thread->proc); in binder_has_work()
578 static bool binder_available_for_proc_work_ilocked(struct binder_thread *thread) in binder_available_for_proc_work_ilocked() argument
580 return !thread->transaction_stack && in binder_available_for_proc_work_ilocked()
581 binder_worklist_empty_ilocked(&thread->todo); in binder_available_for_proc_work_ilocked()
588 struct binder_thread *thread; in binder_wakeup_poll_threads_ilocked() local
591 thread = rb_entry(n, struct binder_thread, rb_node); in binder_wakeup_poll_threads_ilocked()
592 if (thread->looper & BINDER_LOOPER_STATE_POLL && in binder_wakeup_poll_threads_ilocked()
593 binder_available_for_proc_work_ilocked(thread)) { in binder_wakeup_poll_threads_ilocked()
595 wake_up_interruptible_sync(&thread->wait); in binder_wakeup_poll_threads_ilocked()
597 wake_up_interruptible(&thread->wait); in binder_wakeup_poll_threads_ilocked()
617 struct binder_thread *thread; in binder_select_thread_ilocked() local
620 thread = list_first_entry_or_null(&proc->waiting_threads, in binder_select_thread_ilocked()
624 if (thread) in binder_select_thread_ilocked()
625 list_del_init(&thread->waiting_thread_node); in binder_select_thread_ilocked()
627 return thread; in binder_select_thread_ilocked()
647 struct binder_thread *thread, in binder_wakeup_thread_ilocked() argument
652 if (thread) { in binder_wakeup_thread_ilocked()
654 wake_up_interruptible_sync(&thread->wait); in binder_wakeup_thread_ilocked()
656 wake_up_interruptible(&thread->wait); in binder_wakeup_thread_ilocked()
678 struct binder_thread *thread = binder_select_thread_ilocked(proc); in binder_wakeup_proc_ilocked() local
680 binder_wakeup_thread_ilocked(proc, thread, /* sync = */false); in binder_wakeup_proc_ilocked()
714 static void binder_do_set_priority(struct binder_thread *thread, in binder_do_set_priority() argument
718 struct task_struct *task = thread->task; in binder_do_set_priority()
724 spin_lock(&thread->prio_lock); in binder_do_set_priority()
725 if (thread->prio_state == BINDER_PRIO_PENDING) in binder_do_set_priority()
726 thread->prio_state = BINDER_PRIO_SET; in binder_do_set_priority()
727 spin_unlock(&thread->prio_lock); in binder_do_set_priority()
769 spin_lock(&thread->prio_lock); in binder_do_set_priority()
770 if (!verify && thread->prio_state == BINDER_PRIO_ABORT) { in binder_do_set_priority()
776 spin_unlock(&thread->prio_lock); in binder_do_set_priority()
779 thread->pid, __func__); in binder_do_set_priority()
796 thread->prio_state = BINDER_PRIO_SET; in binder_do_set_priority()
797 spin_unlock(&thread->prio_lock); in binder_do_set_priority()
800 static void binder_set_priority(struct binder_thread *thread, in binder_set_priority() argument
803 binder_do_set_priority(thread, desired, /* verify = */ true); in binder_set_priority()
806 static void binder_restore_priority(struct binder_thread *thread, in binder_restore_priority() argument
809 binder_do_set_priority(thread, desired, /* verify = */ false); in binder_restore_priority()
812 static void binder_transaction_priority(struct binder_thread *thread, in binder_transaction_priority() argument
816 struct task_struct *task = thread->task; in binder_transaction_priority()
846 spin_lock(&thread->prio_lock); in binder_transaction_priority()
847 if (thread->prio_state == BINDER_PRIO_PENDING) { in binder_transaction_priority()
854 t->saved_priority = thread->prio_next; in binder_transaction_priority()
855 thread->prio_state = BINDER_PRIO_ABORT; in binder_transaction_priority()
858 current->pid, thread->prio_next.prio); in binder_transaction_priority()
863 spin_unlock(&thread->prio_lock); in binder_transaction_priority()
865 binder_set_priority(thread, &desired); in binder_transaction_priority()
1020 struct binder_thread *thread = container_of(target_list, in binder_inc_node_nilocked() local
1023 BUG_ON(&thread->todo != target_list); in binder_inc_node_nilocked()
1024 binder_enqueue_deferred_thread_work_ilocked(thread, in binder_inc_node_nilocked()
1713 static void binder_thread_dec_tmpref(struct binder_thread *thread) in binder_thread_dec_tmpref() argument
1719 binder_inner_proc_lock(thread->proc); in binder_thread_dec_tmpref()
1720 atomic_dec(&thread->tmp_ref); in binder_thread_dec_tmpref()
1721 if (thread->is_dead && !atomic_read(&thread->tmp_ref)) { in binder_thread_dec_tmpref()
1722 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
1723 binder_free_thread(thread); in binder_thread_dec_tmpref()
1726 binder_inner_proc_unlock(thread->proc); in binder_thread_dec_tmpref()
2217 struct binder_thread *thread, in binder_transaction_buffer_release() argument
2381 if (thread) in binder_transaction_buffer_release()
2382 thread->looper_need_return = true; in binder_transaction_buffer_release()
2396 struct binder_thread *thread, in binder_release_entire_buffer() argument
2405 binder_transaction_buffer_release(proc, thread, buffer, in binder_release_entire_buffer()
2411 struct binder_thread *thread) in binder_translate_binder() argument
2414 struct binder_proc *proc = thread->proc; in binder_translate_binder()
2427 proc->pid, thread->pid, (u64)fp->binder, in binder_translate_binder()
2440 &thread->todo, &rdata); in binder_translate_binder()
2464 struct binder_thread *thread) in binder_translate_handle() argument
2466 struct binder_proc *proc = thread->proc; in binder_translate_handle()
2476 proc->pid, thread->pid, fp->handle); in binder_translate_handle()
2537 struct binder_thread *thread, in binder_translate_fd() argument
2540 struct binder_proc *proc = thread->proc; in binder_translate_fd()
2553 proc->pid, thread->pid, in binder_translate_fd()
2563 proc->pid, thread->pid, fd); in binder_translate_fd()
2848 struct binder_thread *thread, in binder_translate_fd_array() argument
2854 struct binder_proc *proc = thread->proc; in binder_translate_fd_array()
2863 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2870 proc->pid, thread->pid, (u64)fda->num_fds); in binder_translate_fd_array()
2888 proc->pid, thread->pid); in binder_translate_fd_array()
2902 ret = binder_translate_fd(fd, offset, t, thread, in binder_translate_fd_array()
2912 struct binder_thread *thread, in binder_fixup_parent() argument
2921 struct binder_proc *proc = thread->proc; in binder_fixup_parent()
2935 proc->pid, thread->pid); in binder_fixup_parent()
2944 proc->pid, thread->pid); in binder_fixup_parent()
2952 proc->pid, thread->pid); in binder_fixup_parent()
3034 struct binder_thread *thread) in binder_proc_transaction() argument
3047 BUG_ON(thread); in binder_proc_transaction()
3062 (thread && thread->is_dead)) { in binder_proc_transaction()
3068 if (!thread && !pending_async) in binder_proc_transaction()
3069 thread = binder_select_thread_ilocked(proc); in binder_proc_transaction()
3072 thread ? thread->task : NULL, node->debug_id, t, in binder_proc_transaction()
3075 if (thread) { in binder_proc_transaction()
3076 binder_transaction_priority(thread, t, node); in binder_proc_transaction()
3077 binder_enqueue_thread_work_ilocked(thread, &t->work); in binder_proc_transaction()
3079 trace_android_vh_binder_special_task(t, proc, thread, in binder_proc_transaction()
3095 trace_android_vh_binder_special_task(t, proc, thread, in binder_proc_transaction()
3102 thread ? thread->task : NULL, pending_async, !oneway); in binder_proc_transaction()
3104 binder_wakeup_thread_ilocked(proc, thread, !oneway /* sync */); in binder_proc_transaction()
3258 struct binder_thread *thread, in binder_transaction() argument
3298 e->from_thread = thread->pid; in binder_transaction()
3305 binder_set_extended_error(&thread->ee, t_debug_id, BR_OK, 0); in binder_transaction()
3311 thread->pid, proc->pid); in binder_transaction()
3323 t->from_tid = thread->pid; in binder_transaction()
3329 t->from = thread; in binder_transaction()
3333 in_reply_to = thread->transaction_stack; in binder_transaction()
3337 proc->pid, thread->pid); in binder_transaction()
3343 if (in_reply_to->to_thread != thread) { in binder_transaction()
3346 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
3359 thread->transaction_stack = in_reply_to->to_parent; in binder_transaction()
3366 thread->pid, proc->pid); in binder_transaction()
3373 proc->pid, thread->pid, in binder_transaction()
3388 trace_android_vh_binder_reply(target_proc, proc, thread, tr); in binder_transaction()
3409 proc->pid, thread->pid, tr->target.handle); in binder_transaction()
3425 proc->pid, thread->pid); in binder_transaction()
3434 thread->pid, proc->pid); in binder_transaction()
3445 thread->pid, proc->pid); in binder_transaction()
3451 trace_android_vh_binder_trans(target_proc, proc, thread, tr); in binder_transaction()
3455 thread->pid, proc->pid); in binder_transaction()
3463 w = list_first_entry_or_null(&thread->todo, in binder_transaction()
3477 proc->pid, thread->pid); in binder_transaction()
3485 if (!(tr->flags & TF_ONE_WAY) && thread->transaction_stack) { in binder_transaction()
3488 tmp = thread->transaction_stack; in binder_transaction()
3489 if (tmp->to_thread != thread) { in binder_transaction()
3492 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
3533 thread->pid, proc->pid); in binder_transaction()
3544 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3553 proc->pid, thread->pid, t->debug_id, in binder_transaction()
3579 thread->pid, proc->pid); in binder_transaction()
3589 thread->pid, proc->pid); in binder_transaction()
3652 proc->pid, thread->pid); in binder_transaction()
3660 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
3668 proc->pid, thread->pid, in binder_transaction()
3696 thread->pid, proc->pid); in binder_transaction()
3716 proc->pid, thread->pid); in binder_transaction()
3726 proc->pid, thread->pid, in binder_transaction()
3749 ret = binder_translate_binder(fp, t, thread); in binder_transaction()
3757 thread->pid, proc->pid); in binder_transaction()
3769 ret = binder_translate_handle(fp, t, thread); in binder_transaction()
3776 thread->pid, proc->pid); in binder_transaction()
3789 thread, in_reply_to); in binder_transaction()
3798 thread->pid, proc->pid); in binder_transaction()
3822 proc->pid, thread->pid); in binder_transaction()
3835 proc->pid, thread->pid); in binder_transaction()
3850 proc->pid, thread->pid, in binder_transaction()
3861 thread, in_reply_to); in binder_transaction()
3869 thread->pid, proc->pid); in binder_transaction()
3887 proc->pid, thread->pid); in binder_transaction()
3898 thread->pid, proc->pid); in binder_transaction()
3911 thread, bp, in binder_transaction()
3922 thread->pid, proc->pid); in binder_transaction()
3933 proc->pid, thread->pid, hdr->type); in binder_transaction()
3947 proc->pid, thread->pid); in binder_transaction()
3958 proc->pid, thread->pid); in binder_transaction()
3975 binder_enqueue_thread_work(thread, tcomplete); in binder_transaction()
3988 spin_lock(&thread->prio_lock); in binder_transaction()
3989 thread->prio_state = BINDER_PRIO_PENDING; in binder_transaction()
3990 thread->prio_next = in_reply_to->saved_priority; in binder_transaction()
3991 spin_unlock(&thread->prio_lock); in binder_transaction()
3995 binder_restore_priority(thread, &in_reply_to->saved_priority); in binder_transaction()
4007 binder_enqueue_deferred_thread_work_ilocked(thread, tcomplete); in binder_transaction()
4009 t->from_parent = thread->transaction_stack; in binder_transaction()
4010 thread->transaction_stack = t; in binder_transaction()
4016 binder_pop_transaction_ilocked(thread, t); in binder_transaction()
4034 binder_enqueue_thread_work(thread, tcomplete); in binder_transaction()
4054 thread->pid, proc->pid); in binder_transaction()
4099 proc->pid, thread->pid, reply ? "reply" : in binder_transaction()
4129 BUG_ON(thread->return_error.cmd != BR_OK); in binder_transaction()
4132 binder_restore_priority(thread, &in_reply_to->saved_priority); in binder_transaction()
4135 thread->return_error.cmd = BR_TRANSACTION_COMPLETE; in binder_transaction()
4136 binder_enqueue_thread_work(thread, &thread->return_error.work); in binder_transaction()
4140 binder_set_extended_error(&thread->ee, t_debug_id, in binder_transaction()
4143 thread->return_error.cmd = return_error; in binder_transaction()
4144 binder_enqueue_thread_work(thread, &thread->return_error.work); in binder_transaction()
4150 struct binder_thread *thread, in binder_request_freeze_notification() argument
4163 proc->pid, thread->pid, handle_cookie->handle); in binder_request_freeze_notification()
4172 proc->pid, thread->pid); in binder_request_freeze_notification()
4203 struct binder_thread *thread, in binder_clear_freeze_notification() argument
4213 proc->pid, thread->pid, handle_cookie->handle); in binder_clear_freeze_notification()
4222 proc->pid, thread->pid); in binder_clear_freeze_notification()
4231 proc->pid, thread->pid, (u64)freeze->cookie, in binder_clear_freeze_notification()
4262 struct binder_thread *thread, in binder_freeze_notification_done() argument
4280 proc->pid, thread->pid, (u64)cookie); in binder_freeze_notification_done()
4308 struct binder_thread *thread, in binder_free_buf() argument
4334 trace_android_vh_binder_special_task(NULL, proc, thread, w, in binder_free_buf()
4342 trace_android_vh_binder_buffer_release(proc, thread, buffer, in binder_free_buf()
4345 binder_release_entire_buffer(proc, thread, buffer, is_failure); in binder_free_buf()
4350 struct binder_thread *thread, in binder_thread_write() argument
4360 while (ptr < end && thread->return_error.cmd == BR_OK) { in binder_thread_write()
4370 atomic_inc(&thread->stats.bc[_IOC_NR(cmd)]); in binder_thread_write()
4396 proc->pid, thread->pid); in binder_thread_write()
4412 proc->pid, thread->pid, in binder_thread_write()
4432 proc->pid, thread->pid, debug_string, in binder_thread_write()
4438 proc->pid, thread->pid, debug_string, in binder_thread_write()
4459 proc->pid, thread->pid, in binder_thread_write()
4468 proc->pid, thread->pid, in binder_thread_write()
4480 proc->pid, thread->pid, in binder_thread_write()
4490 proc->pid, thread->pid, in binder_thread_write()
4503 proc->pid, thread->pid, in binder_thread_write()
4532 proc->pid, thread->pid, in binder_thread_write()
4537 proc->pid, thread->pid, in binder_thread_write()
4544 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
4547 binder_free_buf(proc, thread, buffer, false); in binder_thread_write()
4558 binder_transaction(proc, thread, &tr.transaction_data, in binder_thread_write()
4569 binder_transaction(proc, thread, &tr, in binder_thread_write()
4577 proc->pid, thread->pid); in binder_thread_write()
4579 if (thread->looper & BINDER_LOOPER_STATE_ENTERED) { in binder_thread_write()
4580 thread->looper |= BINDER_LOOPER_STATE_INVALID; in binder_thread_write()
4582 proc->pid, thread->pid); in binder_thread_write()
4584 thread->looper |= BINDER_LOOPER_STATE_INVALID; in binder_thread_write()
4586 proc->pid, thread->pid); in binder_thread_write()
4591 thread->looper |= BINDER_LOOPER_STATE_REGISTERED; in binder_thread_write()
4593 trace_android_vh_binder_looper_state_registered(thread, proc); in binder_thread_write()
4598 proc->pid, thread->pid); in binder_thread_write()
4599 if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) { in binder_thread_write()
4600 thread->looper |= BINDER_LOOPER_STATE_INVALID; in binder_thread_write()
4602 proc->pid, thread->pid); in binder_thread_write()
4604 thread->looper |= BINDER_LOOPER_STATE_ENTERED; in binder_thread_write()
4607 trace_android_vh_binder_looper_exited(thread, proc); in binder_thread_write()
4610 proc->pid, thread->pid); in binder_thread_write()
4611 thread->looper |= BINDER_LOOPER_STATE_EXITED; in binder_thread_write()
4634 WARN_ON(thread->return_error.cmd != in binder_thread_write()
4636 thread->return_error.cmd = BR_ERROR; in binder_thread_write()
4638 thread, in binder_thread_write()
4639 &thread->return_error.work); in binder_thread_write()
4643 proc->pid, thread->pid); in binder_thread_write()
4651 proc->pid, thread->pid, in binder_thread_write()
4663 proc->pid, thread->pid, in binder_thread_write()
4675 proc->pid, thread->pid); in binder_thread_write()
4697 proc->pid, thread->pid); in binder_thread_write()
4705 proc->pid, thread->pid, in binder_thread_write()
4716 if (thread->looper & in binder_thread_write()
4720 thread, in binder_thread_write()
4762 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
4766 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
4773 if (thread->looper & in binder_thread_write()
4777 thread, &death->work); in binder_thread_write()
4795 error = binder_request_freeze_notification(proc, thread, in binder_thread_write()
4808 error = binder_clear_freeze_notification(proc, thread, &handle_cookie); in binder_thread_write()
4821 error = binder_freeze_notification_done(proc, thread, cookie); in binder_thread_write()
4828 proc->pid, thread->pid, cmd); in binder_thread_write()
4837 struct binder_thread *thread, uint32_t cmd) in binder_stat_br() argument
4843 atomic_inc(&thread->stats.br[_IOC_NR(cmd)]); in binder_stat_br()
4848 struct binder_thread *thread, in binder_put_node_cmd() argument
4869 binder_stat_br(proc, thread, cmd); in binder_put_node_cmd()
4871 proc->pid, thread->pid, cmd_name, node_debug_id, in binder_put_node_cmd()
4878 static int binder_wait_for_work(struct binder_thread *thread, in binder_wait_for_work() argument
4882 struct binder_proc *proc = thread->proc; in binder_wait_for_work()
4887 prepare_to_wait(&thread->wait, &wait, TASK_INTERRUPTIBLE|TASK_FREEZABLE); in binder_wait_for_work()
4888 if (binder_has_work_ilocked(thread, do_proc_work)) in binder_wait_for_work()
4891 list_add(&thread->waiting_thread_node, in binder_wait_for_work()
4893 trace_android_vh_binder_wait_for_work(do_proc_work, thread, proc); in binder_wait_for_work()
4897 list_del_init(&thread->waiting_thread_node); in binder_wait_for_work()
4903 finish_wait(&thread->wait, &wait); in binder_wait_for_work()
4964 struct binder_thread *thread, in binder_thread_read() argument
4985 wait_for_proc_work = binder_available_for_proc_work_ilocked(thread); in binder_thread_read()
4988 thread->looper |= BINDER_LOOPER_STATE_WAITING; in binder_thread_read()
4991 !!thread->transaction_stack, in binder_thread_read()
4992 !binder_worklist_empty(proc, &thread->todo)); in binder_thread_read()
4994 if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED | in binder_thread_read()
4997 proc->pid, thread->pid, thread->looper); in binder_thread_read()
5002 binder_restore_priority(thread, &proc->default_priority); in binder_thread_read()
5006 if (!binder_has_work(thread, wait_for_proc_work)) in binder_thread_read()
5009 ret = binder_wait_for_work(thread, wait_for_proc_work); in binder_thread_read()
5012 thread->looper &= ~BINDER_LOOPER_STATE_WAITING; in binder_thread_read()
5028 trace_android_vh_binder_select_special_worklist(&list, thread, in binder_thread_read()
5035 if (!binder_worklist_empty_ilocked(&thread->todo)) in binder_thread_read()
5036 list = &thread->todo; in binder_thread_read()
5045 if (ptr - buffer == 4 && !thread->looper_need_return) in binder_thread_read()
5054 trace_android_vh_binder_thread_read(&list, proc, thread); in binder_thread_read()
5056 if (binder_worklist_empty_ilocked(&thread->todo)) in binder_thread_read()
5057 thread->process_todo = false; in binder_thread_read()
5076 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5095 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5098 proc->pid, thread->pid); in binder_thread_read()
5136 proc->pid, thread->pid, in binder_thread_read()
5159 proc, thread, &ptr, node_ptr, in binder_thread_read()
5164 proc, thread, &ptr, node_ptr, in binder_thread_read()
5169 proc, thread, &ptr, node_ptr, in binder_thread_read()
5174 proc, thread, &ptr, node_ptr, in binder_thread_read()
5180 proc->pid, thread->pid, in binder_thread_read()
5203 proc->pid, thread->pid, in binder_thread_read()
5224 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5247 binder_stat_br(proc, thread, BR_FROZEN_BINDER); in binder_thread_read()
5265 binder_stat_br(proc, thread, BR_CLEAR_FREEZE_NOTIFICATION_DONE); in binder_thread_read()
5271 proc->pid, thread->pid, w->type); in binder_thread_read()
5284 binder_transaction_priority(thread, t, target_node); in binder_thread_read()
5302 trace_android_vh_sync_txn_recvd(thread->task, t_from->task); in binder_thread_read()
5318 binder_free_buf(proc, thread, buffer, true); in binder_thread_read()
5321 proc->pid, thread->pid, in binder_thread_read()
5330 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5369 trace_android_vh_binder_transaction_received(t, proc, thread, cmd); in binder_thread_read()
5370 binder_stat_br(proc, thread, cmd); in binder_thread_read()
5373 proc->pid, thread->pid, in binder_thread_read()
5387 binder_inner_proc_lock(thread->proc); in binder_thread_read()
5388 t->to_parent = thread->transaction_stack; in binder_thread_read()
5389 t->to_thread = thread; in binder_thread_read()
5390 thread->transaction_stack = t; in binder_thread_read()
5391 binder_inner_proc_unlock(thread->proc); in binder_thread_read()
5402 trace_android_vh_binder_spawn_new_thread(thread, proc, &force_spawn); in binder_thread_read()
5405 list_empty(&thread->proc->waiting_threads) && in binder_thread_read()
5407 (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | in binder_thread_read()
5414 proc->pid, thread->pid); in binder_thread_read()
5417 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
5497 struct binder_thread *thread = NULL; in binder_get_thread_ilocked() local
5503 thread = rb_entry(parent, struct binder_thread, rb_node); in binder_get_thread_ilocked()
5505 if (current->pid < thread->pid) in binder_get_thread_ilocked()
5507 else if (current->pid > thread->pid) in binder_get_thread_ilocked()
5510 return thread; in binder_get_thread_ilocked()
5514 thread = new_thread; in binder_get_thread_ilocked()
5516 thread->proc = proc; in binder_get_thread_ilocked()
5517 thread->pid = current->pid; in binder_get_thread_ilocked()
5519 thread->task = current; in binder_get_thread_ilocked()
5520 atomic_set(&thread->tmp_ref, 0); in binder_get_thread_ilocked()
5521 init_waitqueue_head(&thread->wait); in binder_get_thread_ilocked()
5522 INIT_LIST_HEAD(&thread->todo); in binder_get_thread_ilocked()
5523 rb_link_node(&thread->rb_node, parent, p); in binder_get_thread_ilocked()
5524 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread_ilocked()
5525 thread->looper_need_return = true; in binder_get_thread_ilocked()
5526 thread->return_error.work.type = BINDER_WORK_RETURN_ERROR; in binder_get_thread_ilocked()
5527 thread->return_error.cmd = BR_OK; in binder_get_thread_ilocked()
5528 thread->reply_error.work.type = BINDER_WORK_RETURN_ERROR; in binder_get_thread_ilocked()
5529 thread->reply_error.cmd = BR_OK; in binder_get_thread_ilocked()
5530 spin_lock_init(&thread->prio_lock); in binder_get_thread_ilocked()
5531 thread->prio_state = BINDER_PRIO_SET; in binder_get_thread_ilocked()
5532 thread->ee.command = BR_OK; in binder_get_thread_ilocked()
5534 return thread; in binder_get_thread_ilocked()
5539 struct binder_thread *thread; in binder_get_thread() local
5543 thread = binder_get_thread_ilocked(proc, NULL); in binder_get_thread()
5545 if (!thread) { in binder_get_thread()
5546 new_thread = kzalloc(sizeof(*thread), GFP_KERNEL); in binder_get_thread()
5550 thread = binder_get_thread_ilocked(proc, new_thread); in binder_get_thread()
5552 if (thread != new_thread) in binder_get_thread()
5555 return thread; in binder_get_thread()
5581 static void binder_free_thread(struct binder_thread *thread) in binder_free_thread() argument
5583 BUG_ON(!list_empty(&thread->todo)); in binder_free_thread()
5585 binder_proc_dec_tmpref(thread->proc); in binder_free_thread()
5586 put_task_struct(thread->task); in binder_free_thread()
5587 kfree(thread); in binder_free_thread()
5591 struct binder_thread *thread) in binder_thread_release() argument
5598 binder_inner_proc_lock(thread->proc); in binder_thread_release()
5610 atomic_inc(&thread->tmp_ref); in binder_thread_release()
5611 rb_erase(&thread->rb_node, &proc->threads); in binder_thread_release()
5612 t = thread->transaction_stack; in binder_thread_release()
5615 if (t->to_thread == thread) in binder_thread_release()
5620 thread->is_dead = true; in binder_thread_release()
5627 proc->pid, thread->pid, in binder_thread_release()
5629 (t->to_thread == thread) ? "in" : "out"); in binder_thread_release()
5631 if (t->to_thread == thread) { in binder_thread_release()
5632 thread->proc->outstanding_txns--; in binder_thread_release()
5640 } else if (t->from == thread) { in binder_thread_release()
5658 if (thread->looper & BINDER_LOOPER_STATE_POLL) in binder_thread_release()
5659 wake_up_pollfree(&thread->wait); in binder_thread_release()
5661 binder_inner_proc_unlock(thread->proc); in binder_thread_release()
5670 if (thread->looper & BINDER_LOOPER_STATE_POLL) in binder_thread_release()
5675 binder_release_work(proc, &thread->todo); in binder_thread_release()
5676 trace_android_vh_binder_thread_release(proc, thread); in binder_thread_release()
5677 binder_thread_dec_tmpref(thread); in binder_thread_release()
5685 struct binder_thread *thread = NULL; in binder_poll() local
5688 thread = binder_get_thread(proc); in binder_poll()
5689 if (!thread) in binder_poll()
5692 binder_inner_proc_lock(thread->proc); in binder_poll()
5693 thread->looper |= BINDER_LOOPER_STATE_POLL; in binder_poll()
5694 wait_for_proc_work = binder_available_for_proc_work_ilocked(thread); in binder_poll()
5696 binder_inner_proc_unlock(thread->proc); in binder_poll()
5698 poll_wait(filp, &thread->wait, wait); in binder_poll()
5700 if (binder_has_work(thread, wait_for_proc_work)) in binder_poll()
5707 struct binder_thread *thread) in binder_ioctl_write_read() argument
5721 proc->pid, thread->pid, in binder_ioctl_write_read()
5726 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
5739 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
5746 thread, true, &has_special_work); in binder_ioctl_write_read()
5750 trace_android_vh_binder_read_done(proc, thread); in binder_ioctl_write_read()
5759 proc->pid, thread->pid, in binder_ioctl_write_read()
5882 struct binder_thread *thread; in binder_txns_pending_ilocked() local
5888 thread = rb_entry(n, struct binder_thread, rb_node); in binder_txns_pending_ilocked()
5889 if (thread->transaction_stack) in binder_txns_pending_ilocked()
6027 static int binder_ioctl_get_extended_error(struct binder_thread *thread, in binder_ioctl_get_extended_error() argument
6032 binder_inner_proc_lock(thread->proc); in binder_ioctl_get_extended_error()
6033 ee = thread->ee; in binder_ioctl_get_extended_error()
6034 binder_set_extended_error(&thread->ee, 0, BR_OK, 0); in binder_ioctl_get_extended_error()
6035 binder_inner_proc_unlock(thread->proc); in binder_ioctl_get_extended_error()
6047 struct binder_thread *thread; in binder_ioctl() local
6061 thread = binder_get_thread(proc); in binder_ioctl()
6062 if (thread == NULL) { in binder_ioctl()
6069 ret = binder_ioctl_write_read(filp, arg, thread); in binder_ioctl()
6105 proc->pid, thread->pid); in binder_ioctl()
6106 binder_thread_release(proc, thread); in binder_ioctl()
6107 thread = NULL; in binder_ioctl()
6247 ret = binder_ioctl_get_extended_error(thread, ubuf); in binder_ioctl()
6256 trace_android_vh_binder_ioctl_end(current, cmd, arg, thread, proc, &ret); in binder_ioctl()
6258 if (thread) in binder_ioctl()
6259 thread->looper_need_return = false; in binder_ioctl()
6453 struct binder_thread *thread = rb_entry(n, struct binder_thread, rb_node); in binder_deferred_flush() local
6455 thread->looper_need_return = true; in binder_deferred_flush()
6456 if (thread->looper & BINDER_LOOPER_STATE_WAITING) { in binder_deferred_flush()
6457 wake_up_interruptible(&thread->wait); in binder_deferred_flush()
6583 struct binder_thread *thread; in binder_deferred_release() local
6585 thread = rb_entry(n, struct binder_thread, rb_node); in binder_deferred_release()
6588 active_transactions += binder_thread_release(proc, thread); in binder_deferred_release()
6785 struct binder_thread *thread, in print_binder_thread_ilocked() argument
6794 thread->pid, thread->looper, in print_binder_thread_ilocked()
6795 thread->looper_need_return, in print_binder_thread_ilocked()
6796 atomic_read(&thread->tmp_ref)); in print_binder_thread_ilocked()
6798 t = thread->transaction_stack; in print_binder_thread_ilocked()
6800 if (t->from == thread) { in print_binder_thread_ilocked()
6801 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6804 } else if (t->to_thread == thread) { in print_binder_thread_ilocked()
6805 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6809 print_binder_transaction_ilocked(m, thread->proc, in print_binder_thread_ilocked()
6814 list_for_each_entry(w, &thread->todo, entry) { in print_binder_thread_ilocked()
6815 print_binder_work_ilocked(m, thread->proc, " ", in print_binder_thread_ilocked()
7091 struct binder_thread *thread; in print_binder_proc_stats() local
7105 list_for_each_entry(thread, &proc->waiting_threads, waiting_thread_node) in print_binder_proc_stats()