aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2013-05-09 01:44:41 -0400
committerSteven Rostedt <rostedt@goodmis.org>2013-05-09 20:19:48 -0400
commit2b106aabe6c566ba19c352f22683381e1ea41326 (patch)
treeb97934b7082be136b32e84cd5eb22d2296168878 /kernel
parent48182bd2261766b810e4e4269a23236c1ace63fb (diff)
tracing/kprobes: Pass trace_probe directly from dispatcher
Pass the pointer of struct trace_probe directly from probe dispatcher to handlers. This removes redundant container_of macro uses. Same thing has already done in trace_uprobe. Link: http://lkml.kernel.org/r/20130509054441.30398.69112.stgit@mhiramat-M0-7522 Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Tom Zanussi <tom.zanussi@intel.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com> Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_kprobe.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 6e86fbbae337..9ca44fc3fb0b 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -723,9 +723,9 @@ static __kprobes void store_trace_args(int ent_size, struct trace_probe *tp,
723} 723}
724 724
725/* Kprobe handler */ 725/* Kprobe handler */
726static __kprobes void kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs) 726static __kprobes void
727kprobe_trace_func(struct trace_probe *tp, struct pt_regs *regs)
727{ 728{
728 struct trace_probe *tp = container_of(kp, struct trace_probe, rp.kp);
729 struct kprobe_trace_entry_head *entry; 729 struct kprobe_trace_entry_head *entry;
730 struct ring_buffer_event *event; 730 struct ring_buffer_event *event;
731 struct ring_buffer *buffer; 731 struct ring_buffer *buffer;
@@ -745,7 +745,7 @@ static __kprobes void kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
745 return; 745 return;
746 746
747 entry = ring_buffer_event_data(event); 747 entry = ring_buffer_event_data(event);
748 entry->ip = (unsigned long)kp->addr; 748 entry->ip = (unsigned long)tp->rp.kp.addr;
749 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize); 749 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize);
750 750
751 if (!filter_current_check_discard(buffer, call, entry, event)) 751 if (!filter_current_check_discard(buffer, call, entry, event))
@@ -754,10 +754,10 @@ static __kprobes void kprobe_trace_func(struct kprobe *kp, struct pt_regs *regs)
754} 754}
755 755
756/* Kretprobe handler */ 756/* Kretprobe handler */
757static __kprobes void kretprobe_trace_func(struct kretprobe_instance *ri, 757static __kprobes void
758 struct pt_regs *regs) 758kretprobe_trace_func(struct trace_probe *tp, struct kretprobe_instance *ri,
759 struct pt_regs *regs)
759{ 760{
760 struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
761 struct kretprobe_trace_entry_head *entry; 761 struct kretprobe_trace_entry_head *entry;
762 struct ring_buffer_event *event; 762 struct ring_buffer_event *event;
763 struct ring_buffer *buffer; 763 struct ring_buffer *buffer;
@@ -973,10 +973,9 @@ static int set_print_fmt(struct trace_probe *tp)
973#ifdef CONFIG_PERF_EVENTS 973#ifdef CONFIG_PERF_EVENTS
974 974
975/* Kprobe profile handler */ 975/* Kprobe profile handler */
976static __kprobes void kprobe_perf_func(struct kprobe *kp, 976static __kprobes void
977 struct pt_regs *regs) 977kprobe_perf_func(struct trace_probe *tp, struct pt_regs *regs)
978{ 978{
979 struct trace_probe *tp = container_of(kp, struct trace_probe, rp.kp);
980 struct ftrace_event_call *call = &tp->call; 979 struct ftrace_event_call *call = &tp->call;
981 struct kprobe_trace_entry_head *entry; 980 struct kprobe_trace_entry_head *entry;
982 struct hlist_head *head; 981 struct hlist_head *head;
@@ -995,7 +994,7 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
995 if (!entry) 994 if (!entry)
996 return; 995 return;
997 996
998 entry->ip = (unsigned long)kp->addr; 997 entry->ip = (unsigned long)tp->rp.kp.addr;
999 memset(&entry[1], 0, dsize); 998 memset(&entry[1], 0, dsize);
1000 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize); 999 store_trace_args(sizeof(*entry), tp, regs, (u8 *)&entry[1], dsize);
1001 1000
@@ -1005,10 +1004,10 @@ static __kprobes void kprobe_perf_func(struct kprobe *kp,
1005} 1004}
1006 1005
1007/* Kretprobe profile handler */ 1006/* Kretprobe profile handler */
1008static __kprobes void kretprobe_perf_func(struct kretprobe_instance *ri, 1007static __kprobes void
1009 struct pt_regs *regs) 1008kretprobe_perf_func(struct trace_probe *tp, struct kretprobe_instance *ri,
1009 struct pt_regs *regs)
1010{ 1010{
1011 struct trace_probe *tp = container_of(ri->rp, struct trace_probe, rp);
1012 struct ftrace_event_call *call = &tp->call; 1011 struct ftrace_event_call *call = &tp->call;
1013 struct kretprobe_trace_entry_head *entry; 1012 struct kretprobe_trace_entry_head *entry;
1014 struct hlist_head *head; 1013 struct hlist_head *head;
@@ -1074,10 +1073,10 @@ int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs)
1074 tp->nhit++; 1073 tp->nhit++;
1075 1074
1076 if (tp->flags & TP_FLAG_TRACE) 1075 if (tp->flags & TP_FLAG_TRACE)
1077 kprobe_trace_func(kp, regs); 1076 kprobe_trace_func(tp, regs);
1078#ifdef CONFIG_PERF_EVENTS 1077#ifdef CONFIG_PERF_EVENTS
1079 if (tp->flags & TP_FLAG_PROFILE) 1078 if (tp->flags & TP_FLAG_PROFILE)
1080 kprobe_perf_func(kp, regs); 1079 kprobe_perf_func(tp, regs);
1081#endif 1080#endif
1082 return 0; /* We don't tweek kernel, so just return 0 */ 1081 return 0; /* We don't tweek kernel, so just return 0 */
1083} 1082}
@@ -1090,10 +1089,10 @@ int kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
1090 tp->nhit++; 1089 tp->nhit++;
1091 1090
1092 if (tp->flags & TP_FLAG_TRACE) 1091 if (tp->flags & TP_FLAG_TRACE)
1093 kretprobe_trace_func(ri, regs); 1092 kretprobe_trace_func(tp, ri, regs);
1094#ifdef CONFIG_PERF_EVENTS 1093#ifdef CONFIG_PERF_EVENTS
1095 if (tp->flags & TP_FLAG_PROFILE) 1094 if (tp->flags & TP_FLAG_PROFILE)
1096 kretprobe_perf_func(ri, regs); 1095 kretprobe_perf_func(tp, ri, regs);
1097#endif 1096#endif
1098 return 0; /* We don't tweek kernel, so just return 0 */ 1097 return 0; /* We don't tweek kernel, so just return 0 */
1099} 1098}