Commit b55ce203 authored by Masami Hiramatsu's avatar Masami Hiramatsu Committed by Steven Rostedt (VMware)

tracing/probe: Add probe event name and group name accesses APIs

Add trace_probe_name() and trace_probe_group_name() functions
for accessing probe name and group name of trace_probe.

Link: http://lkml.kernel.org/r/155931586717.28323.8738615064952254761.stgit@devnote2Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 747774d6
...@@ -142,8 +142,8 @@ static bool trace_kprobe_match(const char *system, const char *event, ...@@ -142,8 +142,8 @@ static bool trace_kprobe_match(const char *system, const char *event,
{ {
struct trace_kprobe *tk = to_trace_kprobe(ev); struct trace_kprobe *tk = to_trace_kprobe(ev);
return strcmp(trace_event_name(&tk->tp.call), event) == 0 && return strcmp(trace_probe_name(&tk->tp), event) == 0 &&
(!system || strcmp(tk->tp.call.class->system, system) == 0); (!system || strcmp(trace_probe_group_name(&tk->tp), system) == 0);
} }
static nokprobe_inline unsigned long trace_kprobe_nhit(struct trace_kprobe *tk) static nokprobe_inline unsigned long trace_kprobe_nhit(struct trace_kprobe *tk)
...@@ -263,8 +263,8 @@ static struct trace_kprobe *find_trace_kprobe(const char *event, ...@@ -263,8 +263,8 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,
struct trace_kprobe *tk; struct trace_kprobe *tk;
for_each_trace_kprobe(tk, pos) for_each_trace_kprobe(tk, pos)
if (strcmp(trace_event_name(&tk->tp.call), event) == 0 && if (strcmp(trace_probe_name(&tk->tp), event) == 0 &&
strcmp(tk->tp.call.class->system, group) == 0) strcmp(trace_probe_group_name(&tk->tp), group) == 0)
return tk; return tk;
return NULL; return NULL;
} }
...@@ -453,8 +453,8 @@ static int register_trace_kprobe(struct trace_kprobe *tk) ...@@ -453,8 +453,8 @@ static int register_trace_kprobe(struct trace_kprobe *tk)
mutex_lock(&event_mutex); mutex_lock(&event_mutex);
/* Delete old (same name) event if exist */ /* Delete old (same name) event if exist */
old_tk = find_trace_kprobe(trace_event_name(&tk->tp.call), old_tk = find_trace_kprobe(trace_probe_name(&tk->tp),
tk->tp.call.class->system); trace_probe_group_name(&tk->tp));
if (old_tk) { if (old_tk) {
ret = unregister_trace_kprobe(old_tk); ret = unregister_trace_kprobe(old_tk);
if (ret < 0) if (ret < 0)
...@@ -507,7 +507,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb, ...@@ -507,7 +507,7 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,
ret = __register_trace_kprobe(tk); ret = __register_trace_kprobe(tk);
if (ret) if (ret)
pr_warn("Failed to re-register probe %s on %s: %d\n", pr_warn("Failed to re-register probe %s on %s: %d\n",
trace_event_name(&tk->tp.call), trace_probe_name(&tk->tp),
mod->name, ret); mod->name, ret);
} }
} }
...@@ -737,8 +737,8 @@ static int trace_kprobe_show(struct seq_file *m, struct dyn_event *ev) ...@@ -737,8 +737,8 @@ static int trace_kprobe_show(struct seq_file *m, struct dyn_event *ev)
int i; int i;
seq_putc(m, trace_kprobe_is_return(tk) ? 'r' : 'p'); seq_putc(m, trace_kprobe_is_return(tk) ? 'r' : 'p');
seq_printf(m, ":%s/%s", tk->tp.call.class->system, seq_printf(m, ":%s/%s", trace_probe_group_name(&tk->tp),
trace_event_name(&tk->tp.call)); trace_probe_name(&tk->tp));
if (!tk->symbol) if (!tk->symbol)
seq_printf(m, " 0x%p", tk->rp.kp.addr); seq_printf(m, " 0x%p", tk->rp.kp.addr);
...@@ -812,7 +812,7 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) ...@@ -812,7 +812,7 @@ static int probes_profile_seq_show(struct seq_file *m, void *v)
tk = to_trace_kprobe(ev); tk = to_trace_kprobe(ev);
seq_printf(m, " %-44s %15lu %15lu\n", seq_printf(m, " %-44s %15lu %15lu\n",
trace_event_name(&tk->tp.call), trace_probe_name(&tk->tp),
trace_kprobe_nhit(tk), trace_kprobe_nhit(tk),
tk->rp.kp.nmissed); tk->rp.kp.nmissed);
...@@ -1084,7 +1084,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags, ...@@ -1084,7 +1084,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
field = (struct kprobe_trace_entry_head *)iter->ent; field = (struct kprobe_trace_entry_head *)iter->ent;
tp = container_of(event, struct trace_probe, call.event); tp = container_of(event, struct trace_probe, call.event);
trace_seq_printf(s, "%s: (", trace_event_name(&tp->call)); trace_seq_printf(s, "%s: (", trace_probe_name(tp));
if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET)) if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
goto out; goto out;
...@@ -1111,7 +1111,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags, ...@@ -1111,7 +1111,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
field = (struct kretprobe_trace_entry_head *)iter->ent; field = (struct kretprobe_trace_entry_head *)iter->ent;
tp = container_of(event, struct trace_probe, call.event); tp = container_of(event, struct trace_probe, call.event);
trace_seq_printf(s, "%s: (", trace_event_name(&tp->call)); trace_seq_printf(s, "%s: (", trace_probe_name(tp));
if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET)) if (!seq_print_ip_sym(s, field->ret_ip, flags | TRACE_ITER_SYM_OFFSET))
goto out; goto out;
......
...@@ -266,6 +266,16 @@ static inline bool trace_probe_is_registered(struct trace_probe *tp) ...@@ -266,6 +266,16 @@ static inline bool trace_probe_is_registered(struct trace_probe *tp)
return trace_probe_test_flag(tp, TP_FLAG_REGISTERED); return trace_probe_test_flag(tp, TP_FLAG_REGISTERED);
} }
static inline const char *trace_probe_name(struct trace_probe *tp)
{
return trace_event_name(&tp->call);
}
static inline const char *trace_probe_group_name(struct trace_probe *tp)
{
return tp->call.class->system;
}
static inline int trace_probe_unregister_event_call(struct trace_probe *tp) static inline int trace_probe_unregister_event_call(struct trace_probe *tp)
{ {
/* tp->event is unregistered in trace_remove_event_call() */ /* tp->event is unregistered in trace_remove_event_call() */
......
...@@ -289,8 +289,8 @@ static bool trace_uprobe_match(const char *system, const char *event, ...@@ -289,8 +289,8 @@ static bool trace_uprobe_match(const char *system, const char *event,
{ {
struct trace_uprobe *tu = to_trace_uprobe(ev); struct trace_uprobe *tu = to_trace_uprobe(ev);
return strcmp(trace_event_name(&tu->tp.call), event) == 0 && return strcmp(trace_probe_name(&tu->tp), event) == 0 &&
(!system || strcmp(tu->tp.call.class->system, system) == 0); (!system || strcmp(trace_probe_group_name(&tu->tp), system) == 0);
} }
/* /*
...@@ -340,8 +340,8 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *grou ...@@ -340,8 +340,8 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *grou
struct trace_uprobe *tu; struct trace_uprobe *tu;
for_each_trace_uprobe(tu, pos) for_each_trace_uprobe(tu, pos)
if (strcmp(trace_event_name(&tu->tp.call), event) == 0 && if (strcmp(trace_probe_name(&tu->tp), event) == 0 &&
strcmp(tu->tp.call.class->system, group) == 0) strcmp(trace_probe_group_name(&tu->tp), group) == 0)
return tu; return tu;
return NULL; return NULL;
...@@ -376,8 +376,8 @@ static struct trace_uprobe *find_old_trace_uprobe(struct trace_uprobe *new) ...@@ -376,8 +376,8 @@ static struct trace_uprobe *find_old_trace_uprobe(struct trace_uprobe *new)
struct trace_uprobe *tmp, *old = NULL; struct trace_uprobe *tmp, *old = NULL;
struct inode *new_inode = d_real_inode(new->path.dentry); struct inode *new_inode = d_real_inode(new->path.dentry);
old = find_probe_event(trace_event_name(&new->tp.call), old = find_probe_event(trace_probe_name(&new->tp),
new->tp.call.class->system); trace_probe_group_name(&new->tp));
for_each_trace_uprobe(tmp, pos) { for_each_trace_uprobe(tmp, pos) {
if ((old ? old != tmp : true) && if ((old ? old != tmp : true) &&
...@@ -624,8 +624,8 @@ static int trace_uprobe_show(struct seq_file *m, struct dyn_event *ev) ...@@ -624,8 +624,8 @@ static int trace_uprobe_show(struct seq_file *m, struct dyn_event *ev)
char c = is_ret_probe(tu) ? 'r' : 'p'; char c = is_ret_probe(tu) ? 'r' : 'p';
int i; int i;
seq_printf(m, "%c:%s/%s %s:0x%0*lx", c, tu->tp.call.class->system, seq_printf(m, "%c:%s/%s %s:0x%0*lx", c, trace_probe_group_name(&tu->tp),
trace_event_name(&tu->tp.call), tu->filename, trace_probe_name(&tu->tp), tu->filename,
(int)(sizeof(void *) * 2), tu->offset); (int)(sizeof(void *) * 2), tu->offset);
if (tu->ref_ctr_offset) if (tu->ref_ctr_offset)
...@@ -695,7 +695,7 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) ...@@ -695,7 +695,7 @@ static int probes_profile_seq_show(struct seq_file *m, void *v)
tu = to_trace_uprobe(ev); tu = to_trace_uprobe(ev);
seq_printf(m, " %s %-44s %15lu\n", tu->filename, seq_printf(m, " %s %-44s %15lu\n", tu->filename,
trace_event_name(&tu->tp.call), tu->nhit); trace_probe_name(&tu->tp), tu->nhit);
return 0; return 0;
} }
...@@ -896,12 +896,12 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e ...@@ -896,12 +896,12 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
if (is_ret_probe(tu)) { if (is_ret_probe(tu)) {
trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)", trace_seq_printf(s, "%s: (0x%lx <- 0x%lx)",
trace_event_name(&tu->tp.call), trace_probe_name(&tu->tp),
entry->vaddr[1], entry->vaddr[0]); entry->vaddr[1], entry->vaddr[0]);
data = DATAOF_TRACE_ENTRY(entry, true); data = DATAOF_TRACE_ENTRY(entry, true);
} else { } else {
trace_seq_printf(s, "%s: (0x%lx)", trace_seq_printf(s, "%s: (0x%lx)",
trace_event_name(&tu->tp.call), trace_probe_name(&tu->tp),
entry->vaddr[0]); entry->vaddr[0]);
data = DATAOF_TRACE_ENTRY(entry, false); data = DATAOF_TRACE_ENTRY(entry, false);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment