mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
BACKPORT: android: binder: deal with contexts in debugfs.
Properly print the context in debugfs entries. Change-Id: Ieeb89bfa8e760635366ce8b60569fbbd4937b844 Signed-off-by: Martijn Coenen <maco@google.com>
This commit is contained in:
parent
672c9e5f01
commit
49be1ba87f
1 changed files with 23 additions and 13 deletions
|
@ -184,6 +184,7 @@ struct binder_transaction_log_entry {
|
|||
int to_node;
|
||||
int data_size;
|
||||
int offsets_size;
|
||||
const char *context_name;
|
||||
};
|
||||
struct binder_transaction_log {
|
||||
int next;
|
||||
|
@ -210,10 +211,12 @@ static struct binder_transaction_log_entry *binder_transaction_log_add(
|
|||
struct binder_context {
|
||||
struct binder_node *binder_context_mgr_node;
|
||||
uid_t binder_context_mgr_uid;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
static struct binder_context global_context = {
|
||||
.binder_context_mgr_uid = -1,
|
||||
.name = "binder",
|
||||
};
|
||||
|
||||
struct binder_work {
|
||||
|
@ -1487,6 +1490,7 @@ static void binder_transaction(struct binder_proc *proc,
|
|||
e->target_handle = tr->target.handle;
|
||||
e->data_size = tr->data_size;
|
||||
e->offsets_size = tr->offsets_size;
|
||||
e->context_name = proc->context->name;
|
||||
|
||||
if (reply) {
|
||||
in_reply_to = thread->transaction_stack;
|
||||
|
@ -3079,8 +3083,17 @@ static int binder_open(struct inode *nodp, struct file *filp)
|
|||
if (binder_debugfs_dir_entry_proc) {
|
||||
char strbuf[11];
|
||||
snprintf(strbuf, sizeof(strbuf), "%u", proc->pid);
|
||||
/*
|
||||
* proc debug entries are shared between contexts, so
|
||||
* this will fail if the process tries to open the driver
|
||||
* again with a different context. The priting code will
|
||||
* anyway print all contexts that a given PID has, so this
|
||||
* is not a problem.
|
||||
*/
|
||||
proc->debugfs_entry = debugfs_create_file(strbuf, S_IRUGO,
|
||||
binder_debugfs_dir_entry_proc, proc, &binder_proc_fops);
|
||||
binder_debugfs_dir_entry_proc,
|
||||
(void *)(unsigned long)proc->pid,
|
||||
&binder_proc_fops);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -3458,6 +3471,7 @@ static void print_binder_proc(struct seq_file *m,
|
|||
size_t header_pos;
|
||||
|
||||
seq_printf(m, "proc %d\n", proc->pid);
|
||||
seq_printf(m, "context %s\n", proc->context->name);
|
||||
header_pos = m->count;
|
||||
|
||||
for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n))
|
||||
|
@ -3582,6 +3596,7 @@ static void print_binder_proc_stats(struct seq_file *m,
|
|||
int count, strong, weak;
|
||||
|
||||
seq_printf(m, "proc %d\n", proc->pid);
|
||||
seq_printf(m, "context %s\n", proc->context->name);
|
||||
count = 0;
|
||||
for (n = rb_first(&proc->threads); n != NULL; n = rb_next(n))
|
||||
count++;
|
||||
|
@ -3692,24 +3707,19 @@ static int binder_transactions_show(struct seq_file *m, void *unused)
|
|||
static int binder_proc_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_proc *itr;
|
||||
struct binder_proc *proc = m->private;
|
||||
int pid = (unsigned long)m->private;
|
||||
struct hlist_node *pos;
|
||||
int do_lock = !binder_debug_no_lock;
|
||||
bool valid_proc = false;
|
||||
|
||||
if (do_lock)
|
||||
binder_lock(__func__);
|
||||
|
||||
hlist_for_each_entry(itr, pos, &binder_procs, proc_node) {
|
||||
if (itr == proc) {
|
||||
valid_proc = true;
|
||||
break;
|
||||
if (itr->pid == pid) {
|
||||
seq_puts(m, "binder proc state:\n");
|
||||
print_binder_proc(m, itr, 1);
|
||||
}
|
||||
}
|
||||
if (valid_proc) {
|
||||
seq_puts(m, "binder proc state:\n");
|
||||
print_binder_proc(m, proc, 1);
|
||||
}
|
||||
if (do_lock)
|
||||
binder_unlock(__func__);
|
||||
return 0;
|
||||
|
@ -3719,11 +3729,11 @@ static void print_binder_transaction_log_entry(struct seq_file *m,
|
|||
struct binder_transaction_log_entry *e)
|
||||
{
|
||||
seq_printf(m,
|
||||
"%d: %s from %d:%d to %d:%d node %d handle %d size %d:%d\n",
|
||||
"%d: %s from %d:%d to %d:%d context %s node %d handle %d size %d:%d\n",
|
||||
e->debug_id, (e->call_type == 2) ? "reply" :
|
||||
((e->call_type == 1) ? "async" : "call "), e->from_proc,
|
||||
e->from_thread, e->to_proc, e->to_thread, e->to_node,
|
||||
e->target_handle, e->data_size, e->offsets_size);
|
||||
e->from_thread, e->to_proc, e->to_thread, e->context_name,
|
||||
e->to_node, e->target_handle, e->data_size, e->offsets_size);
|
||||
}
|
||||
|
||||
static int binder_transaction_log_show(struct seq_file *m, void *unused)
|
||||
|
|
Loading…
Reference in a new issue