1. 03 4月, 2009 3 次提交
  2. 31 3月, 2009 9 次提交
    • L
      blktrace: print out BLK_TN_MESSAGE properly · 18cea459
      Li Zefan 提交于
      Impact: improve ftrace plugin output
      
      Before this patch:
      
       # cat trace
               make-5383  [001]   741.240059:   8,7    P   N [make]
       __trace_note_message: cfq1074
      
       # echo 1 > options/blk_classic
       # cat trace
         8,7    1     0.692221252     0  C   W 130411392 + 1024 [0]
       Bad pc action 6361
       Bad pc action 283d
      
       # echo 0 > options/blk_classic
       # echo bin > trace_options
       # cat trace_pipe | blkparse -i -
       (can't parse messages generated by blk_add_trace_msg())
      
      After this patch:
       # cat trace
            <idle>-0     [001]   187.600933:   8,7    C   W 145220224 + 8 [0]
            <idle>-0     [001]   187.600946:   8,7    m   N cfq1076 complete
      
       # echo 1 > options/blk_classic
       # cat trace
         8,7    1     0.256378996   238  I   W 113190728 + 8 [pdflush]
         8,7    1     0.256378998   238  m   N cfq1076 insert_request
      
       # echo 0 > options/blk_classic
       # echo bin > trace_options
       # cat trace_pipe | blkparse -i -
        8,7    1        0    22.973250293     0  C   W 102770576 + 8 [0]
        8,7    1        0    22.973259213     0  m   N cfq1076 complete
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      18cea459
    • L
      blktrace: extract duplidate code · b6a4b0c3
      Li Zefan 提交于
      Impact: cleanup
      
      blk_trace_event_print() and blk_tracer_print_line() share most of the code.
      
         text    data     bss     dec     hex filename
         8605     393      12    9010    2332 kernel/trace/blktrace.o.orig
         text    data     bss     dec     hex filename
         8555     393      12    8960    2300 kernel/trace/blktrace.o
      
      This patch also prepares for the next patch, that prints out BLK_TN_MESSAGE.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b6a4b0c3
    • L
      blktrace: fix memory leak when freeing struct blk_io_trace · ad5dd549
      Li Zefan 提交于
      Impact: fix mixed ioctl and ftrace-plugin blktrace use memory leak
      
      When mixing the use of ioctl-based blktrace and ftrace-based blktrace,
      we can leak memory in this way:
      
        # btrace /dev/sda > /dev/null &
        # echo 0 > /sys/block/sda/sda1/trace/enable
      
      now we leak bt->dropped_file, bt->msg_file, bt->rchan...
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ad5dd549
    • L
      blktrace: fix blk_probes_ref chaos · 17ba97e3
      Li Zefan 提交于
      Impact: fix mixed ioctl and ftrace-plugin blktrace use refcount bugs
      
      ioctl-based blktrace allocates bt and registers tracepoints when
      ioctl(BLKTRACESETUP), and do all cleanups when ioctl(BLKTRACETEARDOWN).
      
      while ftrace-based blktrace allocates/frees bt when:
        # echo 1/0 > /sys/block/sda/sda1/trace/enable
      
      and registers/unregisters tracepoints when:
        # echo blk/nop > /debugfs/tracing/current_tracer
      or
        # echo 1/0 > /debugfs/tracing/tracing_enable
      
      The separatation of allocation and registeration causes 2 problems:
      
        1. current user-space blktrace still calls ioctl(TEARDOWN) when
           ioctl(SETUP) failed:
             # echo 1 > /sys/block/sda/sda1/trace/enable
             # blktrace /dev/sda
               BLKTRACESETUP: Device or resource busy
               ^C
           and now blk_probes_ref == -1
      
        2. Another way to make blk_probes_ref == -1:
           # plugin sdb && mount sdb1
           # echo 1 > /sys/block/sdb/sdb1/trace/enable
           # remove sdb
      
      This patch does the allocation and registeration when writing
      sdaX/trace/enable.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      17ba97e3
    • L
      blktrace: make classic output more classic · 35ac51bf
      Li Zefan 提交于
      Impact: fix ftrace plugin timestamp output
      
      In the classic user-space blktrace, the output timestamp is sec.nsec
      not sec.usec.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      35ac51bf
    • L
      blktrace: fix off-by-one bug · eb08f8eb
      Li Zefan 提交于
      'what' is used as the index of array what2act, so it can't >= the array size.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      eb08f8eb
    • L
      blktrace: fix the original blktrace · 55547204
      Li Zefan 提交于
      Currently the original blktrace, which is using relay and is used via
      ioctl, is broken. You can use ftrace to see the output of blktrace,
      but user-space blktrace is unusable.
      
      It's broken by "blktrace: add ftrace plugin"
      (c71a8961)
      
       -	if (unlikely(bt->trace_state != Blktrace_running))
       +	if (unlikely(bt->trace_state != Blktrace_running || !blk_tracer_enabled))
      		return;
      
      With this patch, both ioctl and ftrace can be used, but of course you
      can't use both of them at the same time.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      55547204
    • L
      blktrace: fix a race when creating blk_tree_root in debugfs · b5230b56
      Li Zefan 提交于
      t1                                t2
      ------                            ------
      do_blk_trace_setup()              do_blk_trace_setup()
        if (!blk_tree_root) {
                                          if (!blk_tree_root)
          blk_tree_root = create_dir()
                                            blk_tree_root = create_dir();
                                            (now blk_tree_root == NULL)
        ...
        dir = create_dir(name, blk_tree_root);
      
      Due to this race, t1 will create 'dir' in /debugfs but not /debugfs/block.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b5230b56
    • L
      blktrace: fix timestamp in binary output · 6c051ce0
      Li Zefan 提交于
      I found the timestamp is wrong:
      
       # echo bin > trace_option
       # echo blk > current_tracer
       # cat trace_pipe | blkparse -i -
       8,0    0        0     0.000000000   504  A   W ...
       ...
       8,7    1        0     0.008534097     0  C   R ...
                  (should be 8.534097xxx)
      
      user-space blkparse expects the timestamp to be nanosecond.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: NJens Axboe <jens.axboe@oracle.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6c051ce0
  3. 24 3月, 2009 4 次提交
  4. 21 3月, 2009 7 次提交
  5. 20 3月, 2009 9 次提交
  6. 19 3月, 2009 8 次提交