1. 07 3月, 2009 5 次提交
    • L
      tracing: add trace_bprintk() · 1ba28e02
      Lai Jiangshan 提交于
      Impact: add a generic printk() for tracing, like trace_printk()
      
      trace_bprintk() uses the infrastructure to record events on ring_buffer.
      
      [ fweisbec@gmail.com: ported to latest -tip, made it work if
        !CONFIG_MODULES, never free the format strings from modules
        because we can't keep track of them and conditionnaly create
        the ftrace format strings section (reported by Steven Rostedt) ]
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1ba28e02
    • L
      tracing: infrastructure for supporting binary record · 1427cdf0
      Lai Jiangshan 提交于
      Impact: save on memory for tracing
      
      Current tracers are typically using a struct(like struct ftrace_entry,
      struct ctx_switch_entry, struct special_entr etc...)to record a binary
      event. These structs can only record a their own kind of events.
      A new kind of tracer need a new struct and a lot of code too handle it.
      
      So we need a generic binary record for events. This infrastructure
      is for this purpose.
      
      [fweisbec@gmail.com: rebase against latest -tip, make it safe while sched
      tracing as reported by Steven Rostedt]
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1427cdf0
    • I
      Merge branch 'core/printk' into tracing/ftrace · 546e5354
      Ingo Molnar 提交于
      546e5354
    • F
      vsprintf: unify the format decoding layer for its 3 users · fef20d9c
      Frederic Weisbecker 提交于
      An new optimization is making its way to ftrace. Its purpose is to
      make trace_printk() consuming less memory and be faster.
      
      Written by Lai Jiangshan, the approach is to delay the formatting
      job from tracing time to output time.
      
      Currently, a call to trace_printk() will format the whole string and
      insert it into the ring buffer. Then you can read it on /debug/tracing/trace
      file.
      
      The new implementation stores the address of the format string and
      the binary parameters into the ring buffer, making the packet more compact
      and faster to insert.
      Later, when the user exports the traces, the format string is retrieved
      with the binary parameters and the formatting job is eventually done.
      
      The new implementation rewrites a lot of format decoding bits from
      vsnprintf() function, making now 3 differents functions to maintain
      in their duplicated parts of printf format decoding bits.
      
      Suggested by Ingo Molnar, this patch tries to factorize the most
      possible common bits from these functions.
      The real common part between them is the format decoding. Although
      they do somewhat similar jobs, their way to export or import the parameters
      is very different. Thus, only the decoding layer is extracted, unless you see
      other parts that could be worth factorized.
      
      Changes in V2:
      
      - Address a suggestion from Linus to group the format_decode() parameters inside
        a structure.
      
      Changes in v3:
      
      - Address other cleanups suggested by Ingo and Linus such as passing the
        printf_spec struct to the format helpers: pointer()/number()/string()
        Note that this struct is passed by copy and not by address. This is to
        avoid side effects because these functions often change these values and the
        changes shoudn't be persistant when a callee helper returns.
        It would be too risky.
      
      - Various cleanups (code alignement, switch/case instead of if/else fountains).
      
      - Fix a bug that printed the first format specifier following a %p
      
      Changes in v4:
      
      - drop unapropriate const qualifier loss while casting fmt to a char *
        (thanks to Vegard Nossum for having pointed this out).
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-6-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fef20d9c
    • L
      vsprintf: add binary printf · 4370aa4a
      Lai Jiangshan 提交于
      Impact: add new APIs for binary trace printk infrastructure
      
      vbin_printf(): write args to binary buffer, string is copied
      when "%s" is occurred.
      
      bstr_printf(): read from binary buffer for args and format a string
      
      [fweisbec@gmail.com: rebase]
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <1236356510-8381-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4370aa4a
  2. 06 3月, 2009 9 次提交
  3. 05 3月, 2009 19 次提交
    • S
      tracing: add tracing_on/tracing_off to kernel.h · 2002c258
      Steven Rostedt 提交于
      Impact: cleanup
      
      The functions tracing_start/tracing_stop have been moved to kernel.h.
      These are not the functions a developer most likely wants to use
      when they want to insert a place to stop tracing and restart it from
      user space.
      
      tracing_start/tracing_stop was created to work with things like
      suspend to ram, where even calling smp_processor_id() can crash the
      system. The tracing_start/tracing_stop was used to stop the tracer from
      doing anything. These are still light weight functions, but add a bit
      more overhead to be able to stop the tracers. They also have no interface
      back to userland. That is, if the kernel calls tracing_stop, userland
      can not start tracing.
      
      What a developer most likely wants to use is tracing_on/tracing_off.
      These are very light weight functions (simply sets or clears a bit).
      These functions just stop recording into the ring buffer. The tracers
      don't even know that this happens except that they would receive NULL
      from the ring_buffer_lock_reserve function.
      
      Also, there's a way for the user land to enable or disable this bit.
      In debugfs/tracing/tracing_on, a user may echo "0" (same as tracing_off())
      or echo "1" (same as tracing_on()) into this file. This becomes handy when
      a kernel developer is debugging and wants tracing to turn off when it
      hits an anomaly. Then the developer can examine the trace, and restart
      tracing if they want to try again (echo 1 > tracing_on).
      
      This patch moves the prototypes for tracing_on/tracing_off to kernel.h
      and comments their use, so that a kernel developer will know how
      to use them.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      2002c258
    • F
      tracing/function-graph-tracer: use the more lightweight local clock · 0012693a
      Frederic Weisbecker 提交于
      Impact: decrease hangs risks with the graph tracer on slow systems
      
      Since the function graph tracer can spend too much time on timer
      interrupts, it's better now to use the more lightweight local
      clock. Anyway, the function graph traces are more reliable on a
      per cpu trace.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <49af243d.06e9300a.53ad.ffff840c@mx.google.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0012693a
    • I
      tracing: move utility functions from ftrace.h to kernel.h · 526211bc
      Ingo Molnar 提交于
      Make common utility functions such as trace_printk() and
      tracing_start()/tracing_stop() generally available to kernel
      code.
      
      Cc: Steven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      526211bc
    • I
      tracing: rename ftrace_printk() => trace_printk() · 5e1607a0
      Ingo Molnar 提交于
      Impact: cleanup
      
      Use a more generic name - this also allows the prototype to move
      to kernel.h and be generally available to kernel developers who
      want to do some quick tracing.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5e1607a0
    • I
      Merge branch 'tip/tracing/ftrace' of... · 53664738
      Ingo Molnar 提交于
      Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/ftrace
      53664738
    • I
      Merge branch 'tracing/ftrace' into tracing/core · c4ef144a
      Ingo Molnar 提交于
      c4ef144a
    • S
      tracing: have latency tracers set the latency format · e9d25fe6
      Steven Rostedt 提交于
      The latency tracers (irqsoff, preemptoff, preemptirqsoff, and wakeup)
      are pretty useless with the default output format. This patch makes them
      automatically enable the latency format when they are selected. They
      also record the state of the latency option, and if it was not enabled
      when selected, they disable it on reset.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      e9d25fe6
    • S
      tracing: consolidate print_lat_fmt and print_trace_fmt · 27d48be8
      Steven Rostedt 提交于
      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: NSteven Rostedt <srostedt@redhat.com>
      27d48be8
    • S
      tracing: remove extra latency_trace method from trace structure · 5fd73f86
      Steven Rostedt 提交于
      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: NSteven Rostedt <srostedt@redhat.com>
      5fd73f86
    • S
      tracing: add latency output format option · c032ef64
      Steven Rostedt 提交于
      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: NSteven Rostedt <srostedt@redhat.com>
      c032ef64
    • S
      tracing: fix seq read from trace files · e74da523
      Steven Rostedt 提交于
      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: NSteven Rostedt <srostedt@redhat.com>
      e74da523
    • S
      tracing: do not return EFAULT if read copied anything · 2dc5d12b
      Steven Rostedt 提交于
      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: NSteven Rostedt <srostedt@redhat.com>
      2dc5d12b
    • S
      ring-buffer: fix timestamp in partial ring_buffer_page_read · 4f3640f8
      Steven Rostedt 提交于
      If a partial ring_buffer_page_read happens, then some of the
      incremental timestamps may be lost. This patch writes the
      recent timestamp into the page that is passed back to the caller.
      
      A partial ring_buffer_page_read is where the full page would not
      be written back to the user, and instead, just part of the page
      is copied to the user. A full page would be a page swap with the
      ring buffer and the timestamps would be correct.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      4f3640f8
    • S
      tracing: add cpu_file intialization for ftrace_dump · e543ad76
      Steven Rostedt 提交于
      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: NThomas Gleixner <tglx@linuxtronix.de>
      Tested-by: NDarren Hart <dvhtc@us.ibm.com>
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      e543ad76
    • P
      tracing: add lockdep tracepoints for lock acquire/release · efed792d
      Peter Zijlstra 提交于
      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: NPeter 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: NIngo Molnar <mingo@elte.hu>
      efed792d
    • I
      Merge branch 'core/locking' into tracing/ftrace · 28b1bd1c
      Ingo Molnar 提交于
      28b1bd1c
    • P
      lockdep: require framepointers for x86 · 1075414b
      Peter Zijlstra 提交于
      Require framepointers for x86, because otherwise we'll be having
      empty stack traces, which is useless.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1236167295.5330.7240.camel@laptop>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1075414b
    • P
      lockdep: remove extra "irq" string · 26575e28
      Peter Zijlstra 提交于
      Impact: clarify lockdep printk text
      
      print_irq_inversion_bug() gets handed state strings of the form
      
        "HARDIRQ", "SOFTIRQ", "RECLAIM_FS"
      
      and appends "-irq-{un,}safe" to them, which is either redudant for *IRQ or
      confusing in the RECLAIM_FS case.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1236175192.5330.7585.camel@laptop>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      26575e28
    • P
      lockdep: fix incorrect state name · 1c21f14e
      Peter Zijlstra 提交于
      In the recent mark_lock_irq() rework a bug snuck in that would report the
      state of write locks causing irq inversion under a read lock as a read
      lock.
      
      Fix this by masking the read bit of the state when validating write
      dependencies.
      Reported-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <1236172646.5330.7450.camel@laptop>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1c21f14e
  4. 04 3月, 2009 7 次提交