aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace_output.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-12-31 14:46:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2018-12-31 14:46:59 -0500
commit495d714ad140e1732e66c45d0409054b24c1a0d6 (patch)
tree373ec6619adea47d848d36f140b32def27164bbd /kernel/trace/trace_output.c
parentf12e840c819bab42621685558a01d3f46ab9a226 (diff)
parent3d739c1f6156c70eb0548aa288dcfbac9e0bd162 (diff)
Merge tag 'trace-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing updates from Steven Rostedt: - Rework of the kprobe/uprobe and synthetic events to consolidate all the dynamic event code. This will make changes in the future easier. - Partial rewrite of the function graph tracing infrastructure. This will allow for multiple users of hooking onto functions to get the callback (return) of the function. This is the ground work for having kprobes and function graph tracer using one code base. - Clean up of the histogram code that will facilitate adding more features to the histograms in the future. - Addition of str_has_prefix() and a few use cases. There currently is a similar function strstart() that is used in a few places, but only returns a bool and not a length. These instances will be removed in the future to use str_has_prefix() instead. - A few other various clean ups as well. * tag 'trace-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (57 commits) tracing: Use the return of str_has_prefix() to remove open coded numbers tracing: Have the historgram use the result of str_has_prefix() for len of prefix tracing: Use str_has_prefix() instead of using fixed sizes tracing: Use str_has_prefix() helper for histogram code string.h: Add str_has_prefix() helper function tracing: Make function ‘ftrace_exports’ static tracing: Simplify printf'ing in seq_print_sym tracing: Avoid -Wformat-nonliteral warning tracing: Merge seq_print_sym_short() and seq_print_sym_offset() tracing: Add hist trigger comments for variable-related fields tracing: Remove hist trigger synth_var_refs tracing: Use hist trigger's var_ref array to destroy var_refs tracing: Remove open-coding of hist trigger var_ref management tracing: Use var_refs[] for hist trigger reference checking tracing: Change strlen to sizeof for hist trigger static strings tracing: Remove unnecessary hist trigger struct field tracing: Fix ftrace_graph_get_ret_stack() to use task and not current seq_buf: Use size_t for len in seq_buf_puts() seq_buf: Make seq_buf_puts() null-terminate the buffer arm64: Use ftrace_graph_get_ret_stack() instead of curr_ret_stack ...
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r--kernel/trace/trace_output.c38
1 files changed, 8 insertions, 30 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 6e6cc64faa38..54373d93e251 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -339,43 +339,24 @@ static inline const char *kretprobed(const char *name)
339#endif /* CONFIG_KRETPROBES */ 339#endif /* CONFIG_KRETPROBES */
340 340
341static void 341static void
342seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) 342seq_print_sym(struct trace_seq *s, unsigned long address, bool offset)
343{ 343{
344 char str[KSYM_SYMBOL_LEN];
345#ifdef CONFIG_KALLSYMS 344#ifdef CONFIG_KALLSYMS
346 const char *name;
347
348 kallsyms_lookup(address, NULL, NULL, NULL, str);
349
350 name = kretprobed(str);
351
352 if (name && strlen(name)) {
353 trace_seq_printf(s, fmt, name);
354 return;
355 }
356#endif
357 snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address);
358 trace_seq_printf(s, fmt, str);
359}
360
361static void
362seq_print_sym_offset(struct trace_seq *s, const char *fmt,
363 unsigned long address)
364{
365 char str[KSYM_SYMBOL_LEN]; 345 char str[KSYM_SYMBOL_LEN];
366#ifdef CONFIG_KALLSYMS
367 const char *name; 346 const char *name;
368 347
369 sprint_symbol(str, address); 348 if (offset)
349 sprint_symbol(str, address);
350 else
351 kallsyms_lookup(address, NULL, NULL, NULL, str);
370 name = kretprobed(str); 352 name = kretprobed(str);
371 353
372 if (name && strlen(name)) { 354 if (name && strlen(name)) {
373 trace_seq_printf(s, fmt, name); 355 trace_seq_puts(s, name);
374 return; 356 return;
375 } 357 }
376#endif 358#endif
377 snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address); 359 trace_seq_printf(s, "0x%08lx", address);
378 trace_seq_printf(s, fmt, str);
379} 360}
380 361
381#ifndef CONFIG_64BIT 362#ifndef CONFIG_64BIT
@@ -424,10 +405,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
424 goto out; 405 goto out;
425 } 406 }
426 407
427 if (sym_flags & TRACE_ITER_SYM_OFFSET) 408 seq_print_sym(s, ip, sym_flags & TRACE_ITER_SYM_OFFSET);
428 seq_print_sym_offset(s, "%s", ip);
429 else
430 seq_print_sym_short(s, "%s", ip);
431 409
432 if (sym_flags & TRACE_ITER_SYM_ADDR) 410 if (sym_flags & TRACE_ITER_SYM_ADDR)
433 trace_seq_printf(s, " <" IP_FMT ">", ip); 411 trace_seq_printf(s, " <" IP_FMT ">", ip);