15 Dec, 2009

1 commit


08 Nov, 2009

2 commits

  • The macro used to be used in both trace_selftest.c and
    trace_ksym.c, but no longer, so remove it from header file.

    Signed-off-by: Li Zefan
    Cc: Prasad
    Signed-off-by: Frederic Weisbecker

    Li Zefan
     
  • This patch rebase the implementation of the breakpoints API on top of
    perf events instances.

    Each breakpoints are now perf events that handle the
    register scheduling, thread/cpu attachment, etc..

    The new layering is now made as follows:

    ptrace kgdb ftrace perf syscall
    \ | / /
    \ | / /
    /
    Core breakpoint API /
    /
    | /
    | /

    Breakpoints perf events

    |
    |

    Breakpoints PMU ---- Debug Register constraints handling
    (Part of core breakpoint API)
    |
    |

    Hardware debug registers

    Reasons of this rewrite:

    - Use the centralized/optimized pmu registers scheduling,
    implying an easier arch integration
    - More powerful register handling: perf attributes (pinned/flexible
    events, exclusive/non-exclusive, tunable period, etc...)

    Impact:

    - New perf ABI: the hardware breakpoints counters
    - Ptrace breakpoints setting remains tricky and still needs some per
    thread breakpoints references.

    Todo (in the order):

    - Support breakpoints perf counter events for perf tools (ie: implement
    perf_bpcounter_event())
    - Support from perf tools

    Changes in v2:

    - Follow the perf "event " rename
    - The ptrace regression have been fixed (ptrace breakpoint perf events
    weren't released when a task ended)
    - Drop the struct hw_breakpoint and store generic fields in
    perf_event_attr.
    - Separate core and arch specific headers, drop
    asm-generic/hw_breakpoint.h and create linux/hw_breakpoint.h
    - Use new generic len/type for breakpoint
    - Handle off case: when breakpoints api is not supported by an arch

    Changes in v3:

    - Fix broken CONFIG_KVM, we need to propagate the breakpoint api
    changes to kvm when we exit the guest and restore the bp registers
    to the host.

    Changes in v4:

    - Drop the hw_breakpoint_restore() stub as it is only used by KVM
    - EXPORT_SYMBOL_GPL hw_breakpoint_restore() as KVM can be built as a
    module
    - Restore the breakpoints unconditionally on kvm guest exit:
    TIF_DEBUG_THREAD doesn't anymore cover every cases of running
    breakpoints and vcpu->arch.switch_db_regs might not always be
    set when the guest used debug registers.
    (Waiting for a reliable optimization)

    Changes in v5:

    - Split-up the asm-generic/hw-breakpoint.h moving to
    linux/hw_breakpoint.h into a separate patch
    - Optimize the breakpoints restoring while switching from kvm guest
    to host. We only want to restore the state if we have active
    breakpoints to the host, otherwise we don't care about messed-up
    address registers.
    - Add asm/hw_breakpoint.h to Kbuild
    - Fix bad breakpoint type in trace_selftest.c

    Changes in v6:

    - Fix wrong header inclusion in trace.h (triggered a build
    error with CONFIG_FTRACE_SELFTEST

    Signed-off-by: Frederic Weisbecker
    Cc: Prasad
    Cc: Alan Stern
    Cc: Peter Zijlstra
    Cc: Arnaldo Carvalho de Melo
    Cc: Steven Rostedt
    Cc: Ingo Molnar
    Cc: Jan Kiszka
    Cc: Jiri Slaby
    Cc: Li Zefan
    Cc: Avi Kivity
    Cc: Paul Mackerras
    Cc: Mike Galbraith
    Cc: Masami Hiramatsu
    Cc: Paul Mundt

    Frederic Weisbecker
     

07 Sep, 2009

1 commit


06 Aug, 2009

1 commit


03 Jun, 2009

1 commit


07 Apr, 2009

2 commits


22 Mar, 2009

2 commits

  • Instead of using ftrace_dump_on_oops, it's far more convenient
    to have the trace leading up to a self-test failure available
    in /debug/tracing/trace.

    Signed-off-by: Frederic Weisbecker
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     
  • Impact: detect tracing related hangs

    Sometimes, with some configs, the function graph tracer can make
    the timer interrupt too much slow, hanging the kernel in an endless
    loop of timer interrupts servicing.

    As suggested by Ingo, this patch brings a watchdog which stops the
    selftest after a defined number of functions traced, definitely
    disabling this tracer.

    For those who want to debug the cause of the function graph trace
    hang, you can pass the ftrace_dump_on_oops kernel parameter to dump
    the traces after this hang detection.

    Signed-off-by: Frederic Weisbecker
    Cc: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

18 Mar, 2009

1 commit

  • Impact: fix a selftest warning

    In some cases, it's possible to see the following warning on irqsoff
    tracer selftest:

    [ 4.640003] Testing tracer irqsoff: ------------[ cut here ]------------
    [ 4.653562] WARNING: at kernel/trace/trace.c:458 update_max_tr_single+0x9a/0xc4()
    [ 4.660000] Hardware name: System Product Name
    [ 4.660000] Modules linked in:
    [ 4.660000] Pid: 301, comm: kstop/1 Not tainted 2.6.29-rc8-tip #35837
    [ 4.660000] Call Trace:
    [ 4.660000] [] warn_slowpath+0x79/0x8f
    [ 4.660000] [] ? put_dec+0x64/0x6b
    [ 4.660000] [] ? getnstimeofday+0x58/0xdd
    [ 4.660000] [] ? clocksource_read+0x3/0xf
    [ 4.660000] [] ? ktime_set+0x8/0x34
    [ 4.660000] [] ? balance_runtime+0x8/0x56
    [ 4.660000] [] ? _spin_lock+0x3/0x10
    [ 4.660000] [] ? ftrace_call+0x5/0x8
    [ 4.660000] [] ? task_cputime_zero+0x3/0x27
    [ 4.660000] [] ? cpupri_set+0x90/0xcb
    [ 4.660000] [] ? _spin_lock_irqsave+0x22/0x34
    [ 4.660000] [] ? cpupri_set+0xbb/0xcb
    [ 4.660000] [] ? _spin_unlock_irqrestore+0x23/0x35
    [ 4.660000] [] ? ring_buffer_reset_cpu+0x27/0x51
    [ 4.660000] [] ? _spin_lock_irqsave+0x22/0x34
    [ 4.660000] [] ? ring_buffer_reset_cpu+0x4a/0x51
    [ 4.660000] [] ? _spin_unlock_irqrestore+0x23/0x35
    [ 4.660000] [] ? trace_hardirqs_off+0x1a/0x1c
    [ 4.660000] [] ? _spin_unlock_irqrestore+0x23/0x35
    [ 4.660000] [] ? ring_buffer_reset_cpu+0x4a/0x51
    [ 4.660000] [] ? cpumask_next+0x15/0x18
    [ 4.660000] [] update_max_tr_single+0x9a/0xc4
    [ 4.660000] [] ? exit_notify+0x16/0xf2
    [ 4.660000] [] check_critical_timing+0xcc/0x11e
    [ 4.660000] [] ? exit_notify+0x16/0xf2
    [ 4.660000] [] ? exit_notify+0x16/0xf2
    [ 4.660000] [] stop_critical_timing+0x8c/0x9f
    [ 4.660000] [] ? forget_original_parent+0xac/0xd0
    [ 4.660000] [] trace_hardirqs_on+0x1a/0x1c
    [ 4.660000] [] forget_original_parent+0xac/0xd0
    [ 4.660000] [] exit_notify+0x16/0xf2
    [ 4.660000] [] do_exit+0x1cb/0x225
    [ 4.660000] [] ? kthread+0x0/0x69
    [ 4.660000] [] kernel_thread_helper+0xd/0x10
    [ 4.660000] ---[ end trace a7919e7f17c0a725 ]---
    [ 4.660164] .. no entries found ..FAILED!

    During the selftest of irqsoff tracer, we do that:

    /* disable interrupts for a bit */
    local_irq_disable();
    udelay(100);
    local_irq_enable();
    /* stop the tracing. */
    tracing_stop();
    /* check both trace buffers */
    ret = trace_test_buffer(tr, NULL);

    If a callsite performs a new max delay with irqs off just after
    tracing_stop, update_max_tr_single() -> ring_buffer_swap_cpu()
    will be called with the buffers disabled by tracing_stop(), hence
    the warning, then ring_buffer_swap_cpu() return -EAGAIN and
    update_max_tr_single() complains.

    Fix it by also stopping the tracer before stopping the tracing globally.
    A similar situation can happen with preemptoff and preemptirqsoff tracers
    where we apply the same fix.

    Reported-by: Ingo Molnar
    Signed-off-by: Frederic Weisbecker
    Acked-by: Steven Rostedt
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

16 Mar, 2009

1 commit

  • Impact: fix a warning during preemptirqsoff selftests

    When the preemptirqsoff selftest fails, we see the following
    warning:

    [ 6.050000] Testing tracer preemptirqsoff: .. no entries found ..
    ------------[ cut here ]------------
    [ 6.060000] WARNING: at kernel/trace/trace.c:688 tracing_start+0x67/0xd3()
    [ 6.060000] Modules linked in:
    [ 6.060000] Pid: 1, comm: swapper Tainted: G
    [ 6.060000] Call Trace:
    [ 6.060000] [] warn_slowpath+0xb1/0x100
    [ 6.060000] [] ? trace_preempt_on+0x35/0x4b
    [ 6.060000] [] ? tracing_start+0x31/0xd3
    [ 6.060000] [] ? tracing_start+0x31/0xd3
    [ 6.060000] [] ? __lock_acquired+0xe6/0x1f2
    [ 6.060000] [] ? tracing_start+0x31/0xd3
    [ 6.060000] [] tracing_start+0x67/0xd3
    [ 6.060000] [] ? irqsoff_tracer_reset+0x2d/0x57
    [ 6.060000] [] trace_selftest_startup_preemptirqsoff+0x1c8/0x1f1
    [ 6.060000] [] register_tracer+0x12f/0x241
    [ 6.060000] [] ? init_irqsoff_tracer+0x0/0x53
    [ 6.060000] [] init_irqsoff_tracer+0x3b/0x53

    This is because in fail case, the preemptirqsoff tracer selftest calls twice
    the tracing_start() function:

    int
    trace_selftest_startup_preemptirqsoff(struct tracer *trace, struct trace_array *tr)
    {
    if (!ret && !count) {
    printk(KERN_CONT ".. no entries found ..");
    ret = -1;
    tracing_start(); reset(tr);
    tracing_start();
    Signed-off-by: Frederic Weisbecker
    LKML-Reference:
    Signed-off-by: Ingo Molnar

    Frederic Weisbecker
     

13 Mar, 2009

2 commits


10 Mar, 2009

1 commit


19 Feb, 2009

3 commits


18 Feb, 2009

2 commits


09 Feb, 2009

1 commit


06 Feb, 2009

1 commit


29 Dec, 2008

1 commit


16 Nov, 2008

2 commits

  • 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
     
  • Impact: fix lockdep disabling itself when function tracing is enabled

    The raw_local_irq_saves used in ftrace is causing problems with
    lockdep. (it thinks the irq flags are out of sync and disables
    itself with a warning)

    The raw ops here are not needed, and the normal local_irq_save is fine.

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

    Steven Rostedt
     

13 Nov, 2008

1 commit

  • Impact: added new branch tracer

    Currently the tracing of branch profiling (unlikelys and likelys hit)
    is only activated by the iter_ctrl. This patch adds a tracer called
    "branch" that will just trace the branch profiling. The advantage
    of adding this tracer is that it can be added to the ftrace selftests
    on startup.

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

    Steven Rostedt
     

08 Nov, 2008

3 commits

  • Impact: preemptoff not tested in selftest

    Due to the BKL not being preemptable anymore, the selftest of the
    preemptoff code can not be tested. It requires that it is called
    with preemption enabled, but since the BKL is held, that is no
    longer the case.

    This patch simply skips those tests if it detects that the context
    is not preemptable. The following will now show up in the tests:

    Testing tracer preemptoff: can not test ... force PASSED
    Testing tracer preemptirqsoff: can not test ... force PASSED

    When the BKL is removed, or it becomes preemptable once again, then
    the tests will be performed.

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

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

23 Oct, 2008

1 commit


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

4 commits

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

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

    Steven Rostedt
     
  • It is possible that the testing thread in the ftrace wakeup test does not
    run before we stop the trace. This will cause the trace to fail since nothing
    will be in the buffers.

    This patch adds a small wait in the wakeup test to allow for the woken task
    to run and be traced.

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

    Steven Rostedt
     
  • A no-op tracer which can serve two purposes:

    1. A template for development of a new tracer.
    2. A convenient way to see ftrace_printk() calls without
    an irrelevant trace making the output messy.

    [ mingo@elte.hu: resolved conflicts ]
    Signed-off-by: Steven Noonan
    Signed-off-by: Ingo Molnar

    Steven Noonan
     
  • This patch adds a feature that can help kernel developers debug their
    code using ftrace.

    int ftrace_printk(const char *fmt, ...);

    This records into the ftrace buffer using printf formatting. The entry
    size in the buffers are still a fixed length. A new type has been added
    that allows for more entries to be used for a single recording.

    The start of the print is still the same as the other entries.

    It returns the number of characters written to the ftrace buffer.

    For example:

    Having a module with the following code:

    static int __init ftrace_print_test(void)
    {
    ftrace_printk("jiffies are %ld\n", jiffies);
    return 0;
    }

    Gives me:

    insmod-5441 3...1 7569us : ftrace_print_test: jiffies are 4296626666

    for the latency_trace file and:

    insmod-5441 [03] 1959.370498: ftrace_print_test jiffies are 4296626666

    for the trace file.

    Note: Only the infrastructure should go into the kernel. It is to help
    facilitate debugging for other kernel developers. Calls to ftrace_printk
    is not intended to be left in the kernel, and should be frowned upon just
    like scattering printks around in the code.

    But having this easily at your fingertips helps the debugging go faster
    and bugs be solved quicker.

    Maybe later on, we can hook this with markers and have their printf format
    be sucked into ftrace output.

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

    Steven Rostedt
     

10 Jul, 2008

1 commit


27 May, 2008

1 commit

  • The check_pages function is called often enough that it can cause problems
    with trace outputs or even bringing the system to a halt.

    This patch limits the check_pages to the places that are most likely to
    have problems. The check is made at the flip between the global array and
    the max save array, as well as when the size of the buffers changes and
    the self tests.

    This patch also removes the BUG_ON from check_pages and replaces it with
    a WARN_ON and disabling of the tracer.

    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

3 commits