Lines Matching refs:proc
79 BINDER_DEBUG_ENTRY(proc);
233 struct binder_proc *proc; member
264 struct binder_proc *proc; member
341 struct binder_proc *proc; member
375 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer);
377 static int task_get_unused_fd_flags(struct binder_proc *proc, int flags) in task_get_unused_fd_flags() argument
379 struct files_struct *files = proc->files; in task_get_unused_fd_flags()
386 if (!lock_task_sighand(proc->tsk, &irqs)) in task_get_unused_fd_flags()
389 rlim_cur = task_rlimit(proc->tsk, RLIMIT_NOFILE); in task_get_unused_fd_flags()
390 unlock_task_sighand(proc->tsk, &irqs); in task_get_unused_fd_flags()
399 struct binder_proc *proc, unsigned int fd, struct file *file) in task_fd_install() argument
401 if (proc->files) in task_fd_install()
402 __fd_install(proc->files, fd, file); in task_fd_install()
408 static long task_close_fd(struct binder_proc *proc, unsigned int fd) in task_close_fd() argument
412 if (proc->files == NULL) in task_close_fd()
415 retval = __close_fd(proc->files, fd); in task_close_fd()
457 static size_t binder_buffer_size(struct binder_proc *proc, in binder_buffer_size() argument
460 if (list_is_last(&buffer->entry, &proc->buffers)) in binder_buffer_size()
461 return proc->buffer + proc->buffer_size - (void *)buffer->data; in binder_buffer_size()
466 static void binder_insert_free_buffer(struct binder_proc *proc, in binder_insert_free_buffer() argument
469 struct rb_node **p = &proc->free_buffers.rb_node; in binder_insert_free_buffer()
477 new_buffer_size = binder_buffer_size(proc, new_buffer); in binder_insert_free_buffer()
481 proc->pid, new_buffer_size, new_buffer); in binder_insert_free_buffer()
488 buffer_size = binder_buffer_size(proc, buffer); in binder_insert_free_buffer()
496 rb_insert_color(&new_buffer->rb_node, &proc->free_buffers); in binder_insert_free_buffer()
499 static void binder_insert_allocated_buffer(struct binder_proc *proc, in binder_insert_allocated_buffer() argument
502 struct rb_node **p = &proc->allocated_buffers.rb_node; in binder_insert_allocated_buffer()
521 rb_insert_color(&new_buffer->rb_node, &proc->allocated_buffers); in binder_insert_allocated_buffer()
524 static struct binder_buffer *binder_buffer_lookup(struct binder_proc *proc, in binder_buffer_lookup() argument
527 struct rb_node *n = proc->allocated_buffers.rb_node; in binder_buffer_lookup()
531 kern_ptr = (struct binder_buffer *)(user_ptr - proc->user_buffer_offset in binder_buffer_lookup()
548 static int binder_update_page_range(struct binder_proc *proc, int allocate, in binder_update_page_range() argument
558 "%d: %s pages %p-%p\n", proc->pid, in binder_update_page_range()
564 trace_binder_update_page_range(proc, allocate, start, end); in binder_update_page_range()
569 mm = get_task_mm(proc->tsk); in binder_update_page_range()
573 vma = proc->vma; in binder_update_page_range()
574 if (vma && mm != proc->vma_vm_mm) { in binder_update_page_range()
576 proc->pid); in binder_update_page_range()
586 proc->pid); in binder_update_page_range()
593 page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; in binder_update_page_range()
599 proc->pid, page_addr); in binder_update_page_range()
608 proc->pid, page_addr); in binder_update_page_range()
612 (uintptr_t)page_addr + proc->user_buffer_offset; in binder_update_page_range()
616 proc->pid, user_page_addr); in binder_update_page_range()
630 page = &proc->pages[(page_addr - proc->buffer) / PAGE_SIZE]; in binder_update_page_range()
633 proc->user_buffer_offset, PAGE_SIZE, NULL); in binder_update_page_range()
650 static struct binder_buffer *binder_alloc_buf(struct binder_proc *proc, in binder_alloc_buf() argument
654 struct rb_node *n = proc->free_buffers.rb_node; in binder_alloc_buf()
662 if (proc->vma == NULL) { in binder_alloc_buf()
664 proc->pid); in binder_alloc_buf()
673 proc->pid, data_size, offsets_size); in binder_alloc_buf()
678 proc->free_async_space < size + sizeof(struct binder_buffer)) { in binder_alloc_buf()
681 proc->pid, size); in binder_alloc_buf()
688 buffer_size = binder_buffer_size(proc, buffer); in binder_alloc_buf()
702 proc->pid, size); in binder_alloc_buf()
707 buffer_size = binder_buffer_size(proc, buffer); in binder_alloc_buf()
712 proc->pid, size, buffer, buffer_size); in binder_alloc_buf()
726 if (binder_update_page_range(proc, 1, in binder_alloc_buf()
730 rb_erase(best_fit, &proc->free_buffers); in binder_alloc_buf()
732 binder_insert_allocated_buffer(proc, buffer); in binder_alloc_buf()
738 binder_insert_free_buffer(proc, new_buffer); in binder_alloc_buf()
742 proc->pid, size, buffer); in binder_alloc_buf()
747 proc->free_async_space -= size + sizeof(struct binder_buffer); in binder_alloc_buf()
750 proc->pid, size, proc->free_async_space); in binder_alloc_buf()
766 static void binder_delete_free_buffer(struct binder_proc *proc, in binder_delete_free_buffer() argument
773 BUG_ON(proc->buffers.next == &buffer->entry); in binder_delete_free_buffer()
782 proc->pid, buffer, prev); in binder_delete_free_buffer()
785 if (!list_is_last(&buffer->entry, &proc->buffers)) { in binder_delete_free_buffer()
795 proc->pid, buffer, prev); in binder_delete_free_buffer()
802 proc->pid, buffer, free_page_start ? "" : " end", in binder_delete_free_buffer()
804 binder_update_page_range(proc, 0, free_page_start ? in binder_delete_free_buffer()
811 static void binder_free_buf(struct binder_proc *proc, in binder_free_buf() argument
816 buffer_size = binder_buffer_size(proc, buffer); in binder_free_buf()
823 proc->pid, buffer, size, buffer_size); in binder_free_buf()
828 BUG_ON((void *)buffer < proc->buffer); in binder_free_buf()
829 BUG_ON((void *)buffer > proc->buffer + proc->buffer_size); in binder_free_buf()
832 proc->free_async_space += size + sizeof(struct binder_buffer); in binder_free_buf()
836 proc->pid, size, proc->free_async_space); in binder_free_buf()
839 binder_update_page_range(proc, 0, in binder_free_buf()
843 rb_erase(&buffer->rb_node, &proc->allocated_buffers); in binder_free_buf()
845 if (!list_is_last(&buffer->entry, &proc->buffers)) { in binder_free_buf()
850 rb_erase(&next->rb_node, &proc->free_buffers); in binder_free_buf()
851 binder_delete_free_buffer(proc, next); in binder_free_buf()
854 if (proc->buffers.next != &buffer->entry) { in binder_free_buf()
859 binder_delete_free_buffer(proc, buffer); in binder_free_buf()
860 rb_erase(&prev->rb_node, &proc->free_buffers); in binder_free_buf()
864 binder_insert_free_buffer(proc, buffer); in binder_free_buf()
867 static struct binder_node *binder_get_node(struct binder_proc *proc, in binder_get_node() argument
870 struct rb_node *n = proc->nodes.rb_node; in binder_get_node()
886 static struct binder_node *binder_new_node(struct binder_proc *proc, in binder_new_node() argument
890 struct rb_node **p = &proc->nodes.rb_node; in binder_new_node()
911 rb_insert_color(&node->rb_node, &proc->nodes); in binder_new_node()
913 node->proc = proc; in binder_new_node()
921 proc->pid, current->pid, node->debug_id, in binder_new_node()
976 if (node->proc && (node->has_strong_ref || node->has_weak_ref)) { in binder_dec_node()
978 list_add_tail(&node->work.entry, &node->proc->todo); in binder_dec_node()
979 wake_up_interruptible(&node->proc->wait); in binder_dec_node()
985 if (node->proc) { in binder_dec_node()
986 rb_erase(&node->rb_node, &node->proc->nodes); in binder_dec_node()
1005 static struct binder_ref *binder_get_ref(struct binder_proc *proc, in binder_get_ref() argument
1008 struct rb_node *n = proc->refs_by_desc.rb_node; in binder_get_ref()
1024 static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc, in binder_get_ref_for_node() argument
1028 struct rb_node **p = &proc->refs_by_node.rb_node; in binder_get_ref_for_node()
1048 new_ref->proc = proc; in binder_get_ref_for_node()
1051 rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); in binder_get_ref_for_node()
1054 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in binder_get_ref_for_node()
1061 p = &proc->refs_by_desc.rb_node; in binder_get_ref_for_node()
1074 rb_insert_color(&new_ref->rb_node_desc, &proc->refs_by_desc); in binder_get_ref_for_node()
1080 proc->pid, new_ref->debug_id, new_ref->desc, in binder_get_ref_for_node()
1085 proc->pid, new_ref->debug_id, new_ref->desc); in binder_get_ref_for_node()
1094 ref->proc->pid, ref->debug_id, ref->desc, in binder_delete_ref()
1097 rb_erase(&ref->rb_node_desc, &ref->proc->refs_by_desc); in binder_delete_ref()
1098 rb_erase(&ref->rb_node_node, &ref->proc->refs_by_node); in binder_delete_ref()
1106 ref->proc->pid, ref->debug_id, ref->desc); in binder_delete_ref()
1144 ref->proc->pid, ref->debug_id, in binder_dec_ref()
1159 ref->proc->pid, ref->debug_id, in binder_dec_ref()
1207 target_thread->proc->pid, in binder_send_failed_reply()
1215 target_thread->proc->pid, in binder_send_failed_reply()
1240 static void binder_transaction_buffer_release(struct binder_proc *proc, in binder_transaction_buffer_release() argument
1249 proc->pid, buffer->debug_id, in binder_transaction_buffer_release()
1275 struct binder_node *node = binder_get_node(proc, fp->binder); in binder_transaction_buffer_release()
1289 struct binder_ref *ref = binder_get_ref(proc, fp->handle); in binder_transaction_buffer_release()
1306 task_close_fd(proc, fp->handle); in binder_transaction_buffer_release()
1317 static void binder_transaction(struct binder_proc *proc, in binder_transaction() argument
1335 e->from_proc = proc->pid; in binder_transaction()
1345 proc->pid, thread->pid); in binder_transaction()
1352 proc->pid, thread->pid, in_reply_to->debug_id, in binder_transaction()
1369 proc->pid, thread->pid, in binder_transaction()
1378 target_proc = target_thread->proc; in binder_transaction()
1383 ref = binder_get_ref(proc, tr->target.handle); in binder_transaction()
1386 proc->pid, thread->pid); in binder_transaction()
1399 target_proc = target_node->proc; in binder_transaction()
1404 if (security_binder_transaction(proc->tsk, in binder_transaction()
1415 proc->pid, thread->pid, tmp->debug_id, in binder_transaction()
1423 if (tmp->from && tmp->from->proc == target_proc) 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()
1478 t->sender_euid = task_euid(proc->tsk); 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()
1541 struct binder_node *node = binder_get_node(proc, fp->binder); in binder_transaction()
1544 node = binder_new_node(proc, fp->binder, fp->cookie); in binder_transaction()
1554 proc->pid, thread->pid, in binder_transaction()
1560 if (security_binder_transfer_binder(proc->tsk, in binder_transaction()
1586 struct binder_ref *ref = binder_get_ref(proc, fp->handle); in binder_transaction()
1590 proc->pid, in binder_transaction()
1595 if (security_binder_transfer_binder(proc->tsk, in binder_transaction()
1600 if (ref->node->proc == target_proc) { 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()
1657 if (security_binder_transfer_file(proc->tsk, in binder_transaction()
1680 proc->pid, thread->pid, fp->type); in binder_transaction()
1737 proc->pid, thread->pid, return_error, in binder_transaction()
1755 static int binder_thread_write(struct binder_proc *proc, in binder_thread_write() argument
1772 proc->stats.bc[_IOC_NR(cmd)]++; in binder_thread_write()
1789 ref = binder_get_ref_for_node(proc, in binder_thread_write()
1793 proc->pid, thread->pid, in binder_thread_write()
1797 ref = binder_get_ref(proc, target); 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()
1840 node = binder_get_node(proc, node_ptr); 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()
1899 buffer = binder_buffer_lookup(proc, data_ptr); 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()
1928 binder_transaction_buffer_release(proc, buffer, NULL); in binder_thread_write()
1929 binder_free_buf(proc, buffer); 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()
1951 proc->pid, thread->pid); in binder_thread_write()
1952 } else if (proc->requested_threads == 0) { in binder_thread_write()
1955 proc->pid, thread->pid); in binder_thread_write()
1957 proc->requested_threads--; in binder_thread_write()
1958 proc->requested_threads_started++; in binder_thread_write()
1965 proc->pid, thread->pid); in binder_thread_write()
1969 proc->pid, thread->pid); in binder_thread_write()
1976 proc->pid, thread->pid); in binder_thread_write()
1993 ref = binder_get_ref(proc, target); 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()
2024 proc->pid, thread->pid); in binder_thread_write()
2031 if (ref->node->proc == NULL) { in binder_thread_write()
2036 list_add_tail(&ref->death->work.entry, &proc->todo); in binder_thread_write()
2037 wake_up_interruptible(&proc->wait); in binder_thread_write()
2043 proc->pid, thread->pid); in binder_thread_write()
2049 proc->pid, thread->pid, in binder_thread_write()
2060 list_add_tail(&death->work.entry, &proc->todo); in binder_thread_write()
2061 wake_up_interruptible(&proc->wait); in binder_thread_write()
2078 list_for_each_entry(w, &proc->delivered_death, entry) { 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()
2102 list_add_tail(&death->work.entry, &proc->todo); in binder_thread_write()
2103 wake_up_interruptible(&proc->wait); in binder_thread_write()
2110 proc->pid, thread->pid, cmd); in binder_thread_write()
2118 static void binder_stat_br(struct binder_proc *proc, in binder_stat_br() argument
2124 proc->stats.br[_IOC_NR(cmd)]++; in binder_stat_br()
2129 static int binder_has_proc_work(struct binder_proc *proc, in binder_has_proc_work() argument
2132 return !list_empty(&proc->todo) || in binder_has_proc_work()
2142 static int binder_thread_read(struct binder_proc *proc, in binder_thread_read() argument
2169 binder_stat_br(proc, thread, thread->return_error2); in binder_thread_read()
2177 binder_stat_br(proc, thread, thread->return_error); in binder_thread_read()
2185 proc->ready_threads++; in binder_thread_read()
2196 proc->pid, thread->pid, thread->looper); in binder_thread_read()
2200 binder_set_nice(proc->default_priority); 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()
2217 proc->ready_threads--; in binder_thread_read()
2232 } else if (!list_empty(&proc->todo) && wait_for_proc_work) { in binder_thread_read()
2233 w = list_first_entry(&proc->todo, struct binder_work, 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()
2321 rb_erase(&node->rb_node, &proc->nodes); 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()
2366 list_move(&w->entry, &proc->delivered_death); in binder_thread_read()
2399 struct task_struct *sender = t->from->proc->tsk; in binder_thread_read()
2411 proc->user_buffer_offset); in binder_thread_read()
2424 binder_stat_br(proc, thread, cmd); in binder_thread_read()
2427 proc->pid, thread->pid, in binder_thread_read()
2430 t->debug_id, t->from ? t->from->proc->pid : 0, in binder_thread_read()
2452 if (proc->requested_threads + proc->ready_threads == 0 && in binder_thread_read()
2453 proc->requested_threads_started < proc->max_threads && in binder_thread_read()
2457 proc->requested_threads++; 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()
2518 static struct binder_thread *binder_get_thread(struct binder_proc *proc) in binder_get_thread() argument
2522 struct rb_node **p = &proc->threads.rb_node; in binder_get_thread()
2540 thread->proc = proc; in binder_get_thread()
2545 rb_insert_color(&thread->rb_node, &proc->threads); in binder_get_thread()
2553 static int binder_free_thread(struct binder_proc *proc, in binder_free_thread() argument
2560 rb_erase(&thread->rb_node, &proc->threads); in binder_free_thread()
2568 proc->pid, thread->pid, in binder_free_thread()
2597 struct binder_proc *proc = filp->private_data; in binder_poll() local
2603 thread = binder_get_thread(proc); in binder_poll()
2611 if (binder_has_proc_work(proc, thread)) in binder_poll()
2613 poll_wait(filp, &proc->wait, wait); in binder_poll()
2614 if (binder_has_proc_work(proc, thread)) in binder_poll()
2631 struct binder_proc *proc = filp->private_data; in binder_ioctl_write_read() local
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()
2669 if (!list_empty(&proc->todo)) in binder_ioctl_write_read()
2670 wake_up_interruptible(&proc->wait); in binder_ioctl_write_read()
2679 proc->pid, thread->pid, in binder_ioctl_write_read()
2693 struct binder_proc *proc = filp->private_data; in binder_ioctl_set_ctx_mgr() local
2701 ret = security_binder_set_context_mgr(proc->tsk); in binder_ioctl_set_ctx_mgr()
2716 binder_context_mgr_node = binder_new_node(proc, 0, 0); in binder_ioctl_set_ctx_mgr()
2732 struct binder_proc *proc = filp->private_data; in binder_ioctl() local
2747 thread = binder_get_thread(proc); in binder_ioctl()
2760 if (copy_from_user(&proc->max_threads, ubuf, sizeof(proc->max_threads))) { in binder_ioctl()
2772 proc->pid, thread->pid); in binder_ioctl()
2773 binder_free_thread(proc, thread); in binder_ioctl()
2801 pr_info("%d:%d ioctl %x %lx returned %d\n", proc->pid, current->pid, cmd, arg, ret); in binder_ioctl()
2809 struct binder_proc *proc = vma->vm_private_data; in binder_vma_open() local
2813 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_open()
2820 struct binder_proc *proc = vma->vm_private_data; in binder_vma_close() local
2824 proc->pid, vma->vm_start, vma->vm_end, in binder_vma_close()
2827 proc->vma = NULL; in binder_vma_close()
2828 proc->vma_vm_mm = NULL; in binder_vma_close()
2829 binder_defer_work(proc, BINDER_DEFERRED_PUT_FILES); in binder_vma_close()
2847 struct binder_proc *proc = filp->private_data; in binder_mmap() local
2851 if (proc->tsk != current) in binder_mmap()
2859 proc->pid, vma->vm_start, vma->vm_end, in binder_mmap()
2871 if (proc->buffer) { in binder_mmap()
2883 proc->buffer = area->addr; in binder_mmap()
2884 proc->user_buffer_offset = vma->vm_start - (uintptr_t)proc->buffer; in binder_mmap()
2889 while (CACHE_COLOUR((vma->vm_start ^ (uint32_t)proc->buffer))) { in binder_mmap()
2890 …nfo("binder_mmap: %d %lx-%lx maps %p bad alignment\n", proc->pid, vma->vm_start, vma->vm_end, proc… in binder_mmap()
2895 …proc->pages = kzalloc(sizeof(proc->pages[0]) * ((vma->vm_end - vma->vm_start) / PAGE_SIZE), GFP_KE… in binder_mmap()
2896 if (proc->pages == NULL) { in binder_mmap()
2901 proc->buffer_size = vma->vm_end - vma->vm_start; in binder_mmap()
2904 vma->vm_private_data = proc; in binder_mmap()
2906 if (binder_update_page_range(proc, 1, proc->buffer, proc->buffer + PAGE_SIZE, vma)) { in binder_mmap()
2911 buffer = proc->buffer; in binder_mmap()
2912 INIT_LIST_HEAD(&proc->buffers); in binder_mmap()
2913 list_add(&buffer->entry, &proc->buffers); in binder_mmap()
2915 binder_insert_free_buffer(proc, buffer); in binder_mmap()
2916 proc->free_async_space = proc->buffer_size / 2; in binder_mmap()
2918 proc->files = get_files_struct(current); in binder_mmap()
2919 proc->vma = vma; in binder_mmap()
2920 proc->vma_vm_mm = vma->vm_mm; in binder_mmap()
2927 kfree(proc->pages); in binder_mmap()
2928 proc->pages = NULL; in binder_mmap()
2931 vfree(proc->buffer); in binder_mmap()
2932 proc->buffer = NULL; in binder_mmap()
2938 proc->pid, vma->vm_start, vma->vm_end, failure_string, ret); in binder_mmap()
2944 struct binder_proc *proc; in binder_open() local
2949 proc = kzalloc(sizeof(*proc), GFP_KERNEL); in binder_open()
2950 if (proc == NULL) in binder_open()
2953 proc->tsk = current; in binder_open()
2954 INIT_LIST_HEAD(&proc->todo); in binder_open()
2955 init_waitqueue_head(&proc->wait); in binder_open()
2956 proc->default_priority = task_nice(current); in binder_open()
2961 hlist_add_head(&proc->proc_node, &binder_procs); in binder_open()
2962 proc->pid = current->group_leader->pid; in binder_open()
2963 INIT_LIST_HEAD(&proc->delivered_death); in binder_open()
2964 filp->private_data = proc; in binder_open()
2971 snprintf(strbuf, sizeof(strbuf), "%u", proc->pid); in binder_open()
2972 proc->debugfs_entry = debugfs_create_file(strbuf, S_IRUGO, in binder_open()
2973 binder_debugfs_dir_entry_proc, proc, &binder_proc_fops); in binder_open()
2981 struct binder_proc *proc = filp->private_data; in binder_flush() local
2983 binder_defer_work(proc, BINDER_DEFERRED_FLUSH); in binder_flush()
2988 static void binder_deferred_flush(struct binder_proc *proc) in binder_deferred_flush() argument
2993 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) { in binder_deferred_flush()
3002 wake_up_interruptible_all(&proc->wait); in binder_deferred_flush()
3005 "binder_flush: %d woke %d threads\n", proc->pid, in binder_deferred_flush()
3011 struct binder_proc *proc = filp->private_data; in binder_release() local
3013 debugfs_remove(proc->debugfs_entry); in binder_release()
3014 binder_defer_work(proc, BINDER_DEFERRED_RELEASE); in binder_release()
3034 node->proc = NULL; in binder_node_release()
3050 &ref->proc->todo); in binder_node_release()
3051 wake_up_interruptible(&ref->proc->wait); in binder_node_release()
3063 static void binder_deferred_release(struct binder_proc *proc) in binder_deferred_release() argument
3070 BUG_ON(proc->vma); in binder_deferred_release()
3071 BUG_ON(proc->files); in binder_deferred_release()
3073 hlist_del(&proc->proc_node); in binder_deferred_release()
3075 if (binder_context_mgr_node && binder_context_mgr_node->proc == proc) { in binder_deferred_release()
3078 __func__, proc->pid); in binder_deferred_release()
3084 while ((n = rb_first(&proc->threads))) { in binder_deferred_release()
3089 active_transactions += binder_free_thread(proc, thread); in binder_deferred_release()
3094 while ((n = rb_first(&proc->nodes))) { in binder_deferred_release()
3099 rb_erase(&node->rb_node, &proc->nodes); in binder_deferred_release()
3104 while ((n = rb_first(&proc->refs_by_desc))) { in binder_deferred_release()
3112 binder_release_work(&proc->todo); in binder_deferred_release()
3113 binder_release_work(&proc->delivered_death); in binder_deferred_release()
3116 while ((n = rb_first(&proc->allocated_buffers))) { in binder_deferred_release()
3126 proc->pid, t->debug_id); in binder_deferred_release()
3130 binder_free_buf(proc, buffer); in binder_deferred_release()
3137 if (proc->pages) { in binder_deferred_release()
3140 for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) { in binder_deferred_release()
3143 if (!proc->pages[i]) in binder_deferred_release()
3146 page_addr = proc->buffer + i * PAGE_SIZE; in binder_deferred_release()
3149 __func__, proc->pid, i, page_addr); in binder_deferred_release()
3151 __free_page(proc->pages[i]); in binder_deferred_release()
3154 kfree(proc->pages); in binder_deferred_release()
3155 vfree(proc->buffer); in binder_deferred_release()
3158 put_task_struct(proc->tsk); in binder_deferred_release()
3162 __func__, proc->pid, threads, nodes, incoming_refs, in binder_deferred_release()
3165 kfree(proc); in binder_deferred_release()
3170 struct binder_proc *proc; in binder_deferred_func() local
3179 proc = hlist_entry(binder_deferred_list.first, in binder_deferred_func()
3181 hlist_del_init(&proc->deferred_work_node); in binder_deferred_func()
3182 defer = proc->deferred_work; in binder_deferred_func()
3183 proc->deferred_work = 0; in binder_deferred_func()
3185 proc = NULL; in binder_deferred_func()
3192 files = proc->files; in binder_deferred_func()
3194 proc->files = NULL; in binder_deferred_func()
3198 binder_deferred_flush(proc); in binder_deferred_func()
3201 binder_deferred_release(proc); /* frees proc */ in binder_deferred_func()
3206 } while (proc); in binder_deferred_func()
3211 binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer) in binder_defer_work() argument
3214 proc->deferred_work |= defer; in binder_defer_work()
3215 if (hlist_unhashed(&proc->deferred_work_node)) { in binder_defer_work()
3216 hlist_add_head(&proc->deferred_work_node, in binder_defer_work()
3229 t->from ? t->from->proc->pid : 0, in print_binder_transaction()
3342 seq_printf(m, " %d", ref->proc->pid); in print_binder_node()
3353 ref->debug_id, ref->desc, ref->node->proc ? "" : "dead ", in print_binder_ref()
3358 struct binder_proc *proc, int print_all) in print_binder_proc() argument
3365 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc()
3368 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc()
3371 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) { in print_binder_proc()
3378 for (n = rb_first(&proc->refs_by_desc); in print_binder_proc()
3384 for (n = rb_first(&proc->allocated_buffers); n != NULL; n = rb_next(n)) in print_binder_proc()
3387 list_for_each_entry(w, &proc->todo, entry) in print_binder_proc()
3389 list_for_each_entry(w, &proc->delivered_death, entry) { in print_binder_proc()
3483 struct binder_proc *proc) in print_binder_proc_stats() argument
3489 seq_printf(m, "proc %d\n", proc->pid); in print_binder_proc_stats()
3491 for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
3496 " free async space %zd\n", proc->requested_threads, in print_binder_proc_stats()
3497 proc->requested_threads_started, proc->max_threads, in print_binder_proc_stats()
3498 proc->ready_threads, proc->free_async_space); in print_binder_proc_stats()
3500 for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
3506 for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { in print_binder_proc_stats()
3516 for (n = rb_first(&proc->allocated_buffers); n != NULL; n = rb_next(n)) in print_binder_proc_stats()
3521 list_for_each_entry(w, &proc->todo, entry) { in print_binder_proc_stats()
3532 print_binder_stats(m, " ", &proc->stats); in print_binder_proc_stats()
3538 struct binder_proc *proc; in binder_state_show() local
3552 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_state_show()
3553 print_binder_proc(m, proc, 1); in binder_state_show()
3561 struct binder_proc *proc; in binder_stats_show() local
3571 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_stats_show()
3572 print_binder_proc_stats(m, proc); in binder_stats_show()
3580 struct binder_proc *proc; in binder_transactions_show() local
3587 hlist_for_each_entry(proc, &binder_procs, proc_node) in binder_transactions_show()
3588 print_binder_proc(m, proc, 0); in binder_transactions_show()
3596 struct binder_proc *proc = m->private; in binder_proc_show() local
3602 print_binder_proc(m, proc, 1); in binder_proc_show()