linux-kernel-test/kernel/trace
Arnaldo Carvalho de Melo c71a896154 blktrace: add ftrace plugin
Impact: New way of using the blktrace infrastructure

This drops the requirement of userspace utilities to use the blktrace
facility.

Configuration is done thru sysfs, adding a "trace" directory to the
partition directory where blktrace can be enabled for the associated
request_queue.

The same filters present in the IOCTL interface are present as sysfs
device attributes.

The /sys/block/sdX/sdXN/trace/enable file allows tracing without any
filters.

The other files in this directory: pid, act_mask, start_lba and end_lba
can be used with the same meaning as with the IOCTL interface.

Using the sysfs interface will only setup the request_queue->blk_trace
fields, tracing will only take place when the "blk" tracer is selected
via the ftrace interface, as in the following example:

To see the trace, one can use the /d/tracing/trace file or the
/d/tracign/trace_pipe file, with semantics defined in the ftrace
documentation in Documentation/ftrace.txt.

[root@f10-1 ~]# cat /t/trace
       kjournald-305   [000]  3046.491224:   8,1    A WBS 6367 + 8 <- (8,1) 6304
       kjournald-305   [000]  3046.491227:   8,1    Q   R 6367 + 8 [kjournald]
       kjournald-305   [000]  3046.491236:   8,1    G  RB 6367 + 8 [kjournald]
       kjournald-305   [000]  3046.491239:   8,1    P  NS [kjournald]
       kjournald-305   [000]  3046.491242:   8,1    I RBS 6367 + 8 [kjournald]
       kjournald-305   [000]  3046.491251:   8,1    D  WB 6367 + 8 [kjournald]
       kjournald-305   [000]  3046.491610:   8,1    U  WS [kjournald] 1
          <idle>-0     [000]  3046.511914:   8,1    C  RS 6367 + 8 [6367]
[root@f10-1 ~]#

The default line context (prefix) format is the one described in the ftrace
documentation, with the blktrace specific bits using its existing format,
described in blkparse(8).

If one wants to have the classic blktrace formatting, this is possible by
using:

[root@f10-1 ~]# echo blk_classic > /t/trace_options
[root@f10-1 ~]# cat /t/trace
  8,1    0  3046.491224   305  A WBS 6367 + 8 <- (8,1) 6304
  8,1    0  3046.491227   305  Q   R 6367 + 8 [kjournald]
  8,1    0  3046.491236   305  G  RB 6367 + 8 [kjournald]
  8,1    0  3046.491239   305  P  NS [kjournald]
  8,1    0  3046.491242   305  I RBS 6367 + 8 [kjournald]
  8,1    0  3046.491251   305  D  WB 6367 + 8 [kjournald]
  8,1    0  3046.491610   305  U  WS [kjournald] 1
  8,1    0  3046.511914     0  C  RS 6367 + 8 [6367]
[root@f10-1 ~]#

Using the ftrace standard format allows more flexibility, such
as the ability of asking for backtraces via trace_options:

[root@f10-1 ~]# echo noblk_classic > /t/trace_options
[root@f10-1 ~]# echo stacktrace > /t/trace_options

[root@f10-1 ~]# cat /t/trace
       kjournald-305   [000]  3318.826779:   8,1    A WBS 6375 + 8 <- (8,1) 6312
       kjournald-305   [000]  3318.826782:
 <= submit_bio
 <= submit_bh
 <= sync_dirty_buffer
 <= journal_commit_transaction
 <= kjournald
 <= kthread
 <= child_rip
       kjournald-305   [000]  3318.826836:   8,1    Q   R 6375 + 8 [kjournald]
       kjournald-305   [000]  3318.826837:
 <= generic_make_request
 <= submit_bio
 <= submit_bh
 <= sync_dirty_buffer
 <= journal_commit_transaction
 <= kjournald
 <= kthread

Please read the ftrace documentation to use aditional, standardized
tracing filters such as /d/tracing/trace_cpumask, etc.

See also /d/tracing/trace_mark to add comments in the trace stream,
that is equivalent to the /d/block/sdaN/msg interface.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-01-26 14:40:53 +01:00
..
ftrace.c tracing/function-graph-tracer: fix a regression while suspend to disk 2009-01-15 09:47:40 +01:00
Kconfig tracing: add a new workqueue tracer 2009-01-14 12:11:43 +01:00
kmemtrace.c trace: clean up format errors in calls to trace_seq_printf 2009-01-16 12:17:38 +01:00
Makefile tracing: add a new workqueue tracer 2009-01-14 12:11:43 +01:00
ring_buffer.c ring-buffer: reset timestamps when ring buffer is reset 2009-01-22 10:27:54 +01:00
trace_boot.c Merge branches 'tracing/kmemtrace2' and 'tracing/ftrace' into tracing/urgent 2009-01-06 10:18:43 +01:00
trace_branch.c tracing/ftrace: separate events tracing and stats tracing engine 2009-01-14 12:11:37 +01:00
trace_functions_graph.c tracing/function-graph-tracer: various fixes and features 2009-01-23 11:18:08 +01:00
trace_functions.c ftrace: remove static from function tracer functions 2009-01-16 12:17:58 +01:00
trace_hw_branches.c x86, ftrace, hw-branch-tracer: change trace format 2009-01-20 13:04:16 +01:00
trace_irqsoff.c trace: remove internal irqsoff disabling for trace output 2009-01-23 11:10:36 +01:00
trace_mmiotrace.c trace: clean up format errors in calls to trace_seq_printf 2009-01-16 12:17:38 +01:00
trace_nop.c
trace_output.c trace: clean up format errors in calls to trace_seq_printf 2009-01-16 12:17:38 +01:00
trace_output.h trace: add gcc printf check to trace_seq_printf 2009-01-16 12:17:29 +01:00
trace_power.c Merge branches 'tracing/kmemtrace2' and 'tracing/ftrace' into tracing/urgent 2009-01-06 10:18:43 +01:00
trace_sched_switch.c
trace_sched_wakeup.c wakeup-tracer: show scheduling data in output 2009-01-22 10:27:39 +01:00
trace_selftest_dynamic.c
trace_selftest.c tracing/selftest: remove TRACE_CONT reference 2008-12-29 15:07:47 +01:00
trace_stack.c
trace_stat.c tracing: trace_stat.c cleanup 2009-01-15 11:31:21 +01:00
trace_stat.h tracing/ftrace: separate events tracing and stats tracing engine 2009-01-14 12:11:37 +01:00
trace_sysprof.c cpumask: convert kernel trace functions 2009-01-01 10:12:22 +10:30
trace_workqueue.c trace_workqueue: use percpu data for workqueue stat 2009-01-20 13:06:59 +01:00
trace.c ftrace: add ftrace_vprintk 2009-01-26 14:40:53 +01:00
trace.h blktrace: add ftrace plugin 2009-01-26 14:40:53 +01:00