1. 06 Mar, 2009 2 commits
  2. 05 Mar, 2009 2 commits
  3. 04 Mar, 2009 7 commits
    • Steven Rostedt's avatar
      tracing: consolidate print_lat_fmt and print_trace_fmt · 27d48be8
      Steven Rostedt authored
      
      Impact: clean up
      
      Both print_lat_fmt and print_trace_fmt do pretty much the same thing
      except for one different function call. This patch consolidates the
      two functions and adds an if statement to perform the difference.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      27d48be8
    • Steven Rostedt's avatar
      tracing: remove extra latency_trace method from trace structure · 5fd73f86
      Steven Rostedt authored
      
      Impact: clean up
      
      The trace and latency_trace function pointers are identical for
      every tracer but the function tracer. The differences in the function
      tracer are trivial (latency output puts paranthesis around parent).
      
      This patch removes the latency_trace pointer and all prints will
      now just use the trace output function pointer.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5fd73f86
    • Steven Rostedt's avatar
      tracing: add latency output format option · c032ef64
      Steven Rostedt authored
      
      With the removal of the latency_trace file, we lost the ability
      to see some of the finer details in a trace. Like the state of
      interrupts enabled, the preempt count, need resched, and if we
      are in an interrupt handler, softirq handler or not.
      
      This patch simply creates an option to bring back the old format.
      This also removes the warning about an unused variable that held
      the latency_trace file operations.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      c032ef64
    • Steven Rostedt's avatar
      tracing: fix seq read from trace files · e74da523
      Steven Rostedt authored
      
      The buffer used by trace_seq was updated incorrectly. Instead
      of consuming what was actually read, it consumed the rest of the
      buffer on reads.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e74da523
    • Steven Rostedt's avatar
      tracing: do not return EFAULT if read copied anything · 2dc5d12b
      Steven Rostedt authored
      
      Impact: fix trace read to conform to standards
      
      Andrew Morton, Theodore Tso and H. Peter Anvin brought to my attention
      that a userspace read should not return -EFAULT if it succeeded in
      copying anything. It should only return -EFAULT if it failed to copy
      at all.
      
      This patch modifies the check of copy_from_user and updates the return
      code appropriately.
      
      I also used H. Peter Anvin's short cut rule to just test ret == count.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      2dc5d12b
    • Steven Rostedt's avatar
      tracing: add cpu_file intialization for ftrace_dump · e543ad76
      Steven Rostedt authored
      Impact: fix to ftrace_dump output corruption
      
      The commit: b04cc6b1
      
      
        tracing/core: introduce per cpu tracing files
      
      added a new field to the iterator called cpu_file. This was a handle
      to differentiate between the per cpu trace output files and the
      all cpu "trace" file. The all cpu "trace" file required setting this
      to TRACE_PIPE_ALL_CPU.
      
      The problem is that the ftrace_dump sets up its own iterator but was
      not updated to handle this change. The result was only CPU 0 printing
      out on crash and a lot of "<0>"'s also being printed.
      Reported-by: default avatarThomas Gleixner <tglx@linuxtronix.de>
      Tested-by: default avatarDarren Hart <dvhtc@us.ibm.com>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e543ad76
    • Peter Zijlstra's avatar
      tracing: add lockdep tracepoints for lock acquire/release · efed792d
      Peter Zijlstra authored
      
      Augment the traces with lock names when lockdep is available:
      
       1)               |  down_read_trylock() {
       1)               |    _spin_lock_irqsave() {
       1)               |      /* lock_acquire: &sem->wait_lock */
       1)   4.201 us    |    }
       1)               |    _spin_unlock_irqrestore() {
       1)               |      /* lock_release: &sem->wait_lock */
       1)   3.523 us    |    }
       1)               |  /* lock_acquire: try read &mm->mmap_sem */
       1) + 13.386 us   |  }
       1)   1.635 us    |  find_vma();
       1)               |  handle_mm_fault() {
       1)               |    __do_fault() {
       1)               |      filemap_fault() {
       1)               |        find_lock_page() {
       1)               |          find_get_page() {
       1)               |            /* lock_acquire: read rcu_read_lock */
       1)               |            /* lock_release: rcu_read_lock */
       1)   5.697 us    |          }
       1)   8.158 us    |        }
       1) + 11.079 us   |      }
       1)               |      _spin_lock() {
       1)               |        /* lock_acquire: __pte_lockptr(page) */
       1)   3.949 us    |      }
       1)   1.460 us    |      page_add_file_rmap();
       1)               |      _spin_unlock() {
       1)               |        /* lock_release: __pte_lockptr(page) */
       1)   3.115 us    |      }
       1)               |      unlock_page() {
       1)   1.421 us    |        page_waitqueue();
       1)   1.220 us    |        __wake_up_bit();
       1)   6.519 us    |      }
       1) + 34.328 us   |    }
       1) + 37.452 us   |  }
       1)               |  up_read() {
       1)               |  /* lock_release: &mm->mmap_sem */
       1)               |    _spin_lock_irqsave() {
       1)               |      /* lock_acquire: &sem->wait_lock */
       1)   3.865 us    |    }
       1)               |    _spin_unlock_irqrestore() {
       1)               |      /* lock_release: &sem->wait_lock */
       1)   8.562 us    |    }
       1) + 17.370 us   |  }
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: =?ISO-8859-1?Q?T=F6r=F6k?= Edwin <edwintorok@gmail.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1236166375.5330.7209.camel@laptop>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      efed792d
  4. 03 Mar, 2009 1 commit
    • Steven Rostedt's avatar
      tracing: add binary buffer files for use with splice · 2cadf913
      Steven Rostedt authored
      
      Impact: new feature
      
      This patch creates a directory of files that correspond to the
      per CPU ring buffers. These are binary files and are made to
      be used with splice. This is the fastest way to extract data from
      the ftrace ring buffers.
      
      Thanks to Jiaying Zhang for pushing me to get this code fixed,
       and to Eduard - Gabriel Munteanu for his splice code that helped
       me debug my code.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      2cadf913
  5. 02 Mar, 2009 1 commit
  6. 28 Feb, 2009 1 commit
    • Steven Rostedt's avatar
      tracing: add interface to write into current tracer buffer · ef5580d0
      Steven Rostedt authored
      
      Right now all tracers must manage their own trace buffers. This was
      to enforce tracers to be independent in case we finally decide to
      allow each tracer to have their own trace buffer.
      
      But now we are adding event tracing that writes to the current tracer's
      buffer. This adds an interface to allow events to write to the current
      tracer buffer without having to manage its own. Since event tracing
      has no "tracer", and is just a way to hook into any other tracer.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      ef5580d0
  7. 27 Feb, 2009 3 commits
    • Steven Rostedt's avatar
      tracing: replace kzalloc with kcalloc · 0cfe8245
      Steven Rostedt authored
      
      Impact: clean up
      
      kcalloc is a better approach to allocate a NULL array.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      0cfe8245
    • Steven Rostedt's avatar
      tracing: use newline separator for trace options list · 5c6a3ae1
      Steven Rostedt authored
      
      Impact: clean up
      
      Instead of listing the trace options like:
      
       # cat /debug/tracing/trace_options
      print-parent nosym-offset nosym-addr noverbose noraw nohex nobin noblock nostacktrace nosched-tree ftrace_printk noftrace_preempt nobranch annotate nouserstacktrace nosym-userobj
      
      We now list them like:
      
       # cat /debug/tracing/trace_options
      print-parent
      nosym-offset
      nosym-addr
      noverbose
      noraw
      nohex
      nobin
      noblock
      nostacktrace
      nosched-tree
      ftrace_printk
      noftrace_preempt
      nobranch
      annotate
      nouserstacktrace
      nosym-userobj
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5c6a3ae1
    • Steven Rostedt's avatar
      tracing: use pointer error returns for __tracing_open · 85a2f9b4
      Steven Rostedt authored
      
      Impact: fix compile warning and clean up
      
      When I first wrote __tracing_open, instead of passing the error
      code via the ERR_PTR macros, I lazily used a separate parameter
      to hold the return for errors.
      
      When Frederic Weisbecker updated that function, he used the Linux
      kernel ERR_PTR for the returns. This caused the parameter return
      to possibly not be initialized on error. gcc correctly pointed this
      out with a warning.
      
      This patch converts the entire function to use the Linux kernel
      ERR_PTR macro methods.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      85a2f9b4
  8. 26 Feb, 2009 4 commits
  9. 25 Feb, 2009 3 commits
    • Frederic Weisbecker's avatar
      tracing/core: make the read callbacks reentrants · d7350c3f
      Frederic Weisbecker authored
      
      Now that several per-cpu files can be read or spliced at the
      same, we want the read/splice callbacks for tracing files to be
      reentrants.
      
      Until now, a single global mutex (trace_types_lock) serialized
      the access to tracing_read_pipe(), tracing_splice_read_pipe(),
      and the seq helpers.
      
      Ie: it means that if a user tries to read trace_pipe0 and
      trace_pipe1 at the same time, the access to the function
      tracing_read_pipe() is contended and one reader must wait for
      the other to finish its read call.
      
      The trace_type_lock mutex is mostly here to serialize the access
      to the global current tracer (current_trace), which can be
      changed concurrently. Although the iter struct keeps a private
      pointer to this tracer, its callbacks can be changed by another
      function.
      
      The method used here is to not keep anymore private reference to
      the tracer inside the iterator but to make a copy of it inside
      the iterator. Then it checks on subsequents read calls if the
      tracer has changed. This is not costly because the current
      tracer is not expected to be changed often, so we use a branch
      prediction for that.
      
      Moreover, we add a private mutex to the iterator (there is one
      iterator per file descriptor) to serialize the accesses in case
      of multiple consumers per file descriptor (which would be a
      silly idea from the user). Note that this is not to protect the
      ring buffer, since the ring buffer already serializes the
      readers accesses. This is to prevent from traces weirdness in
      case of concurrent consumers. But these mutexes can be dropped
      anyway, that would not result in any crash. Just tell me what
      you think about it.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d7350c3f
    • Frederic Weisbecker's avatar
      tracing/core: introduce per cpu tracing files · b04cc6b1
      Frederic Weisbecker authored
      
      Impact: split up tracing output per cpu
      
      Currently, on the tracing debugfs directory, three files are
      available to the user to let him extracting the trace output:
      
      - trace is an iterator through the ring-buffer. It's a reader
        but not a consumer It doesn't block when no more traces are
        available.
      
      - trace pretty similar to the former, except that it adds more
        informations such as prempt count, irq flag, ...
      
      - trace_pipe is a reader and a consumer, it will also block
        waiting for traces if necessary (heh, yes it's a pipe).
      
      The traces coming from different cpus are curretly mixed up
      inside these files. Sometimes it messes up the informations,
      sometimes it's useful, depending on what does the tracer
      capture.
      
      The tracing_cpumask file is useful to filter the output and
      select only the traces captured a custom defined set of cpus.
      But still it is not enough powerful to extract at the same time
      one trace buffer per cpu.
      
      So this patch creates a new directory: /debug/tracing/per_cpu/.
      
      Inside this directory, you will now find one trace_pipe file and
      one trace file per cpu.
      
      Which means if you have two cpus, you will have:
      
       trace0
       trace1
       trace_pipe0
       trace_pipe1
      
      And of course, reading these files will have the same effect
      than with the usual tracing files, except that you will only see
      the traces from the given cpu.
      
      The original all-in-one cpu trace file are still available on
      their original place.
      
      Until now, only one consumer was allowed on trace_pipe to avoid
      racy consuming on the ring-buffer. Now the approach changed a
      bit, you can have only one consumer per cpu.
      
      Which means you are allowed to read concurrently trace_pipe0 and
      trace_pipe1 But you can't have two readers on trace_pipe0 or
      trace_pipe1.
      
      Following the same logic, if there is one reader on the common
      trace_pipe, you can not have at the same time another reader on
      trace_pipe0 or in trace_pipe1. Because in trace_pipe is already
      a consumer in all cpu buffers in essence.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b04cc6b1
    • Ingo Molnar's avatar
      tracing: remove /debug/tracing/latency_trace · 886b5b73
      Ingo Molnar authored
      
      Impact: remove old debug/tracing API
      
      /debug/tracing/latency_trace is an old legacy format we kept from
      the old latency tracer. Remove the file for now. If there's any
      useful bit missing then we'll propagate any useful output bits into
      the /debug/tracing/trace output.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      886b5b73
  10. 17 Feb, 2009 3 commits
  11. 11 Feb, 2009 3 commits
    • Hannes Eder's avatar
      tracing: fix sparse warning: attribute function with __acquires/__releases · e7669b8e
      Hannes Eder authored
      
      Fix this sparse warning:
      
        kernel/trace/trace.c:458:9: warning: context imbalance in 'register_tracer' - unexpected unlock
      Signed-off-by: default avatarHannes Eder <hannes@hanneseder.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e7669b8e
    • Hannes Eder's avatar
      tracing: fix sparse warnings: fix (un-)signedness · 5e39841c
      Hannes Eder authored
      
      Fix these sparse warnings:
      
        kernel/trace/ring_buffer.c:70:37: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:84:39: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:96:43: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:2475:13: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:2475:13: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:2478:42: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:2478:42: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:2500:40: warning: incorrect type in argument 3 (different signedness)
        kernel/trace/ring_buffer.c:2505:44: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/ring_buffer.c:2507:46: warning: incorrect type in argument 2 (different signedness)
        kernel/trace/trace.c:2130:40: warning: incorrect type in argument 3 (different signedness)
        kernel/trace/trace.c:2280:40: warning: incorrect type in argument 3 (different signedness)
      Signed-off-by: default avatarHannes Eder <hannes@hanneseder.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5e39841c
    • Hannes Eder's avatar
      tracing: fix sparse warnings: make symbols static · 4fd27358
      Hannes Eder authored
      
      Impact: make global variables and a global function static
      
      The function '__trace_userstack' does not seem to have a caller, so it
      is commented out.
      
      Fix this sparse warnings:
        kernel/trace/trace.c:82:5: warning: symbol 'tracing_disabled' was not declared. Should it be static?
        kernel/trace/trace.c:600:10: warning: symbol 'trace_record_cmdline_disabled' was not declared. Should it be static?
        kernel/trace/trace.c:957:6: warning: symbol '__trace_userstack' was not declared. Should it be static?
        kernel/trace/trace.c:1694:5: warning: symbol 'tracing_release' was not declared. Should it be static?
      Signed-off-by: default avatarHannes Eder <hannes@hanneseder.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4fd27358
  12. 10 Feb, 2009 1 commit
  13. 09 Feb, 2009 5 commits
  14. 07 Feb, 2009 1 commit
    • Steven Rostedt's avatar
      trace: remove deprecated entry->cpu · 1830b52d
      Steven Rostedt authored
      
      Impact: fix to prevent developers from using entry->cpu
      
      With the new ring buffer infrastructure, the cpu for the entry is
      implicit with which CPU buffer it is on.
      
      The original code use to record the current cpu into the generic
      entry header, which can be retrieved by entry->cpu. When the
      ring buffer was introduced, the users were convert to use the
      the cpu number of which cpu ring buffer was in use (this was passed
      to the tracers by the iterator: iter->cpu).
      
      Unfortunately, the cpu item in the entry structure was never removed.
      This allowed for developers to use it instead of the proper iter->cpu,
      unknowingly, using an uninitialized variable. This was not the fault
      of the developers, since it would seem like the logical place to
      retrieve the cpu identifier.
      
      This patch removes the cpu item from the entry structure and fixes
      all the users that should have been using iter->cpu.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      1830b52d
  15. 05 Feb, 2009 3 commits
    • Arnaldo Carvalho de Melo's avatar
      trace: Call tracing_reset_online_cpus before tracer->init() · b6f11df2
      Arnaldo Carvalho de Melo authored
      
      Impact: cleanup
      
      To make it easy for ftrace plugin writers, as this was open coded in
      the existing plugins
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarFrédéric Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b6f11df2
    • Arnaldo Carvalho de Melo's avatar
      tracing: Introduce trace_buffer_{lock_reserve,unlock_commit} · 51a763dd
      Arnaldo Carvalho de Melo authored
      
      Impact: new API
      
      These new functions do what previously was being open coded, reducing
      the number of details ftrace plugin writers have to worry about.
      
      It also standardizes the handling of stacktrace, userstacktrace and
      other trace options we may introduce in the future.
      
      With this patch, for instance, the blk tracer (and some others already
      in the tree) can use the "userstacktrace" /d/tracing/trace_options
      facility.
      
      $ codiff /tmp/vmlinux.before /tmp/vmlinux.after
      linux-2.6-tip/kernel/trace/trace.c:
        trace_vprintk              |   -5
        trace_graph_return         |  -22
        trace_graph_entry          |  -26
        trace_function             |  -45
        __ftrace_trace_stack       |  -27
        ftrace_trace_userstack     |  -29
        tracing_sched_switch_trace |  -66
        tracing_stop               |   +1
        trace_seq_to_user          |   -1
        ftrace_trace_special       |  -63
        ftrace_special             |   +1
        tracing_sched_wakeup_trace |  -70
        tracing_reset_online_cpus  |   -1
       13 functions changed, 2 bytes added, 355 bytes removed, diff: -353
      
      linux-2.6-tip/block/blktrace.c:
        __blk_add_trace |  -58
       1 function changed, 58 bytes removed, diff: -58
      
      linux-2.6-tip/kernel/trace/trace.c:
        trace_buffer_lock_reserve  |  +88
        trace_buffer_unlock_commit |  +86
       2 functions changed, 174 bytes added, diff: +174
      
      /tmp/vmlinux.after:
       16 functions changed, 176 bytes added, 413 bytes removed, diff: -237
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarFrédéric Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      51a763dd
    • Arnaldo Carvalho de Melo's avatar
      ring_buffer: remove unused flags parameter · 0a987751
      Arnaldo Carvalho de Melo authored
      
      Impact: API change, cleanup
      
      >From ring_buffer_{lock_reserve,unlock_commit}.
      
      $ codiff /tmp/vmlinux.before /tmp/vmlinux.after
      linux-2.6-tip/kernel/trace/trace.c:
        trace_vprintk              |  -14
        trace_graph_return         |  -14
        trace_graph_entry          |  -10
        trace_function             |   -8
        __ftrace_trace_stack       |   -8
        ftrace_trace_userstack     |   -8
        tracing_sched_switch_trace |   -8
        ftrace_trace_special       |  -12
        tracing_sched_wakeup_trace |   -8
       9 functions changed, 90 bytes removed, diff: -90
      
      linux-2.6-tip/block/blktrace.c:
        __blk_add_trace |   -1
       1 function changed, 1 bytes removed, diff: -1
      
      /tmp/vmlinux.after:
       10 functions changed, 91 bytes removed, diff: -91
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarFrédéric Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0a987751