aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_kprobe.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r--kernel/trace/trace_kprobe.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index f6821f16227e..09cba270392d 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -28,7 +28,7 @@
28#include <linux/string.h> 28#include <linux/string.h>
29#include <linux/ctype.h> 29#include <linux/ctype.h>
30#include <linux/ptrace.h> 30#include <linux/ptrace.h>
31#include <linux/perf_counter.h> 31#include <linux/perf_event.h>
32 32
33#include "trace.h" 33#include "trace.h"
34#include "trace_output.h" 34#include "trace_output.h"
@@ -1176,7 +1176,7 @@ static __kprobes int kprobe_profile_func(struct kprobe *kp,
1176 entry->ip = (unsigned long)kp->addr; 1176 entry->ip = (unsigned long)kp->addr;
1177 for (i = 0; i < tp->nr_args; i++) 1177 for (i = 0; i < tp->nr_args; i++)
1178 entry->args[i] = call_fetch(&tp->args[i].fetch, regs); 1178 entry->args[i] = call_fetch(&tp->args[i].fetch, regs);
1179 perf_tpcounter_event(call->id, entry->ip, 1, entry, size); 1179 perf_tp_event(call->id, entry->ip, 1, entry, size);
1180 } while (0); 1180 } while (0);
1181 return 0; 1181 return 0;
1182} 1182}
@@ -1213,7 +1213,7 @@ static __kprobes int kretprobe_profile_func(struct kretprobe_instance *ri,
1213 entry->ret_ip = (unsigned long)ri->ret_addr; 1213 entry->ret_ip = (unsigned long)ri->ret_addr;
1214 for (i = 0; i < tp->nr_args; i++) 1214 for (i = 0; i < tp->nr_args; i++)
1215 entry->args[i] = call_fetch(&tp->args[i].fetch, regs); 1215 entry->args[i] = call_fetch(&tp->args[i].fetch, regs);
1216 perf_tpcounter_event(call->id, entry->ret_ip, 1, entry, size); 1216 perf_tp_event(call->id, entry->ret_ip, 1, entry, size);
1217 } while (0); 1217 } while (0);
1218 return 0; 1218 return 0;
1219} 1219}
@@ -1222,10 +1222,8 @@ static int probe_profile_enable(struct ftrace_event_call *call)
1222{ 1222{
1223 struct trace_probe *tp = (struct trace_probe *)call->data; 1223 struct trace_probe *tp = (struct trace_probe *)call->data;
1224 1224
1225 if (atomic_inc_return(&call->profile_count))
1226 return 0;
1227
1228 tp->flags |= TP_FLAG_PROFILE; 1225 tp->flags |= TP_FLAG_PROFILE;
1226
1229 if (probe_is_return(tp)) 1227 if (probe_is_return(tp))
1230 return enable_kretprobe(&tp->rp); 1228 return enable_kretprobe(&tp->rp);
1231 else 1229 else
@@ -1236,10 +1234,9 @@ static void probe_profile_disable(struct ftrace_event_call *call)
1236{ 1234{
1237 struct trace_probe *tp = (struct trace_probe *)call->data; 1235 struct trace_probe *tp = (struct trace_probe *)call->data;
1238 1236
1239 if (atomic_add_negative(-1, &call->profile_count)) 1237 tp->flags &= ~TP_FLAG_PROFILE;
1240 tp->flags &= ~TP_FLAG_PROFILE;
1241 1238
1242 if (!(tp->flags & (TP_FLAG_TRACE | TP_FLAG_PROFILE))) { 1239 if (!(tp->flags & TP_FLAG_TRACE)) {
1243 if (probe_is_return(tp)) 1240 if (probe_is_return(tp))
1244 disable_kretprobe(&tp->rp); 1241 disable_kretprobe(&tp->rp);
1245 else 1242 else