History

Merge tag 'trace-fixes-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull tracing fixes from Steven Rostedt: "The first two patches fix the debugfs README file to reflect better the new features added to 3.14. The third patch is a minor bugfix to the trace_puts() functions that will crash the system if a developer adds one before the tracing system is setup. It also affects trace_printk() if it has no arguments, as the code will convert it to a trace_puts() as well. Note, this bug will not affect unmodified kernels, as trace_printk() and trace_puts() should only be used by developers for testing" * tag 'trace-fixes-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Check if tracing is enabled in trace_puts() tracing: Fix formatting of trace README file tracing/README: Add event file usage to tracing mini-HOWTO

Linus Torvalds committed 12 years ago

Commit ba635f82 parents ba6b508 3132e101 file · +81 −32Browse files

Showing the changes to kernel/trace (1 of 1 file). Show all

Unified · Split

kernel/trace/trace.c+81−32
@@ -455,6 +455,9 @@ int __trace_puts(unsigned long ip, const char *str, int size) · 454 unmodified lines
455 unsigned long irq_flags;455 unsigned long irq_flags;
456 int alloc;456 int alloc;
457 457
458 if (unlikely(tracing_selftest_running || tracing_disabled))
459 return 0;
460
458 alloc = sizeof(*entry) + size + 2; /* possible \n added */461 alloc = sizeof(*entry) + size + 2; /* possible \n added */
459 462
460 local_save_flags(irq_flags);463 local_save_flags(irq_flags);
@@ -495,6 +498,9 @@ int __trace_bputs(unsigned long ip, const char *str) · 34 unmodified lines
495 unsigned long irq_flags;498 unsigned long irq_flags;
496 int size = sizeof(struct bputs_entry);499 int size = sizeof(struct bputs_entry);
497 500
501 if (unlikely(tracing_selftest_running || tracing_disabled))
502 return 0;
503
498 local_save_flags(irq_flags);504 local_save_flags(irq_flags);
499 buffer = global_trace.trace_buffer.buffer;505 buffer = global_trace.trace_buffer.buffer;
500 event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,506 event = trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,
@@ -3519,60 +3525,103 @@ static const char readme_msg[] = · 3018 unmodified lines
3519 " instances\t\t- Make sub-buffers with: mkdir instances/foo\n"3525 " instances\t\t- Make sub-buffers with: mkdir instances/foo\n"
3520 "\t\t\t Remove sub-buffer with rmdir\n"3526 "\t\t\t Remove sub-buffer with rmdir\n"
3521 " trace_options\t\t- Set format or modify how tracing happens\n"3527 " trace_options\t\t- Set format or modify how tracing happens\n"
3522 "\t\t\t Disable an option by adding a suffix 'no' to the option name\n"3528 "\t\t\t Disable an option by adding a suffix 'no' to the\n"
3529 "\t\t\t option name\n"
3523#ifdef CONFIG_DYNAMIC_FTRACE3530#ifdef CONFIG_DYNAMIC_FTRACE
3524 "\n available_filter_functions - list of functions that can be filtered on\n"3531 "\n available_filter_functions - list of functions that can be filtered on\n"
3525 " set_ftrace_filter\t- echo function name in here to only trace these functions\n"3532 " set_ftrace_filter\t- echo function name in here to only trace these\n"
3526 " accepts: func_full_name, *func_end, func_begin*, *func_middle*\n"3533 "\t\t\t functions\n"
3527 " modules: Can select a group via module\n"3534 "\t accepts: func_full_name, *func_end, func_begin*, *func_middle*\n"
3528 " Format: :mod:<module-name>\n"3535 "\t modules: Can select a group via module\n"
3529 " example: echo :mod:ext3 > set_ftrace_filter\n"3536 "\t Format: :mod:<module-name>\n"
3530 " triggers: a command to perform when function is hit\n"3537 "\t example: echo :mod:ext3 > set_ftrace_filter\n"
3531 " Format: <function>:<trigger>[:count]\n"3538 "\t triggers: a command to perform when function is hit\n"
3532 " trigger: traceon, traceoff\n"3539 "\t Format: <function>:<trigger>[:count]\n"
3533 " enable_event:<system>:<event>\n"3540 "\t trigger: traceon, traceoff\n"
3534 " disable_event:<system>:<event>\n"3541 "\t\t enable_event:<system>:<event>\n"
3542 "\t\t disable_event:<system>:<event>\n"
3535#ifdef CONFIG_STACKTRACE3543#ifdef CONFIG_STACKTRACE
3536 " stacktrace\n"3544 "\t\t stacktrace\n"
3537#endif3545#endif
3538#ifdef CONFIG_TRACER_SNAPSHOT3546#ifdef CONFIG_TRACER_SNAPSHOT
3539 " snapshot\n"3547 "\t\t snapshot\n"
3540#endif3548#endif
3541 " example: echo do_fault:traceoff > set_ftrace_filter\n"3549 "\t example: echo do_fault:traceoff > set_ftrace_filter\n"
3542 " echo do_trap:traceoff:3 > set_ftrace_filter\n"3550 "\t echo do_trap:traceoff:3 > set_ftrace_filter\n"
3543 " The first one will disable tracing every time do_fault is hit\n"3551 "\t The first one will disable tracing every time do_fault is hit\n"
3544 " The second will disable tracing at most 3 times when do_trap is hit\n"3552 "\t The second will disable tracing at most 3 times when do_trap is hit\n"
3545 " The first time do trap is hit and it disables tracing, the counter\n"3553 "\t The first time do trap is hit and it disables tracing, the\n"
3546 " will decrement to 2. If tracing is already disabled, the counter\n"3554 "\t counter will decrement to 2. If tracing is already disabled,\n"
3547 " will not decrement. It only decrements when the trigger did work\n"3555 "\t the counter will not decrement. It only decrements when the\n"
3548 " To remove trigger without count:\n"3556 "\t trigger did work\n"
3549 " echo '!<function>:<trigger> > set_ftrace_filter\n"3557 "\t To remove trigger without count:\n"
3550 " To remove trigger with a count:\n"3558 "\t echo '!<function>:<trigger> > set_ftrace_filter\n"
3551 " echo '!<function>:<trigger>:0 > set_ftrace_filter\n"3559 "\t To remove trigger with a count:\n"
3560 "\t echo '!<function>:<trigger>:0 > set_ftrace_filter\n"
3552 " set_ftrace_notrace\t- echo function name in here to never trace.\n"3561 " set_ftrace_notrace\t- echo function name in here to never trace.\n"
3553 " accepts: func_full_name, *func_end, func_begin*, *func_middle*\n"3562 "\t accepts: func_full_name, *func_end, func_begin*, *func_middle*\n"
3554 " modules: Can select a group via module command :mod:\n"3563 "\t modules: Can select a group via module command :mod:\n"
3555 " Does not accept triggers\n"3564 "\t Does not accept triggers\n"
3556#endif /* CONFIG_DYNAMIC_FTRACE */3565#endif /* CONFIG_DYNAMIC_FTRACE */
3557#ifdef CONFIG_FUNCTION_TRACER3566#ifdef CONFIG_FUNCTION_TRACER
3558 " set_ftrace_pid\t- Write pid(s) to only function trace those pids (function)\n"3567 " set_ftrace_pid\t- Write pid(s) to only function trace those pids\n"
3568 "\t\t (function)\n"
3559#endif3569#endif
3560#ifdef CONFIG_FUNCTION_GRAPH_TRACER3570#ifdef CONFIG_FUNCTION_GRAPH_TRACER
3561 " set_graph_function\t- Trace the nested calls of a function (function_graph)\n"3571 " set_graph_function\t- Trace the nested calls of a function (function_graph)\n"
3562 " max_graph_depth\t- Trace a limited depth of nested calls (0 is unlimited)\n"3572 " max_graph_depth\t- Trace a limited depth of nested calls (0 is unlimited)\n"
3563#endif3573#endif
3564#ifdef CONFIG_TRACER_SNAPSHOT3574#ifdef CONFIG_TRACER_SNAPSHOT
3565 "\n snapshot\t\t- Like 'trace' but shows the content of the static snapshot buffer\n"3575 "\n snapshot\t\t- Like 'trace' but shows the content of the static\n"
3566 "\t\t\t Read the contents for more information\n"3576 "\t\t\t snapshot buffer. Read the contents for more\n"
3577 "\t\t\t information\n"
3567#endif3578#endif
3568#ifdef CONFIG_STACK_TRACER3579#ifdef CONFIG_STACK_TRACER
3569 " stack_trace\t\t- Shows the max stack trace when active\n"3580 " stack_trace\t\t- Shows the max stack trace when active\n"
3570 " stack_max_size\t- Shows current max stack size that was traced\n"3581 " stack_max_size\t- Shows current max stack size that was traced\n"
3571 "\t\t\t Write into this file to reset the max size (trigger a new trace)\n"3582 "\t\t\t Write into this file to reset the max size (trigger a\n"
3583 "\t\t\t new trace)\n"
3572#ifdef CONFIG_DYNAMIC_FTRACE3584#ifdef CONFIG_DYNAMIC_FTRACE
3573 " stack_trace_filter\t- Like set_ftrace_filter but limits what stack_trace traces\n"3585 " stack_trace_filter\t- Like set_ftrace_filter but limits what stack_trace\n"
3586 "\t\t\t traces\n"
3574#endif3587#endif
3575#endif /* CONFIG_STACK_TRACER */3588#endif /* CONFIG_STACK_TRACER */
3589 " events/\t\t- Directory containing all trace event subsystems:\n"
3590 " enable\t\t- Write 0/1 to enable/disable tracing of all events\n"
3591 " events/<system>/\t- Directory containing all trace events for <system>:\n"
3592 " enable\t\t- Write 0/1 to enable/disable tracing of all <system>\n"
3593 "\t\t\t events\n"
3594 " filter\t\t- If set, only events passing filter are traced\n"
3595 " events/<system>/<event>/\t- Directory containing control files for\n"
3596 "\t\t\t <event>:\n"
3597 " enable\t\t- Write 0/1 to enable/disable tracing of <event>\n"
3598 " filter\t\t- If set, only events passing filter are traced\n"
3599 " trigger\t\t- If set, a command to perform when event is hit\n"
3600 "\t Format: <trigger>[:count][if <filter>]\n"
3601 "\t trigger: traceon, traceoff\n"
3602 "\t enable_event:<system>:<event>\n"
3603 "\t disable_event:<system>:<event>\n"
3604#ifdef CONFIG_STACKTRACE
3605 "\t\t stacktrace\n"
3606#endif
3607#ifdef CONFIG_TRACER_SNAPSHOT
3608 "\t\t snapshot\n"
3609#endif
3610 "\t example: echo traceoff > events/block/block_unplug/trigger\n"
3611 "\t echo traceoff:3 > events/block/block_unplug/trigger\n"
3612 "\t echo 'enable_event:kmem:kmalloc:3 if nr_rq > 1' > \\\n"
3613 "\t events/block/block_unplug/trigger\n"
3614 "\t The first disables tracing every time block_unplug is hit.\n"
3615 "\t The second disables tracing the first 3 times block_unplug is hit.\n"
3616 "\t The third enables the kmalloc event the first 3 times block_unplug\n"
3617 "\t is hit and has value of greater than 1 for the 'nr_rq' event field.\n"
3618 "\t Like function triggers, the counter is only decremented if it\n"
3619 "\t enabled or disabled tracing.\n"
3620 "\t To remove a trigger without a count:\n"
3621 "\t echo '!<trigger> > <system>/<event>/trigger\n"
3622 "\t To remove a trigger with a count:\n"
3623 "\t echo '!<trigger>:0 > <system>/<event>/trigger\n"
3624 "\t Filters can be ignored when removing a trigger.\n"
3576;3625;
3577 3626
3578static ssize_t3627static ssize_t