aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2013-03-09 08:56:43 -0500
committerSteven Rostedt <rostedt@goodmis.org>2013-03-15 00:35:59 -0400
commit8380d24860e9d1659ab22896b86d7fe591c424fa (patch)
tree81b01cb06040edb01a577c91f01cc4a52ffa4e22
parent8b8fa62c60e03a53c46324075a8dc25821741daa (diff)
ftrace: Separate unlimited probes from count limited probes
The function tracing probes that trigger traceon or traceoff can be set to unlimited, or given a count of # of times to execute. By separating these two types of probes, we can then use the dynamic ftrace function filtering directly, and remove the brute force "check if this function called is my probe" routines in ftrace. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/trace/trace_functions.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c
index a88a3e0b0cc2..043b2425ae73 100644
--- a/kernel/trace/trace_functions.c
+++ b/kernel/trace/trace_functions.c
@@ -228,7 +228,7 @@ static int update_count(void **data)
228} 228}
229 229
230static void 230static void
231ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data) 231ftrace_traceon_count(unsigned long ip, unsigned long parent_ip, void **data)
232{ 232{
233 if (tracing_is_on()) 233 if (tracing_is_on())
234 return; 234 return;
@@ -238,7 +238,7 @@ ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data)
238} 238}
239 239
240static void 240static void
241ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data) 241ftrace_traceoff_count(unsigned long ip, unsigned long parent_ip, void **data)
242{ 242{
243 if (!tracing_is_on()) 243 if (!tracing_is_on())
244 return; 244 return;
@@ -247,10 +247,38 @@ ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data)
247 tracing_off(); 247 tracing_off();
248} 248}
249 249
250static void
251ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data)
252{
253 if (tracing_is_on())
254 return;
255
256 tracing_on();
257}
258
259static void
260ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data)
261{
262 if (!tracing_is_on())
263 return;
264
265 tracing_off();
266}
267
250static int 268static int
251ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip, 269ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
252 struct ftrace_probe_ops *ops, void *data); 270 struct ftrace_probe_ops *ops, void *data);
253 271
272static struct ftrace_probe_ops traceon_count_probe_ops = {
273 .func = ftrace_traceon_count,
274 .print = ftrace_trace_onoff_print,
275};
276
277static struct ftrace_probe_ops traceoff_count_probe_ops = {
278 .func = ftrace_traceoff_count,
279 .print = ftrace_trace_onoff_print,
280};
281
254static struct ftrace_probe_ops traceon_probe_ops = { 282static struct ftrace_probe_ops traceon_probe_ops = {
255 .func = ftrace_traceon, 283 .func = ftrace_traceon,
256 .print = ftrace_trace_onoff_print, 284 .print = ftrace_trace_onoff_print,
@@ -269,7 +297,7 @@ ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
269 297
270 seq_printf(m, "%ps:", (void *)ip); 298 seq_printf(m, "%ps:", (void *)ip);
271 299
272 if (ops == &traceon_probe_ops) 300 if (ops == &traceon_probe_ops || ops == &traceon_count_probe_ops)
273 seq_printf(m, "traceon"); 301 seq_printf(m, "traceon");
274 else 302 else
275 seq_printf(m, "traceoff"); 303 seq_printf(m, "traceoff");
@@ -297,9 +325,9 @@ ftrace_trace_onoff_callback(struct ftrace_hash *hash,
297 325
298 /* we register both traceon and traceoff to this callback */ 326 /* we register both traceon and traceoff to this callback */
299 if (strcmp(cmd, "traceon") == 0) 327 if (strcmp(cmd, "traceon") == 0)
300 ops = &traceon_probe_ops; 328 ops = param ? &traceon_count_probe_ops : &traceon_probe_ops;
301 else 329 else
302 ops = &traceoff_probe_ops; 330 ops = param ? &traceoff_count_probe_ops : &traceoff_probe_ops;
303 331
304 if (glob[0] == '!') { 332 if (glob[0] == '!') {
305 unregister_ftrace_function_probe_func(glob+1, ops); 333 unregister_ftrace_function_probe_func(glob+1, ops);