Commit 915a0b575fdb2376135ed9334b3ccb1eb51db622

Authored by Ingo Molnar

Merge branch 'tip/tracing/core' of git://git.kernel.org/pub/scm/linux/kernel/git…

…/rostedt/linux-2.6-trace into tracing/urgent

Showing 4 changed files Side-by-side Diff

kernel/trace/ftrace.c
... ... @@ -84,10 +84,6 @@
84 84 ftrace_func_t __ftrace_trace_function __read_mostly = ftrace_stub;
85 85 ftrace_func_t ftrace_pid_function __read_mostly = ftrace_stub;
86 86  
87   -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
88   -static int ftrace_set_func(unsigned long *array, int *idx, char *buffer);
89   -#endif
90   -
91 87 static void ftrace_list_func(unsigned long ip, unsigned long parent_ip)
92 88 {
93 89 struct ftrace_ops *op = ftrace_list;
... ... @@ -2276,6 +2272,8 @@
2276 2272  
2277 2273 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
2278 2274 static char ftrace_graph_buf[FTRACE_FILTER_SIZE] __initdata;
  2275 +static int ftrace_set_func(unsigned long *array, int *idx, char *buffer);
  2276 +
2279 2277 static int __init set_graph_function(char *str)
2280 2278 {
2281 2279 strlcpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE);
kernel/trace/trace.c
... ... @@ -374,6 +374,21 @@
374 374 }
375 375 __setup("trace_buf_size=", set_buf_size);
376 376  
  377 +static int __init set_tracing_thresh(char *str)
  378 +{
  379 + unsigned long threshhold;
  380 + int ret;
  381 +
  382 + if (!str)
  383 + return 0;
  384 + ret = strict_strtoul(str, 0, &threshhold);
  385 + if (ret < 0)
  386 + return 0;
  387 + tracing_thresh = threshhold * 1000;
  388 + return 1;
  389 +}
  390 +__setup("tracing_thresh=", set_tracing_thresh);
  391 +
377 392 unsigned long nsecs_to_usecs(unsigned long nsecs)
378 393 {
379 394 return nsecs / 1000;
380 395  
... ... @@ -579,9 +594,10 @@
579 594 static arch_spinlock_t ftrace_max_lock =
580 595 (arch_spinlock_t)__ARCH_SPIN_LOCK_UNLOCKED;
581 596  
  597 +unsigned long __read_mostly tracing_thresh;
  598 +
582 599 #ifdef CONFIG_TRACER_MAX_TRACE
583 600 unsigned long __read_mostly tracing_max_latency;
584   -unsigned long __read_mostly tracing_thresh;
585 601  
586 602 /*
587 603 * Copy the new maximum trace into the separate maximum-trace
... ... @@ -592,7 +608,7 @@
592 608 __update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu)
593 609 {
594 610 struct trace_array_cpu *data = tr->data[cpu];
595   - struct trace_array_cpu *max_data = tr->data[cpu];
  611 + struct trace_array_cpu *max_data;
596 612  
597 613 max_tr.cpu = cpu;
598 614 max_tr.time_start = data->preempt_timestamp;
... ... @@ -602,7 +618,7 @@
602 618 max_data->critical_start = data->critical_start;
603 619 max_data->critical_end = data->critical_end;
604 620  
605   - memcpy(data->comm, tsk->comm, TASK_COMM_LEN);
  621 + memcpy(max_data->comm, tsk->comm, TASK_COMM_LEN);
606 622 max_data->pid = tsk->pid;
607 623 max_data->uid = task_uid(tsk);
608 624 max_data->nice = tsk->static_prio - 20 - MAX_RT_PRIO;
609 625  
... ... @@ -4249,10 +4265,10 @@
4249 4265 #ifdef CONFIG_TRACER_MAX_TRACE
4250 4266 trace_create_file("tracing_max_latency", 0644, d_tracer,
4251 4267 &tracing_max_latency, &tracing_max_lat_fops);
  4268 +#endif
4252 4269  
4253 4270 trace_create_file("tracing_thresh", 0644, d_tracer,
4254 4271 &tracing_thresh, &tracing_max_lat_fops);
4255   -#endif
4256 4272  
4257 4273 trace_create_file("README", 0444, d_tracer,
4258 4274 NULL, &tracing_readme_fops);
kernel/trace/trace.h
... ... @@ -396,9 +396,10 @@
396 396  
397 397 extern unsigned long nsecs_to_usecs(unsigned long nsecs);
398 398  
  399 +extern unsigned long tracing_thresh;
  400 +
399 401 #ifdef CONFIG_TRACER_MAX_TRACE
400 402 extern unsigned long tracing_max_latency;
401   -extern unsigned long tracing_thresh;
402 403  
403 404 void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu);
404 405 void update_max_tr_single(struct trace_array *tr,
kernel/trace/trace_functions_graph.c
... ... @@ -237,6 +237,14 @@
237 237 return ret;
238 238 }
239 239  
  240 +int trace_graph_thresh_entry(struct ftrace_graph_ent *trace)
  241 +{
  242 + if (tracing_thresh)
  243 + return 1;
  244 + else
  245 + return trace_graph_entry(trace);
  246 +}
  247 +
240 248 static void __trace_graph_return(struct trace_array *tr,
241 249 struct ftrace_graph_ret *trace,
242 250 unsigned long flags,
243 251  
... ... @@ -290,13 +298,26 @@
290 298 smp_mb();
291 299 }
292 300  
  301 +void trace_graph_thresh_return(struct ftrace_graph_ret *trace)
  302 +{
  303 + if (tracing_thresh &&
  304 + (trace->rettime - trace->calltime < tracing_thresh))
  305 + return;
  306 + else
  307 + trace_graph_return(trace);
  308 +}
  309 +
293 310 static int graph_trace_init(struct trace_array *tr)
294 311 {
295 312 int ret;
296 313  
297 314 set_graph_array(tr);
298   - ret = register_ftrace_graph(&trace_graph_return,
299   - &trace_graph_entry);
  315 + if (tracing_thresh)
  316 + ret = register_ftrace_graph(&trace_graph_thresh_return,
  317 + &trace_graph_thresh_entry);
  318 + else
  319 + ret = register_ftrace_graph(&trace_graph_return,
  320 + &trace_graph_entry);
300 321 if (ret)
301 322 return ret;
302 323 tracing_start_cmdline_record();
... ... @@ -920,7 +941,7 @@
920 941 if (!ret)
921 942 return TRACE_TYPE_PARTIAL_LINE;
922 943 } else {
923   - ret = trace_seq_printf(s, "} (%ps)\n", (void *)trace->func);
  944 + ret = trace_seq_printf(s, "} /* %ps */\n", (void *)trace->func);
924 945 if (!ret)
925 946 return TRACE_TYPE_PARTIAL_LINE;
926 947 }