Lines Matching refs:thread

1318 			       struct binder_thread *thread,  in binder_transaction()  argument
1336 e->from_thread = thread->pid; in binder_transaction()
1342 in_reply_to = thread->transaction_stack; in binder_transaction()
1345 proc->pid, thread->pid); in binder_transaction()
1350 if (in_reply_to->to_thread != thread) { in binder_transaction()
1352 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
1361 thread->transaction_stack = in_reply_to->to_parent; in binder_transaction()
1369 proc->pid, thread->pid, in binder_transaction()
1386 proc->pid, thread->pid); in binder_transaction()
1409 if (!(tr->flags & TF_ONE_WAY) && thread->transaction_stack) { in binder_transaction()
1412 tmp = thread->transaction_stack; in binder_transaction()
1413 if (tmp->to_thread != thread) { in binder_transaction()
1415 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
1460 proc->pid, thread->pid, t->debug_id, in binder_transaction()
1468 proc->pid, thread->pid, t->debug_id, in binder_transaction()
1475 t->from = thread; in binder_transaction()
1507 proc->pid, thread->pid); in binder_transaction()
1514 proc->pid, thread->pid); in binder_transaction()
1520 proc->pid, thread->pid, (u64)tr->offsets_size); in binder_transaction()
1532 proc->pid, thread->pid, (u64)*offp); in binder_transaction()
1554 proc->pid, thread->pid, in binder_transaction()
1576 &thread->todo); in binder_transaction()
1591 thread->pid, fp->handle); in binder_transaction()
1639 proc->pid, thread->pid, fp->handle); in binder_transaction()
1645 proc->pid, thread->pid, fp->handle); in binder_transaction()
1653 proc->pid, thread->pid, fp->handle); in binder_transaction()
1680 proc->pid, thread->pid, fp->type); in binder_transaction()
1691 t->from_parent = thread->transaction_stack; in binder_transaction()
1692 thread->transaction_stack = t; in binder_transaction()
1705 list_add_tail(&tcomplete->entry, &thread->todo); in binder_transaction()
1737 proc->pid, thread->pid, return_error, in binder_transaction()
1747 BUG_ON(thread->return_error != BR_OK); in binder_transaction()
1749 thread->return_error = BR_TRANSACTION_COMPLETE; in binder_transaction()
1752 thread->return_error = return_error; in binder_transaction()
1756 struct binder_thread *thread, in binder_thread_write() argument
1765 while (ptr < end && thread->return_error == BR_OK) { in binder_thread_write()
1773 thread->stats.bc[_IOC_NR(cmd)]++; in binder_thread_write()
1793 proc->pid, thread->pid, in binder_thread_write()
1800 proc->pid, thread->pid, target); in binder_thread_write()
1824 proc->pid, thread->pid, debug_string, ref->debug_id, in binder_thread_write()
1843 proc->pid, thread->pid, in binder_thread_write()
1852 proc->pid, thread->pid, in binder_thread_write()
1862 proc->pid, thread->pid, in binder_thread_write()
1870 proc->pid, thread->pid, in binder_thread_write()
1879 proc->pid, thread->pid, in binder_thread_write()
1902 proc->pid, thread->pid, (u64)data_ptr); in binder_thread_write()
1907 proc->pid, thread->pid, (u64)data_ptr); in binder_thread_write()
1912 proc->pid, thread->pid, (u64)data_ptr, in binder_thread_write()
1925 list_move_tail(buffer->target_node->async_todo.next, &thread->todo); in binder_thread_write()
1940 binder_transaction(proc, thread, &tr, cmd == BC_REPLY); in binder_thread_write()
1947 proc->pid, thread->pid); in binder_thread_write()
1948 if (thread->looper & BINDER_LOOPER_STATE_ENTERED) { in binder_thread_write()
1949 thread->looper |= BINDER_LOOPER_STATE_INVALID; in binder_thread_write()
1951 proc->pid, thread->pid); in binder_thread_write()
1953 thread->looper |= BINDER_LOOPER_STATE_INVALID; in binder_thread_write()
1955 proc->pid, thread->pid); in binder_thread_write()
1960 thread->looper |= BINDER_LOOPER_STATE_REGISTERED; in binder_thread_write()
1965 proc->pid, thread->pid); in binder_thread_write()
1966 if (thread->looper & BINDER_LOOPER_STATE_REGISTERED) { in binder_thread_write()
1967 thread->looper |= BINDER_LOOPER_STATE_INVALID; in binder_thread_write()
1969 proc->pid, thread->pid); in binder_thread_write()
1971 thread->looper |= BINDER_LOOPER_STATE_ENTERED; in binder_thread_write()
1976 proc->pid, thread->pid); in binder_thread_write()
1977 thread->looper |= BINDER_LOOPER_STATE_EXITED; in binder_thread_write()
1996 proc->pid, thread->pid, in binder_thread_write()
2006 proc->pid, thread->pid, in binder_thread_write()
2016 proc->pid, thread->pid); in binder_thread_write()
2021 thread->return_error = BR_ERROR; in binder_thread_write()
2024 proc->pid, thread->pid); in binder_thread_write()
2033 if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) { in binder_thread_write()
2034 list_add_tail(&ref->death->work.entry, &thread->todo); in binder_thread_write()
2043 proc->pid, thread->pid); in binder_thread_write()
2049 proc->pid, thread->pid, in binder_thread_write()
2057 if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) { in binder_thread_write()
2058 list_add_tail(&death->work.entry, &thread->todo); in binder_thread_write()
2088 proc->pid, thread->pid, (u64)cookie, in binder_thread_write()
2092 proc->pid, thread->pid, (u64)cookie); in binder_thread_write()
2099 if (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | BINDER_LOOPER_STATE_ENTERED)) { in binder_thread_write()
2100 list_add_tail(&death->work.entry, &thread->todo); in binder_thread_write()
2110 proc->pid, thread->pid, cmd); in binder_thread_write()
2119 struct binder_thread *thread, uint32_t cmd) in binder_stat_br() argument
2125 thread->stats.br[_IOC_NR(cmd)]++; in binder_stat_br()
2130 struct binder_thread *thread) in binder_has_proc_work() argument
2133 (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); in binder_has_proc_work()
2136 static int binder_has_thread_work(struct binder_thread *thread) in binder_has_thread_work() argument
2138 return !list_empty(&thread->todo) || thread->return_error != BR_OK || in binder_has_thread_work()
2139 (thread->looper & BINDER_LOOPER_STATE_NEED_RETURN); in binder_has_thread_work()
2143 struct binder_thread *thread, in binder_thread_read() argument
2161 wait_for_proc_work = thread->transaction_stack == NULL && in binder_thread_read()
2162 list_empty(&thread->todo); in binder_thread_read()
2164 if (thread->return_error != BR_OK && ptr < end) { in binder_thread_read()
2165 if (thread->return_error2 != BR_OK) { in binder_thread_read()
2166 if (put_user(thread->return_error2, (uint32_t __user *)ptr)) in binder_thread_read()
2169 binder_stat_br(proc, thread, thread->return_error2); in binder_thread_read()
2172 thread->return_error2 = BR_OK; in binder_thread_read()
2174 if (put_user(thread->return_error, (uint32_t __user *)ptr)) in binder_thread_read()
2177 binder_stat_br(proc, thread, thread->return_error); in binder_thread_read()
2178 thread->return_error = BR_OK; in binder_thread_read()
2183 thread->looper |= BINDER_LOOPER_STATE_WAITING; in binder_thread_read()
2190 !!thread->transaction_stack, in binder_thread_read()
2191 !list_empty(&thread->todo)); in binder_thread_read()
2193 if (!(thread->looper & (BINDER_LOOPER_STATE_REGISTERED | in binder_thread_read()
2196 proc->pid, thread->pid, thread->looper); in binder_thread_read()
2202 if (!binder_has_proc_work(proc, thread)) in binder_thread_read()
2205 ret = wait_event_freezable_exclusive(proc->wait, binder_has_proc_work(proc, thread)); in binder_thread_read()
2208 if (!binder_has_thread_work(thread)) in binder_thread_read()
2211 ret = wait_event_freezable(thread->wait, binder_has_thread_work(thread)); in binder_thread_read()
2218 thread->looper &= ~BINDER_LOOPER_STATE_WAITING; in binder_thread_read()
2229 if (!list_empty(&thread->todo)) { in binder_thread_read()
2230 w = list_first_entry(&thread->todo, struct binder_work, in binder_thread_read()
2238 !(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN)) in binder_thread_read()
2256 binder_stat_br(proc, thread, cmd); in binder_thread_read()
2259 proc->pid, thread->pid); in binder_thread_read()
2306 binder_stat_br(proc, thread, cmd); in binder_thread_read()
2309 proc->pid, thread->pid, cmd_name, in binder_thread_read()
2317 proc->pid, thread->pid, in binder_thread_read()
2327 proc->pid, thread->pid, in binder_thread_read()
2352 binder_stat_br(proc, thread, cmd); in binder_thread_read()
2355 proc->pid, thread->pid, in binder_thread_read()
2424 binder_stat_br(proc, thread, cmd); in binder_thread_read()
2427 proc->pid, thread->pid, in binder_thread_read()
2438 t->to_parent = thread->transaction_stack; in binder_thread_read()
2439 t->to_thread = thread; in binder_thread_read()
2440 thread->transaction_stack = t; in binder_thread_read()
2454 (thread->looper & (BINDER_LOOPER_STATE_REGISTERED | in binder_thread_read()
2460 proc->pid, thread->pid); in binder_thread_read()
2463 binder_stat_br(proc, thread, BR_SPAWN_LOOPER); in binder_thread_read()
2520 struct binder_thread *thread = NULL; in binder_get_thread() local
2526 thread = rb_entry(parent, struct binder_thread, rb_node); in binder_get_thread()
2528 if (current->pid < thread->pid) in binder_get_thread()
2530 else if (current->pid > thread->pid) in binder_get_thread()
2536 thread = kzalloc(sizeof(*thread), GFP_KERNEL); in binder_get_thread()
2537 if (thread == NULL) in binder_get_thread()
2540 thread->proc = proc; in binder_get_thread()
2541 thread->pid = current->pid; in binder_get_thread()
2542 init_waitqueue_head(&thread->wait); in binder_get_thread()
2543 INIT_LIST_HEAD(&thread->todo); in binder_get_thread()
2544 rb_link_node(&thread->rb_node, parent, p); in binder_get_thread()
2545 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread()
2546 thread->looper |= BINDER_LOOPER_STATE_NEED_RETURN; in binder_get_thread()
2547 thread->return_error = BR_OK; in binder_get_thread()
2548 thread->return_error2 = BR_OK; in binder_get_thread()
2550 return thread; in binder_get_thread()
2554 struct binder_thread *thread) in binder_free_thread() argument
2560 rb_erase(&thread->rb_node, &proc->threads); in binder_free_thread()
2561 t = thread->transaction_stack; in binder_free_thread()
2562 if (t && t->to_thread == thread) in binder_free_thread()
2568 proc->pid, thread->pid, in binder_free_thread()
2570 (t->to_thread == thread) ? "in" : "out"); in binder_free_thread()
2572 if (t->to_thread == thread) { in binder_free_thread()
2580 } else if (t->from == thread) { in binder_free_thread()
2588 binder_release_work(&thread->todo); in binder_free_thread()
2589 kfree(thread); in binder_free_thread()
2598 struct binder_thread *thread = NULL; in binder_poll() local
2603 thread = binder_get_thread(proc); in binder_poll()
2605 wait_for_proc_work = thread->transaction_stack == NULL && in binder_poll()
2606 list_empty(&thread->todo) && thread->return_error == BR_OK; in binder_poll()
2611 if (binder_has_proc_work(proc, thread)) in binder_poll()
2614 if (binder_has_proc_work(proc, thread)) in binder_poll()
2617 if (binder_has_thread_work(thread)) in binder_poll()
2619 poll_wait(filp, &thread->wait, wait); in binder_poll()
2620 if (binder_has_thread_work(thread)) in binder_poll()
2628 struct binder_thread *thread) in binder_ioctl_write_read() argument
2646 proc->pid, thread->pid, in binder_ioctl_write_read()
2651 ret = binder_thread_write(proc, thread, in binder_ioctl_write_read()
2664 ret = binder_thread_read(proc, thread, bwr.read_buffer, in binder_ioctl_write_read()
2679 proc->pid, thread->pid, in binder_ioctl_write_read()
2733 struct binder_thread *thread; in binder_ioctl() local
2747 thread = binder_get_thread(proc); in binder_ioctl()
2748 if (thread == NULL) { in binder_ioctl()
2755 ret = binder_ioctl_write_read(filp, cmd, arg, thread); in binder_ioctl()
2772 proc->pid, thread->pid); in binder_ioctl()
2773 binder_free_thread(proc, thread); in binder_ioctl()
2774 thread = NULL; in binder_ioctl()
2796 if (thread) in binder_ioctl()
2797 thread->looper &= ~BINDER_LOOPER_STATE_NEED_RETURN; in binder_ioctl()
2994 struct binder_thread *thread = rb_entry(n, struct binder_thread, rb_node); in binder_deferred_flush() local
2996 thread->looper |= BINDER_LOOPER_STATE_NEED_RETURN; in binder_deferred_flush()
2997 if (thread->looper & BINDER_LOOPER_STATE_WAITING) { in binder_deferred_flush()
2998 wake_up_interruptible(&thread->wait); in binder_deferred_flush()
3085 struct binder_thread *thread; in binder_deferred_release() local
3087 thread = rb_entry(n, struct binder_thread, rb_node); in binder_deferred_release()
3089 active_transactions += binder_free_thread(proc, thread); in binder_deferred_release()
3292 struct binder_thread *thread, in print_binder_thread() argument
3300 seq_printf(m, " thread %d: l %02x\n", thread->pid, thread->looper); in print_binder_thread()
3302 t = thread->transaction_stack; in print_binder_thread()
3304 if (t->from == thread) { in print_binder_thread()
3308 } else if (t->to_thread == thread) { in print_binder_thread()
3317 list_for_each_entry(w, &thread->todo, entry) { in print_binder_thread()