11 Nov, 2011

1 commit


08 Nov, 2011

1 commit

  • In case the the graph tracer (CONFIG_FUNCTION_GRAPH_TRACER) or even the
    function tracer (CONFIG_FUNCTION_TRACER) are not set, the latency tracers
    do not display proper latency header.

    The involved/fixed latency tracers are:
    wakeup_rt
    wakeup
    preemptirqsoff
    preemptoff
    irqsoff

    The patch adds proper handling of tracer configuration options for latency
    tracers, and displaying correct header info accordingly.

    * The current output (for wakeup tracer) with both graph and function
    tracers disabled is:

    # tracer: wakeup
    #
    -0 0d.h5 1us+: 0:120:R + [000] 7: 0:R watchdog/0
    -0 0d.h5 3us+: ttwu_do_activate.clone.1 CPU#
    # / _-----=> irqs-off
    # | / _----=> need-resched
    # || / _---=> hardirq/softirq
    # ||| / _--=> preempt-depth
    # |||| / delay
    # cmd pid ||||| time | caller
    # \ / ||||| \ | /
    cat-1129 0d..4 1us : 1129:120:R + [000] 6: 0:R migration/0
    cat-1129 0d..4 2us+: ttwu_do_activate.clone.1 CPU#
    # / _-----=> irqs-off
    # | / _----=> need-resched
    # || / _---=> hardirq/softirq
    # ||| / _--=> preempt-depth
    # |||| / delay
    # cmd pid ||||| time | caller
    # \ / ||||| \ | /
    -0 1d.h5 1us+: 0:120:R + [001] 12: 0:R watchdog/1
    -0 1d.h5 3us : ttwu_do_activate.clone.1
    Cc: Ingo Molnar
    Signed-off-by: Jiri Olsa
    Signed-off-by: Steven Rostedt

    Jiri Olsa
     

26 Oct, 2011

1 commit

  • * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (121 commits)
    perf symbols: Increase symbol KSYM_NAME_LEN size
    perf hists browser: Refuse 'a' hotkey on non symbolic views
    perf ui browser: Use libslang to read keys
    perf tools: Fix tracing info recording
    perf hists browser: Elide DSO column when it is set to just one DSO, ditto for threads
    perf hists: Don't consider filtered entries when calculating column widths
    perf hists: Don't decay total_period for filtered entries
    perf hists browser: Honour symbol_conf.show_{nr_samples,total_period}
    perf hists browser: Do not exit on tab key with single event
    perf annotate browser: Don't change selection line when returning from callq
    perf tools: handle endianness of feature bitmap
    perf tools: Add prelink suggestion to dso update message
    perf script: Fix unknown feature comment
    perf hists browser: Apply the dso and thread filters when merging new batches
    perf hists: Move the dso and thread filters from hist_browser
    perf ui browser: Honour the xterm colors
    perf top tui: Give color hints just on the percentage, like on --stdio
    perf ui browser: Make the colors configurable and change the defaults
    perf tui: Remove unneeded call to newtCls on startup
    perf hists: Don't format the percentage on hist_entry__snprintf
    ...

    Fix up conflicts in arch/x86/kernel/kprobes.c manually.

    Ingo's tree did the insane "add volatile to const array", which just
    doesn't make sense ("volatile const"?). But we could remove the const
    *and* make the array volatile to make doubly sure that gcc doesn't
    optimize it away..

    Also fix up kernel/trace/ring_buffer.c non-data-conflicts manually: the
    reader_lock has been turned into a raw lock by the core locking merge,
    and there was a new user of it introduced in this perf core merge. Make
    sure that new use also uses the raw accessor functions.

    Linus Torvalds
     

22 Sep, 2011

1 commit


13 Sep, 2011

1 commit

  • The tracing locks can be taken in atomic context and therefore
    cannot be preempted on -rt - annotate it.

    In mainline this change documents the low level nature of
    the lock - otherwise there's no functional difference. Lockdep
    and Sparse checking will work as usual.

    Signed-off-by: Thomas Gleixner
    Signed-off-by: Ingo Molnar

    Thomas Gleixner
     

15 Jun, 2011

1 commit

  • The display of absolute time and duration fields is based on the
    latency field. This was added during the irqsoff/wakeup tracers
    graph support changes.

    It's causing confusion in what fields will be displayed for the
    function_graph tracer itself. So I'm removing this depency, and
    adding absolute time and duration fields to the preemptirqsoff
    preemptoff irqsoff wakeup tracers.

    With following commands:
    # echo function_graph > ./current_tracer
    # cat trace

    This is what it looked like before:
    # tracer: function_graph
    #
    # TIME CPU DURATION FUNCTION CALLS
    # | | | | | | | |
    0) 0.068 us | } /* page_add_file_rmap */
    0) | _raw_spin_unlock() {
    ...

    This is what it looks like now:
    # tracer: function_graph
    #
    # CPU DURATION FUNCTION CALLS
    # | | | | | | |
    0) 0.068 us | } /* add_preempt_count */
    0) 0.993 us | } /* vfsmount_lock_local_lock */
    ...

    For preemptirqsoff preemptoff irqsoff wakeup tracers,
    this is what it looked like before:
    SNIP
    # _-----=> irqs-off
    # / _----=> need-resched
    # | / _---=> hardirq/softirq
    # || / _--=> preempt-depth
    # ||| / _-=> lock-depth
    # |||| /
    # CPU TASK/PID ||||| DURATION FUNCTION CALLS
    # | | | ||||| | | | | | |
    1) -0 | d..1 0.000 us | acpi_idle_enter_simple();
    ...

    This is what it looks like now:
    SNIP
    #
    # _-----=> irqs-off
    # / _----=> need-resched
    # | / _---=> hardirq/softirq
    # || / _--=> preempt-depth
    # ||| /
    # TIME CPU TASK/PID |||| DURATION FUNCTION CALLS
    # | | | | |||| | | | | | |
    19.847735 | 1) -0 | d..1 0.000 us | acpi_idle_enter_simple();
    ...

    Signed-off-by: Jiri Olsa
    Link: http://lkml.kernel.org/r/1307113131-10045-2-git-send-email-jolsa@redhat.com
    Signed-off-by: Steven Rostedt

    Jiri Olsa
     

19 May, 2011

1 commit

  • ftrace_ops that are registered to trace functions can now be
    agnostic to each other in respect to what functions they trace.
    Each ops has their own hash of the functions they want to trace
    and a hash to what they do not want to trace. A empty hash for
    the functions they want to trace denotes all functions should
    be traced that are not in the notrace hash.

    Cc: Paul E. McKenney
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

31 Mar, 2011

1 commit


20 Jan, 2011

1 commit

  • During early boot, local IRQ is disabled until IRQ subsystem is
    properly initialized. During this time, no one should enable
    local IRQ and some operations which usually are not allowed with
    IRQ disabled, e.g. operations which might sleep or require
    communications with other processors, are allowed.

    lockdep tracked this with early_boot_irqs_off/on() callbacks.
    As other subsystems need this information too, move it to
    init/main.c and make it generally available. While at it,
    toggle the boolean to early_boot_irqs_disabled instead of
    enabled so that it can be initialized with %false and %true
    indicates the exceptional condition.

    Signed-off-by: Tejun Heo
    Acked-by: Peter Zijlstra
    Acked-by: Pekka Enberg
    Cc: Linus Torvalds
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Tejun Heo
     

18 Oct, 2010

2 commits


21 Jul, 2010

1 commit

  • Documentation/trace/ftrace.txt says

    buffer_size_kb:

    This sets or displays the number of kilobytes each CPU
    buffer can hold. The tracer buffers are the same size
    for each CPU. The displayed number is the size of the
    CPU buffer and not total size of all buffers. The
    trace buffers are allocated in pages (blocks of memory
    that the kernel uses for allocation, usually 4 KB in size).
    If the last page allocated has room for more bytes
    than requested, the rest of the page will be used,
    making the actual allocation bigger than requested.
    ( Note, the size may not be a multiple of the page size
    due to buffer management overhead. )

    This can only be updated when the current_tracer
    is set to "nop".

    But it's incorrect. currently total memory consumption is
    'buffer_size_kb x CPUs x 2'.

    Why two times difference is there? because ftrace implicitly allocate
    the buffer for max latency too.

    That makes sad result when admin want to use large buffer. (If admin
    want full logging and makes detail analysis). example, If admin
    have 24 CPUs machine and write 200MB to buffer_size_kb, the system
    consume ~10GB memory (200MB x 24 x 2). umm.. 5GB memory waste is
    usually unacceptable.

    Fortunatelly, almost all users don't use max latency feature.
    The max latency buffer can be disabled easily.

    This patch shrink buffer size of the max latency buffer if
    unnecessary.

    Signed-off-by: KOSAKI Motohiro
    LKML-Reference:
    Signed-off-by: Steven Rostedt

    KOSAKI Motohiro
     

28 Apr, 2010

1 commit


12 Dec, 2009

1 commit

  • The irqsoff and friends tracers help in finding causes of latency in the
    kernel. The also work with the function tracer to show what was happening
    when interrupts or preemption are disabled. But the function tracer has
    a bit of an overhead and can cause exagerated readings.

    Currently, when tracing with /proc/sys/kernel/ftrace_enabled = 0, where the
    function tracer is disabled, the information that is provided can end up
    being useless. For example, a 2 and a half millisecond latency only showed:

    # tracer: preemptirqsoff
    #
    # preemptirqsoff latency trace v1.1.5 on 2.6.32
    # --------------------------------------------------------------------
    # latency: 2463 us, #4/4, CPU#2 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
    # -----------------
    # | task: -4242 (uid:0 nice:0 policy:0 rt_prio:0)
    # -----------------
    # => started at: _spin_lock_irqsave
    # => ended at: remove_wait_queue
    #
    #
    # _------=> CPU#
    # / _-----=> irqs-off
    # | / _----=> need-resched
    # || / _---=> hardirq/softirq
    # ||| / _--=> preempt-depth
    # |||| /_--=> lock-depth
    # |||||/ delay
    # cmd pid |||||| time | caller
    # \ / |||||| \ | /
    hackbenc-4242 2d.... 0us!: trace_hardirqs_off
    => sub_preempt_count
    => _spin_unlock_irqrestore
    => remove_wait_queue
    => free_poll_entry
    => poll_freewait
    => do_sys_poll
    => sys_poll
    => system_call_fastpath

    Now we see that the culprit of this latency was the free_poll_entry code.

    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

13 Sep, 2009

2 commits


05 Sep, 2009

1 commit

  • Currently the latency tracers reset the ring buffer. Unfortunately
    if a commit is in process (due to a trace event), this can corrupt
    the ring buffer. When this happens, the ring buffer will detect
    the corruption and then permanently disable the ring buffer.

    The bug does not crash the system, but it does prevent further tracing
    after the bug is hit.

    Instead of reseting the trace buffers, the timestamp of the start of
    the trace is used instead. The buffers will still contain the previous
    data, but the output will not count any data that is before the
    timestamp of the trace.

    Note, this only affects the static trace output (trace) and not the
    runtime trace output (trace_pipe). The runtime trace output does not
    make sense for the latency tracers anyway.

    Reported-by: Arnaldo Carvalho de Melo
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

05 Mar, 2009

1 commit

  • 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: Steven Rostedt

    Steven Rostedt
     

18 Feb, 2009

1 commit


05 Feb, 2009

1 commit


23 Jan, 2009

1 commit


16 Jan, 2009

1 commit

  • Impact: trace max latencies on start of latency tracing

    This patch sets the max latency to zero whenever one of the
    irq variant tracers or the wakeup tracer is set to current tracer.

    Most developers expect to see output when starting up a latency
    tracer. But since the max_latency is already set to max, and
    it takes a latency greater than max_latency to be recorded, there
    is no trace. This is not the expected behavior and has even confused
    myself.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

16 Nov, 2008

1 commit

  • Impact: extend the ->init() method with the ability to fail

    This bring a way to know if the initialization of a tracer successed.
    A tracer must return 0 on success and a traditional error (ie:
    -ENOMEM) if it fails.

    If a tracer fails to init, it is free to print a detailed warn. The
    tracing api will not and switch to a new tracer will just return the
    error from the init callback.

    Note: this will be used for the return tracer.

    Signed-off-by: Frederic Weisbecker
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

08 Nov, 2008

3 commits

  • Impact: remove obsolete variable in trace_array structure

    With the new start / stop method of ftrace, the ctrl variable
    in the trace_array structure is now obsolete. Remove it.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     
  • Impact: Remove the ctrl_update tracer method

    With the new quick start/stop method of tracing, the ctrl_update
    method is out of date.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     
  • Impact: fix to irqsoff tracer output

    In converting to the new start / stop ftrace handling, the irqsoff
    tracer start called the irqsoff reset function. irqsoff tracer is
    not the same as the other traces, and it resets the buffers while
    searching for the longest latency.

    The reset that the irqsoff stop method calls disables the function
    tracing. That means that, by starting the tracer, the function
    tracer is disabled incorrectly.

    This patch simply removes the call to reset which keeps the function
    tracing enabled. Reset is not needed for the irqsoff stop method.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

06 Nov, 2008

1 commit

  • Impact: change where tracing is started up and stopped

    Currently, when a new tracer is selected via echo'ing a tracer name into
    the current_tracer file, the startup is only done if tracing_enabled is
    set to one. If tracing_enabled is changed to zero (by echo'ing 0 into
    the tracing_enabled file) a full shutdown is performed.

    The full startup and shutdown of a tracer can be expensive and the
    user can lose out traces when echo'ing in 0 to the tracing_enabled file,
    because the process takes too long. There can also be places that
    the user would like to start and stop the tracer several times and
    doing the full startup and shutdown of a tracer might be too expensive.

    This patch performs the full startup and shutdown when a tracer is
    selected. It also adds a way to do a quick start or stop of a tracer.
    The quick version is just a flag that prevents the tracing from
    taking place, but the overhead of the code is still there.

    For example, the startup of a tracer may enable tracepoints, or enable
    the function tracer. The stop and start will just set a flag to
    have the tracer ignore the calls when the tracepoint or function trace
    is called. The overhead of the tracer may still be present when
    the tracer is stopped, but no tracing will occur. Setting the tracer
    to the 'nop' tracer (or any other tracer) will perform the shutdown
    of the tracer which will disable the tracepoint or disable the
    function tracer.

    The tracing_enabled file will simply start or stop tracing.

    This change is all internal. The end result for the user should be the same
    as before. If tracing_enabled is not set, no trace will happen.
    If tracing_enabled is set, then the trace will happen. The tracing_enabled
    variable is static between tracers. Enabling tracing_enabled and
    going to another tracer will keep tracing_enabled enabled. Same
    is true with disabling tracing_enabled.

    This patch will now provide a fast start/stop method to the users
    for enabling or disabling tracing.

    Note: There were two methods to the struct tracer that were never
    used: The methods start and stop. These were to be used as a hook
    to the reading of the trace output, but ended up not being
    necessary. These two methods are now used to enable the start
    and stop of each tracer, in case the tracer needs to do more than
    just not write into the buffer. For example, the irqsoff tracer
    must stop recording max latencies when tracing is stopped.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

21 Oct, 2008

1 commit

  • Due to confusion between the ftrace infrastructure and the gcc profiling
    tracer "ftrace", this patch renames the config options from FTRACE to
    FUNCTION_TRACER. The other two names that are offspring from FTRACE
    DYNAMIC_FTRACE and FTRACE_MCOUNT_RECORD will stay the same.

    This patch was generated mostly by script, and partially by hand.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

14 Oct, 2008

3 commits

  • The assigning of the pc counter is in the wrong spot in the
    check_critical_timing function. The pc variable is used in the
    out jump.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     
  • With the new ring buffer infrastructure in ftrace, I'm trying to make
    ftrace a little more light weight.

    This patch converts a lot of the local_irq_save/restore into
    preempt_disable/enable. The original preempt count in a lot of cases
    has to be sent in as a parameter so that it can be recorded correctly.
    Some places were recording it incorrectly before anyway.

    This is also laying the ground work to make ftrace a little bit
    more reentrant, and remove all locking. The function tracers must
    still protect from reentrancy.

    Note: All the function tracers must be careful when using preempt_disable.
    It must do the following:

    resched = need_resched();
    preempt_disable_notrace();
    [...]
    if (resched)
    preempt_enable_no_resched_notrace();
    else
    preempt_enable_notrace();

    The reason is that if this function traces schedule() itself, the
    preempt_enable_notrace() will cause a schedule, which will lead
    us into a recursive failure.

    If we needed to reschedule before calling preempt_disable, we
    should have already scheduled. Since we did not, this is most
    likely that we should not and are probably inside a schedule
    function.

    If resched was not set, we still need to catch the need resched
    flag being set when preemption was off and the if case at the
    end will catch that for us.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     
  • This patch ports ftrace over to the new ring buffer.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

26 Jul, 2008

1 commit


19 Jul, 2008

1 commit

  • When PREEMPT_TRACER and IRQSOFF_TRACER are both configured and irqsoff
    tracer is running, the preempt_off sections might also be traced.

    Thanks to Andrew Morton for pointing out my mistake of spin_lock disabling
    interrupts while he was reviewing ftrace.txt. Seems that my example I used
    actually hit this bug.

    Signed-off-by: Steven Rostedt
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    Signed-off-by: Ingo Molnar

    Steven Rostedt
     

27 May, 2008

1 commit

  • Printing out new max latencies was fine for the old RT tracer. But for
    mainline it is a bit messy. We also need to test if the run queue
    is locked before we can do the print. This means that we may not be
    printing out latencies if the run queue is locked on another CPU.
    This produces inconsistencies in the output.

    This patch simply removes the print altogether.

    Signed-off-by: Steven Rostedt
    Cc: pq@iki.fi
    Cc: proski@gnu.org
    Cc: sandmann@redhat.com
    Cc: a.p.zijlstra@chello.nl
    Signed-off-by: Thomas Gleixner

    Steven Rostedt
     

24 May, 2008

6 commits

  • This patch changes the use of __get_cpu_var to explicitly calling
    raw_smp_processor_id and using the per_cpu() macro. On some debug
    configurations, the use of __get_cpu_var may cause ftrace to trigger
    and this can cause problems with the irqsoff tracing.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Steven Rostedt
     
  • printk called from wakeup critical timings and irqs off can
    cause deadlocks since printk might do a wakeup itself. If the
    call to printk happens with the runqueue lock held, it can
    deadlock.

    This patch protects the printk from being called in trace irqs off
    with a test to see if the runqueue for the current CPU is locked.
    If it is locked, the printk is skipped.

    The wakeup always holds the runqueue lock, so the printk is
    simply removed.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Steven Rostedt
     
  • now that we have a kbuild method for notrace, no need to pollute the
    C code with the annotations.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Ingo Molnar
     
  • clean up recent code.

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Ingo Molnar
     
  • A new check was added in the ftrace function that wont trace if the CPU
    trace buffer is disabled. Unfortunately, other tracers used ftrace() to
    write to the buffer after they disabled it. The new disable check makes
    these calls into a nop.

    This patch changes the __ftrace that is called without the check into a
    new api for the other tracers to use, called "trace_function". The other
    tracers use this interface instead when the trace CPU buffer is already
    disabled.

    Signed-off-by: Steven Rostedt
    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Steven Rostedt
     
  • rename and uninline now() to ftrace_now().

    Signed-off-by: Ingo Molnar
    Signed-off-by: Thomas Gleixner

    Ingo Molnar