summaryrefslogtreecommitdiff
path: root/kernel/trace/trace_kprobe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@kernel.org>2019-05-31 18:17:37 +0300
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2019-07-16 22:14:47 +0300
commit747774d6b018ca02493fd3f321624dfce749da61 (patch)
treee0420b7753ec8668a09d7744daab7f4e53ae5122 /kernel/trace/trace_kprobe.c
parentb5f935ee133911b3ed2d4429dd86d2bd5385519d (diff)
downloadlinux-747774d6b018ca02493fd3f321624dfce749da61.tar.xz
tracing/probe: Add trace flag access APIs for trace_probe
Add trace_probe_test/set/clear_flag() functions for accessing trace_probe.flag field. This flags field should not be accessed directly. Link: http://lkml.kernel.org/r/155931585683.28323.314290023236905988.stgit@devnote2 Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_kprobe.c')
-rw-r--r--kernel/trace/trace_kprobe.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 87a52094378c..c3ab84cb25c8 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -298,7 +298,7 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
if (ret)
return ret;
} else
- tk->tp.flags |= TP_FLAG_PROFILE;
+ trace_probe_set_flag(&tk->tp, TP_FLAG_PROFILE);
if (enabled)
return 0;
@@ -308,7 +308,7 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
if (file)
trace_probe_remove_file(&tk->tp, file);
else
- tk->tp.flags &= ~TP_FLAG_PROFILE;
+ trace_probe_clear_flag(&tk->tp, TP_FLAG_PROFILE);
}
return ret;
@@ -329,9 +329,9 @@ disable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
return -ENOENT;
if (!trace_probe_has_single_file(tp))
goto out;
- tp->flags &= ~TP_FLAG_TRACE;
+ trace_probe_clear_flag(tp, TP_FLAG_TRACE);
} else
- tp->flags &= ~TP_FLAG_PROFILE;
+ trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
if (!trace_probe_is_enabled(tp) && trace_probe_is_registered(tp)) {
if (trace_kprobe_is_return(tk))
@@ -408,7 +408,7 @@ static int __register_trace_kprobe(struct trace_kprobe *tk)
ret = register_kprobe(&tk->rp.kp);
if (ret == 0)
- tk->tp.flags |= TP_FLAG_REGISTERED;
+ trace_probe_set_flag(&tk->tp, TP_FLAG_REGISTERED);
return ret;
}
@@ -420,7 +420,7 @@ static void __unregister_trace_kprobe(struct trace_kprobe *tk)
unregister_kretprobe(&tk->rp);
else
unregister_kprobe(&tk->rp.kp);
- tk->tp.flags &= ~TP_FLAG_REGISTERED;
+ trace_probe_clear_flag(&tk->tp, TP_FLAG_REGISTERED);
/* Cleanup kprobe for reuse */
if (tk->rp.kp.symbol_name)
tk->rp.kp.addr = NULL;
@@ -1313,10 +1313,10 @@ static int kprobe_dispatcher(struct kprobe *kp, struct pt_regs *regs)
raw_cpu_inc(*tk->nhit);
- if (tk->tp.flags & TP_FLAG_TRACE)
+ if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE))
kprobe_trace_func(tk, regs);
#ifdef CONFIG_PERF_EVENTS
- if (tk->tp.flags & TP_FLAG_PROFILE)
+ if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE))
ret = kprobe_perf_func(tk, regs);
#endif
return ret;
@@ -1330,10 +1330,10 @@ kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs)
raw_cpu_inc(*tk->nhit);
- if (tk->tp.flags & TP_FLAG_TRACE)
+ if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE))
kretprobe_trace_func(tk, ri, regs);
#ifdef CONFIG_PERF_EVENTS
- if (tk->tp.flags & TP_FLAG_PROFILE)
+ if (trace_probe_test_flag(&tk->tp, TP_FLAG_PROFILE))
kretprobe_perf_func(tk, ri, regs);
#endif
return 0; /* We don't tweek kernel, so just return 0 */