1. 03 12月, 2008 1 次提交
  2. 02 12月, 2008 4 次提交
    • F
      tracing/function-graph-tracer: support for x86-64 · 48d68b20
      Frederic Weisbecker 提交于
      Impact: extend and enable the function graph tracer to 64-bit x86
      
      This patch implements the support for function graph tracer under x86-64.
      Both static and dynamic tracing are supported.
      
      This causes some small CPP conditional asm on arch/x86/kernel/ftrace.c I
      wanted to use probe_kernel_read/write to make the return address
      saving/patching code more generic but it causes tracing recursion.
      
      That would be perhaps useful to implement a notrace version of these
      function for other archs ports.
      
      Note that arch/x86/process_64.c is not traced, as in X86-32. I first
      thought __switch_to() was responsible of crashes during tracing because I
      believed current task were changed inside but that's actually not the
      case (actually yes, but not the "current" pointer).
      
      So I will have to investigate to find the functions that harm here, to
      enable tracing of the other functions inside (but there is no issue at
      this time, while process_64.c stays out of -pg flags).
      
      A little possible race condition is fixed inside this patch too. When the
      tracer allocate a return stack dynamically, the current depth is not
      initialized before but after. An interrupt could occur at this time and,
      after seeing that the return stack is allocated, the tracer could try to
      trace it with a random uninitialized depth. It's a prevention, even if I
      hadn't problems with it.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tim Bird <tim.bird@am.sony.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      48d68b20
    • L
      function trace: fix a bug of single thread function trace · 66eafebc
      Liming Wang 提交于
      Impact: fix "no output from tracer" bug caused by ftrace_update_pid_func()
      
      When disabling single thread function trace using
      "echo -1 > set_ftrace_pid", the normal function trace
      has to restore to original function, otherwise the normal
      function trace will not work well.
      
      Without this commit, something like below:
      
      	$ ps |grep 850
      	  850 root      2556 S    -/bin/sh
      	$ echo 850 > /debug/tracing/set_ftrace_pid
      	$ echo function > /debug/tracing/current_tracer
      	$ echo 1 > /debug/tracing/tracing_enabled
      	$ sleep 1
      	$ echo 0 > /debug/tracing/tracing_enabled
      	$ cat /debug/tracing/trace_pipe |wc -l
      	59704
      	$ echo -1 > /debug/tracing/set_ftrace_pid
      	$ echo 1 > /debug/tracing/tracing_enabled
      	$ sleep 1
      	$ echo 0 > /debug/tracing/tracing_enabled
      	$ more /debug/tracing/trace_pipe
      		<====== nothing output now!
      			it should output trace record.
      Signed-off-by: NLiming Wang <liming.wang@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      66eafebc
    • I
      Merge branches 'tracing/branch-tracer', 'tracing/ftrace',... · 222658e0
      Ingo Molnar 提交于
      Merge branches 'tracing/branch-tracer', 'tracing/ftrace', 'tracing/function-graph-tracer', 'tracing/markers', 'tracing/powerpc', 'tracing/stack-tracer' and 'tracing/tracepoints' into tracing/core
      222658e0
    • I
      Merge branch 'tracing/urgent' into tracing/core · 74bf3cab
      Ingo Molnar 提交于
      Conflicts:
      	kernel/trace/ring_buffer.c
      74bf3cab
  3. 29 11月, 2008 3 次提交
  4. 28 11月, 2008 11 次提交
    • W
      markers: comment marker_synchronize_unregister() on data dependency · a838c2ec
      Wu Fengguang 提交于
      Add document and comments on marker_synchronize_unregister(): it
      should be called before freeing resources that the probes depend on.
      
      Based on comments from Lai Jiangshan and Mathieu Desnoyers.
      Signed-off-by: NWu Fengguang <wfg@linux.intel.com>
      Reviewed-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Reviewed-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a838c2ec
    • S
      powerpc/ppc32: static ftrace fixes for PPC32 · f1eecf0e
      Steven Rostedt 提交于
      Impact: fix for PowerPC 32 code
      
      There were some early init code that was not safe for static
      ftrace to boot on my PowerBook. This code must only use relative
      addressing, and static mcount performs a compare of the
      ftrace_trace_function pointer, and gets that with an absolute address.
      In the early init boot up code, this will cause a fault.
      
      This patch removes tracing from the files containing the offending
      functions.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f1eecf0e
    • S
      powerpc: ftrace, use create_branch · 0029ff87
      Steven Rostedt 提交于
      Impact: clean up
      
      Paul Mackerras pointed out that the code to determine if the branch
      can reach the destination is incorrect. Michael Ellerman suggested
      to pull out the code from create_branch and use that.
      
      Simply using create_branch is probably the best.
      Reported-by: NMichael Ellerman <michael@ellerman.id.au>
      Reported-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0029ff87
    • S
      powerpc: ftrace, added missing icache flush · ec682cef
      Steven Rostedt 提交于
      Impact: fix to PowerPC code modification
      
      After modifying code it is essential to flush the icache. This patch
      adds the missing flush.
      Reported-by: NPaul Mackerras <paulus@samba.org>
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ec682cef
    • S
      powerpc: ftrace, fix cast aliasing and add code verification · d9af12b7
      Steven Rostedt 提交于
      Impact: clean up and robustness addition
      
      This patch addresses the comments made by Paul Mackerras.
      It removes the type casting between unsigned int and unsigned char
      pointers, and replaces them with a use of all unsigned int.
      
      Verification that the jump is indeed made to a trampoline has also
      been added.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d9af12b7
    • S
      powerpc: ftrace, do nothing in mcount call for dyn ftrace · c7b0d173
      Steven Rostedt 提交于
      Impact: quicken mcount calls that are not replaced by dyn ftrace
      
      Dynamic ftrace no longer does on the fly recording of mcount locations.
      The mcount locations are now found at compile time. The mcount
      function no longer needs to store registers and call a stub function.
      It can now just simply return.
      
      Since there are some functions that do not get converted to a nop
      (.init sections and other code that may disappear), this patch should
      help speed up that code.
      
      Also, the stub for mcount on PowerPC 32 can not be a simple branch
      link register like it is on PowerPC 64. According to the ABI specification:
      
      "The _mcount routine is required to restore the link register from
       the stack so that the profiling code can be inserted transparently,
       whether or not the profiled function saves the link register itself."
      
      This means that we must restore the link register that was used
      to make the call to mcount.  The minimal mcount function for PPC32
      ends up being:
      
       mcount:
              mflr    r0
              mtctr   r0
              lwz     r0, 4(r1)
              mtlr    r0
              bctr
      
      Where we move the link register used to call mcount into the
      ctr register, and then restore the link register from the stack.
      Then we use the ctr register to jump back to the mcount caller.
      The r0 register is free for us to use.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c7b0d173
    • W
      ftrace: improve documentation · c072c249
      walimis 提交于
      Impact: extend documentation with notice of using wild cards correctly
      
      We know that we can use wild cards to set set_ftrace_filter, but there's
      problem when using them naively such as:
      
         echo h* > /debug/tracing/set_ftrace_filter
      
      If there are files named with "h" prefix in current directory,
      echo "h*" will echo these filenames to set_ftrace_filter, not the
      intended "h*".
      
      For example:
      
        $ cat /debug/tracing/available_filter_functions |grep ^hr |wc -l
        23
        $ ls
        $ touch hraa hrdd
        $ ls
        hraa  hrdd
        $ echo hr* > /debug/tracing/set_ftrace_filter
        $ cat /debug/tracing/set_ftrace_filter
      
      No output in /debug/tracing/set_ftrace_filter!
      
      If we use '' to escape wild cards, it works:
      
        $ ls
        hraa  hrdd
        $ echo "hr*" > /debug/tracing/set_ftrace_filter
        $ cat /debug/tracing/set_ftrace_filter |wc -l
        23
      
      This problem can lead to unexpected result if current directory has a
      lot of files.
      Signed-off-by: Nwalimis <walimisdev@gmail.com>
      Acked-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c072c249
    • L
      ftrace: improve seq_operation of ftrace · 50cdaf08
      Liming Wang 提交于
      Impact: make ftrace position computing more sane
      
      First remove useless ->pos field. Then we needn't check seq_printf
      in .show like other place.
      Signed-off-by: NLiming Wang <liming.wang@windriver.com>
      Reviewed-by: NBruce Ashfield <bruce.ashfield@windriver.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      50cdaf08
    • T
      tracing, alpha: fix build: add missing #ifdef CONFIG_STACKTRACE · c7425acb
      Török Edwin 提交于
      There are architectures that still have no stacktrace support.
      Signed-off-by: NTörök Edwin <edwintorok@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c7425acb
    • I
      tracing/function-graph-tracer: more output tweaks · d51090b3
      Ingo Molnar 提交于
      Impact: prettify the output some more
      
      Before:
      
      0)           |     sys_read() {
      0)      0.796 us |   fget_light();
      0)           |       vfs_read() {
      0)           |         rw_verify_area() {
      0)           |           security_file_permission() {
      ------------8<---------- thread sshd-1755 ------------8<----------
      
      After:
      
       0)               |  sys_read() {
       0)      0.796 us |    fget_light();
       0)               |    vfs_read() {
       0)               |      rw_verify_area() {
       0)               |        security_file_permission() {
       ------------------------------------------
       | 1)  migration/0--1  =>  sshd-1755
       ------------------------------------------
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d51090b3
    • F
      tracing/function-graph-tracer: adjustments of the trace informations · 1a056155
      Frederic Weisbecker 提交于
      Impact: increase the visual qualities of the call-graph-tracer output
      
      This patch applies various trace output formatting changes:
      
       - CPU is now a decimal number, followed by a parenthesis.
      
       - Overhead is now on the second column (gives a good visibility)
      
       - Cost is now on the third column, can't exceed 9999.99 us. It is
         followed by a virtual line based on a "|" character.
      
       - Functions calls are now the last column on the right. This way, we
         haven't dynamic column (which flow is harder to follow) on its right.
      
       - CPU and Overhead have their own option flag. They are default-on but you
         can disable them easily:
      
            echo nofuncgraph-cpu > trace_options
            echo nofuncgraph-overhead > trace_options
      
      TODO:
      
      _ Refactoring of the thread switch output.
      _ Give a default-off option to output the thread and its pid on each row.
      _ Provide headers
      _ ....
      
      Here is an example of the new trace style:
      
      0)           |             mutex_unlock() {
      0)      0.639 us |           __mutex_unlock_slowpath();
      0)      1.607 us |         }
      0)           |             remove_wait_queue() {
      0)      0.616 us |           _spin_lock_irqsave();
      0)      0.616 us |           _spin_unlock_irqrestore();
      0)      2.779 us |         }
      0)      0.495 us |         n_tty_set_room();
      0) ! 9999.999 us |       }
      0)           |           tty_ldisc_deref() {
      0)      0.615 us |         _spin_lock_irqsave();
      0)      0.616 us |         _spin_unlock_irqrestore();
      0)      2.793 us |       }
      0)           |           current_fs_time() {
      0)      0.488 us |         current_kernel_time();
      0)      0.495 us |         timespec_trunc();
      0)      2.486 us |       }
      0) ! 9999.999 us |     }
      0) ! 9999.999 us |   }
      0) ! 9999.999 us | }
      0)           |     sys_read() {
      0)      0.796 us |   fget_light();
      0)           |       vfs_read() {
      0)           |         rw_verify_area() {
      0)           |           security_file_permission() {
      0)      0.488 us |         cap_file_permission();
      0)      1.720 us |       }
      0)      3.  4 us |     }
      0)           |         tty_read() {
      0)      0.488 us |       tty_paranoia_check();
      0)           |           tty_ldisc_ref_wait() {
      0)           |             tty_ldisc_try() {
      0)      0.615 us |           _spin_lock_irqsave();
      0)      0.615 us |           _spin_unlock_irqrestore();
      0)      5.436 us |         }
      0)      6.427 us |       }
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1a056155
  5. 27 11月, 2008 3 次提交
    • F
      tracing/function-graph-tracer: enhancements for the trace output · 83a8df61
      Frederic Weisbecker 提交于
      Impact: enhance the output of the graph-tracer
      
      This patch applies some ideas of Ingo Molnar and Steven Rostedt.
      
      * Output leaf functions in one line with parenthesis, semicolon and duration
        output.
      
      * Add a second column (after cpu) for an overhead sign.
        if duration > 100 us, "!"
        if duration > 10 us, "+"
        else " "
      
      * Print output in us with remaining nanosec: u.n
      
      * Print duration on the right end, following the indentation of the functions.
        Use also visual clues: "-" on entry call (no duration to output) and "+" on
        return (duration output).
      
      The name of the tracer has been fixed as well: function-branch becomes
      function_branch.
      
      Here is an example of the new output:
      
      CPU[000]           dequeue_entity() {                    -
      CPU[000]             update_curr() {                    -
      CPU[000]               update_min_vruntime();                    + 0.512 us
      CPU[000]             }                                + 1.504 us
      CPU[000]             clear_buddies();                    + 0.481 us
      CPU[000]             update_min_vruntime();                    + 0.504 us
      CPU[000]           }                                + 4.557 us
      CPU[000]           hrtick_update() {                    -
      CPU[000]             hrtick_start_fair();                    + 0.489 us
      CPU[000]           }                                + 1.443 us
      CPU[000] +       }                                + 14.655 us
      CPU[000] +     }                                + 15.678 us
      CPU[000] +   }                                + 16.686 us
      CPU[000]     msecs_to_jiffies();                    + 0.481 us
      CPU[000]     put_prev_task_fair();                    + 0.504 us
      CPU[000]     pick_next_task_fair();                    + 0.482 us
      CPU[000]     pick_next_task_rt();                    + 0.504 us
      CPU[000]     pick_next_task_fair();                    + 0.481 us
      CPU[000]     pick_next_task_idle();                    + 0.489 us
      CPU[000]     _spin_trylock();                    + 0.655 us
      CPU[000]     _spin_unlock();                    + 0.609 us
      
      CPU[000]  ------------8<---------- thread bash-2794 ------------8<----------
      
      CPU[000]               finish_task_switch() {                    -
      CPU[000]                 _spin_unlock_irq();                    + 0.722 us
      CPU[000]               }                                + 2.369 us
      CPU[000] !           }                                + 501972.605 us
      CPU[000] !         }                                + 501973.763 us
      CPU[000]           copy_from_read_buf() {                    -
      CPU[000]             _spin_lock_irqsave();                    + 0.670 us
      CPU[000]             _spin_unlock_irqrestore();                    + 0.699 us
      CPU[000]             copy_to_user() {                    -
      CPU[000]               might_fault() {                    -
      CPU[000]                 __might_sleep();                    + 0.503 us
      CPU[000]               }                                + 1.632 us
      CPU[000]               __copy_to_user_ll();                    + 0.542 us
      CPU[000]             }                                + 3.858 us
      CPU[000]             tty_audit_add_data() {                    -
      CPU[000]               _spin_lock_irq();                    + 0.609 us
      CPU[000]               _spin_unlock_irq();                    + 0.624 us
      CPU[000]             }                                + 3.196 us
      CPU[000]             _spin_lock_irqsave();                    + 0.624 us
      CPU[000]             _spin_unlock_irqrestore();                    + 0.625 us
      CPU[000] +         }                                + 13.611 us
      CPU[000]           copy_from_read_buf() {                    -
      CPU[000]             _spin_lock_irqsave();                    + 0.624 us
      CPU[000]             _spin_unlock_irqrestore();                    + 0.616 us
      CPU[000]           }                                + 2.820 us
      CPU[000]
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      83a8df61
    • I
      Merge branches 'tracing/blktrace', 'tracing/ftrace',... · c7cc7730
      Ingo Molnar 提交于
      Merge branches 'tracing/blktrace', 'tracing/ftrace', 'tracing/function-graph-tracer' and 'tracing/power-tracer' into tracing/core
      c7cc7730
    • L
      ftrace: prevent recursion · 4f5a7f40
      Lai Jiangshan 提交于
      Impact: prevent unnecessary stack recursion
      
      if the resched flag was set before we entered, then don't reschedule.
      Signed-off-by: NLai Jiangshan <laijs@cn.fujitsu.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4f5a7f40
  6. 26 11月, 2008 18 次提交
    • I
      blktrace: port to tracepoints, update · 0bfc2455
      Ingo Molnar 提交于
      Port to the new tracepoints API: split DEFINE_TRACE() and DECLARE_TRACE()
      sites. Spread them out to the usage sites, as suggested by
      Mathieu Desnoyers.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      Acked-by: NMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      0bfc2455
    • A
      blktrace: port to tracepoints · 5f3ea37c
      Arnaldo Carvalho de Melo 提交于
      This was a forward port of work done by Mathieu Desnoyers, I changed it to
      encode the 'what' parameter on the tracepoint name, so that one can register
      interest in specific events and not on classes of events to then check the
      'what' parameter.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NJens Axboe <jens.axboe@oracle.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5f3ea37c
    • A
      tracing: add "power-tracer": C/P state tracer to help power optimization · f3f47a67
      Arjan van de Ven 提交于
      Impact: new "power-tracer" ftrace plugin
      
      This patch adds a C/P-state ftrace plugin that will generate
      detailed statistics about the C/P-states that are being used,
      so that we can look at detailed decisions that the C/P-state
      code is making, rather than the too high level "average"
      that we have today.
      
      An example way of using this is:
      
       mount -t debugfs none /sys/kernel/debug
       echo cstate > /sys/kernel/debug/tracing/current_tracer
       echo 1 > /sys/kernel/debug/tracing/tracing_enabled
       sleep 1
       echo 0 > /sys/kernel/debug/tracing/tracing_enabled
       cat /sys/kernel/debug/tracing/trace | perl scripts/trace/cstate.pl > out.svg
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f3f47a67
    • S
      ftrace: add cpu annotation for function graph tracer · 437f24fb
      Steven Rostedt 提交于
      Impact: enhancement for function graph tracer
      
      When run on a SMP box, the function graph tracer is confusing because
      it shows the different CPUS as changes in the trace.
      
      This patch adds the annotation of 'CPU[###]' where ### is a three digit
      number. The output will look similar to this:
      
      CPU[001]     dput() {
      CPU[000] } 726
      CPU[001]     } 487
      CPU[000] do_softirq() {
      CPU[001]   } 2221
      CPU[000]   __do_softirq() {
      CPU[000]     __local_bh_disable() {
      CPU[001]   unroll_tree_refs() {
      CPU[000]     } 569
      CPU[001]   } 501
      CPU[000]     rcu_process_callbacks() {
      CPU[001]   kfree() {
      
      What makes this nice is that now you can grep the file and produce
      readable format for a particular CPU.
      
       # cat /debug/tracing/trace > /tmp/trace
       # grep '^CPU\[000\]' /tmp/trace > /tmp/trace0
       # grep '^CPU\[001\]' /tmp/trace > /tmp/trace1
      
      Will give you:
      
       # head /tmp/trace0
      CPU[000] ------------8<---------- thread sshd-3899 ------------8<----------
      CPU[000]     inotify_dentry_parent_queue_event() {
      CPU[000]     } 2531
      CPU[000]     inotify_inode_queue_event() {
      CPU[000]     } 505
      CPU[000]   } 69626
      CPU[000] } 73089
      CPU[000] audit_syscall_exit() {
      CPU[000]   path_put() {
      CPU[000]     dput() {
      
       # head /tmp/trace1
      CPU[001] ------------8<---------- thread pcscd-3446 ------------8<----------
      CPU[001]               } 4186
      CPU[001]               dput() {
      CPU[001]               } 543
      CPU[001]               vfs_permission() {
      CPU[001]                 inode_permission() {
      CPU[001]                   shmem_permission() {
      CPU[001]                     generic_permission() {
      CPU[001]                     } 501
      CPU[001]                   } 2205
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      437f24fb
    • S
      ftrace: add thread comm to function graph tracer · 660c7f9b
      Steven Rostedt 提交于
      Impact: enhancement to function graph tracer
      
      Export the trace_find_cmdline so the function graph tracer can
      use it to print the comms of the threads.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      660c7f9b
    • S
      ftrace: let function tracing and function return run together · e53a6319
      Steven Rostedt 提交于
      Impact: feature
      
      This patch enables function tracing and function return to run together.
      I've tested this by enabling the stack tracer and return tracer, where
      both the function entry and function return are used together with
      dynamic ftrace.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e53a6319
    • S
      ftrace: use code patching for ftrace graph tracer · 5a45cfe1
      Steven Rostedt 提交于
      Impact: more efficient code for ftrace graph tracer
      
      This patch uses the dynamic patching, when available, to patch
      the function graph code into the kernel.
      
      This patch will ease the way for letting both function tracing
      and function graph tracing run together.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5a45cfe1
    • S
      ftrace: add function tracing to single thread · df4fc315
      Steven Rostedt 提交于
      Impact: feature to function trace a single thread
      
      This patch adds the ability to function trace a single thread.
      The file:
      
        /debugfs/tracing/set_ftrace_pid
      
      contains the pid to trace. Valid pids are any positive integer.
      Writing any negative number to this file will disable the pid
      tracing and the function tracer will go back to tracing all of
      threads.
      
      This feature works with both static and dynamic function tracing.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      df4fc315
    • L
      ftrace: adding other non-leaving .text sections · d144d5ee
      Liming Wang 提交于
      Impact: widen the scope of recordmcount.pl
      
      Besides .text section, there are three .text sections that won't
      be freed after kernel booting. They are: .sched.text, .spinlock.text
      and .kprobes.text, which contain functions we can trace. But the last
      section ".kprobes.text" is particular, which has been marked as "notrace",
      we ignore it. Thus we add other two sections.
      Signed-off-by: NLiming Wang <liming.wang@windriver.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d144d5ee
    • I
      tracing: function graph tracer, fix · c2324b69
      Ingo Molnar 提交于
      fix return-tracer => graph-tracer namespace rename fallout.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c2324b69
    • F
      tracing/function-return-tracer: set a more human readable output · 287b6e68
      Frederic Weisbecker 提交于
      Impact: feature
      
      This patch sets a C-like output for the function graph tracing.
      For this aim, we now call two handler for each function: one on the entry
      and one other on return. This way we can draw a well-ordered call stack.
      
      The pid of the previous trace is loosely stored to be compared against
      the one of the current trace to see if there were a context switch.
      
      Without this little feature, the call tree would seem broken at
      some locations.
      We could use the sched_tracer to capture these sched_events but this
      way of processing is much more simpler.
      
      2 spaces have been chosen for indentation to fit the screen while deep
      calls. The time of execution in nanosecs is printed just after closed
      braces, it seems more easy this way to find the corresponding function.
      If the time was printed as a first column, it would be not so easy to
      find the corresponding function if it is called on a deep depth.
      
      I plan to output the return value but on 32 bits CPU, the return value
      can be 32 or 64, and its difficult to guess on which case we are.
      I don't know what would be the better solution on X86-32: only print
      eax (low-part) or even edx (high-part).
      
      Actually it's thee same problem when a function return a 8 bits value, the
      high part of eax could contain junk values...
      
      Here is an example of trace:
      
      sys_read() {
        fget_light() {
        } 526
        vfs_read() {
          rw_verify_area() {
            security_file_permission() {
              cap_file_permission() {
              } 519
            } 1564
          } 2640
          do_sync_read() {
            pipe_read() {
              __might_sleep() {
              } 511
              pipe_wait() {
                prepare_to_wait() {
                } 760
                deactivate_task() {
                  dequeue_task() {
                    dequeue_task_fair() {
                      dequeue_entity() {
                        update_curr() {
                          update_min_vruntime() {
                          } 504
                        } 1587
                        clear_buddies() {
                        } 512
                        add_cfs_task_weight() {
                        } 519
                        update_min_vruntime() {
                        } 511
                      } 5602
                      dequeue_entity() {
                        update_curr() {
                          update_min_vruntime() {
                          } 496
                        } 1631
                        clear_buddies() {
                        } 496
                        update_min_vruntime() {
                        } 527
                      } 4580
                      hrtick_update() {
                        hrtick_start_fair() {
                        } 488
                      } 1489
                    } 13700
                  } 14949
                } 16016
                msecs_to_jiffies() {
                } 496
                put_prev_task_fair() {
                } 504
                pick_next_task_fair() {
                } 489
                pick_next_task_rt() {
                } 496
                pick_next_task_fair() {
                } 489
                pick_next_task_idle() {
                } 489
      
      ------------8<---------- thread 4 ------------8<----------
      
      finish_task_switch() {
      } 1203
      do_softirq() {
        __do_softirq() {
          __local_bh_disable() {
          } 669
          rcu_process_callbacks() {
            __rcu_process_callbacks() {
              cpu_quiet() {
                rcu_start_batch() {
                } 503
              } 1647
            } 3128
            __rcu_process_callbacks() {
            } 542
          } 5362
          _local_bh_enable() {
          } 587
        } 8880
      } 9986
      kthread_should_stop() {
      } 669
      deactivate_task() {
        dequeue_task() {
          dequeue_task_fair() {
            dequeue_entity() {
              update_curr() {
                calc_delta_mine() {
                } 511
                update_min_vruntime() {
                } 511
              } 2813
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      287b6e68
    • F
      tracing/function-return-tracer: change the name into function-graph-tracer · fb52607a
      Frederic Weisbecker 提交于
      Impact: cleanup
      
      This patch changes the name of the "return function tracer" into
      function-graph-tracer which is a more suitable name for a tracing
      which makes one able to retrieve the ordered call stack during
      the code flow.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fb52607a
    • I
    • M
      x86, bts, ftrace: a BTS ftrace plug-in prototype · 1e9b51c2
      Markus Metzger 提交于
      Impact: add new ftrace plugin
      
      A prototype for a BTS ftrace plug-in.
      
      The tracer collects branch trace in a cyclic buffer for each cpu.
      
      The tracer is not configurable and the trace for each snapshot is
      appended when doing cat /debug/tracing/trace.
      
      This is a proof of concept that will be extended with future patches
      to become a (hopefully) useful tool.
      Signed-off-by: NMarkus Metzger <markus.t.metzger@intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      1e9b51c2
    • M
      x86, ftrace: call trace->open() before stopping tracing; add trace->print_header() · 8bba1bf5
      Markus Metzger 提交于
      Add a callback to allow an ftrace plug-in to write its own header.
      
      Move the call to trace->open() up a few lines.
      
      The changes are required by the BTS ftrace plug-in.
      Signed-off-by: NMarkus Metzger <markus.t.metzger@intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8bba1bf5
    • M
      x86, bts, ptrace: move BTS buffer allocation from ds.c into ptrace.c · 6abb11ae
      Markus Metzger 提交于
      Impact: restructure DS memory allocation to be done by the usage site of DS
      
      Require pre-allocated buffers in ds.h.
      
      Move the BTS buffer allocation for ptrace into ptrace.c.
      The pointer to the allocated buffer is stored in the traced task's
      task_struct together with the handle returned by ds_request_bts().
      
      Removes memory accounting code.
      Signed-off-by: NMarkus Metzger <markus.t.metzger@intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6abb11ae
    • M
      x86, bts: base in-kernel ds interface on handles · ca0002a1
      Markus Metzger 提交于
      Impact: generalize the DS code to shared buffers
      
      Change the in-kernel ds.h interface to identify the tracer via a
      handle returned on ds_request_~().
      
      Tracers used to be identified via their task_struct.
      
      The changes are required to allow DS to be shared between different
      tasks, which is needed for perfmon2 and for ftrace.
      
      For ptrace, the handle is stored in the traced task's task_struct.
      This should probably go into a (arch-specific) ptrace context some
      time.
      Signed-off-by: NMarkus Metzger <markus.t.metzger@intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ca0002a1
    • I
      Merge branches 'tracing/core', 'x86/urgent' and 'x86/ptrace' into tracing/hw-branch-tracing · 7d55718b
      Ingo Molnar 提交于
      This pulls together all the topic branches that are needed
      for the DS/BTS/PEBS tracing work.
      7d55718b