1. 28 4月, 2010 2 次提交
    • S
      tracing: Fix sleep time function profiling · 37e44bc5
      Steven Rostedt 提交于
      When sleep_time is off the function profiler ignores the time that a task
      is scheduled out. When the task is scheduled out a timestamp is taken.
      When the task is scheduled back in, the timestamp is compared to the
      current time and the saved calltimes are adjusted accordingly.
      
      But when stopping the function profiler, the sched switch hook that
      does this adjustment was stopped before shutting down the tracer.
      This allowed some tasks to not get their timestamps set when they
      scheduled out. When the function profiler started again, this would
      skew the times of the scheduler functions.
      
      This patch moves the stopping of the sched switch to after the function
      profiler is stopped. It also ignores zero set calltimes, which may
      happen on start up.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      37e44bc5
    • C
      tracing: Show sample std dev in function profiling · e330b3bc
      Chase Douglas 提交于
      When combined with function graph tracing the ftrace function profiler
      also prints the average run time of functions. While this gives us some
      good information, it doesn't tell us anything about the variance of the
      run times of the function. This change prints out the s^2 sample
      standard deviation alongside the average.
      
      This change adds one entry to the profile record structure. This
      increases the memory footprint of the function profiler by 1/3 on a
      32-bit system, and by 1/5 on a 64-bit system when function graphing is
      enabled, though the memory is only allocated when the profiler is turned
      on. During the profiling, one extra line of code adds the squared
      calltime to the new record entry, so this should not adversly affect
      performance.
      
      Note that the square of the sample standard deviation is printed because
      there is no sqrt implementation for unsigned long long in the kernel.
      Signed-off-by: NChase Douglas <chase.douglas@canonical.com>
      LKML-Reference: <1272304925-2436-1-git-send-email-chase.douglas@canonical.com>
      
      [ fixed comment about ns^2 -> us^2 conversion ]
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      e330b3bc
  2. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  3. 13 3月, 2010 1 次提交
    • S
      function-graph: Init curr_ret_stack with ret_stack · ea14eb71
      Steven Rostedt 提交于
      If the graph tracer is active, and a task is forked but the allocating of
      the processes graph stack fails, it can cause crash later on.
      
      This is due to the temporary stack being NULL, but the curr_ret_stack
      variable is copied from the parent. If it is not -1, then in
      ftrace_graph_probe_sched_switch() the following:
      
      	for (index = next->curr_ret_stack; index >= 0; index--)
      		next->ret_stack[index].calltime += timestamp;
      
      Will cause a kernel OOPS.
      
      Found with Li Zefan's ftrace_stress_test.
      
      Cc: stable@kernel.org
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      ea14eb71
  4. 11 3月, 2010 1 次提交
    • P
      ftrace: Replace read_barrier_depends() with rcu_dereference_raw() · 3f379b03
      Paul E. McKenney 提交于
      Replace the calls to read_barrier_depends() in
      ftrace_list_func() with rcu_dereference_raw() to improve
      readability.  The reason that we use rcu_dereference_raw() here
      is that removed entries are never freed, instead they are simply
      leaked.  This is one of a very few cases where use of
      rcu_dereference_raw() is the long-term right answer.  And I
      don't yet know of any others.  ;-)
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: laijs@cn.fujitsu.com
      Cc: dipankar@in.ibm.com
      Cc: mathieu.desnoyers@polymtl.ca
      Cc: josh@joshtriplett.org
      Cc: dvhltc@us.ibm.com
      Cc: niv@us.ibm.com
      Cc: peterz@infradead.org
      Cc: Valdis.Kletnieks@vt.edu
      Cc: dhowells@redhat.com
      LKML-Reference: <1267830207-9474-1-git-send-email-paulmck@linux.vnet.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3f379b03
  5. 06 3月, 2010 1 次提交
  6. 12 2月, 2010 1 次提交
  7. 04 2月, 2010 2 次提交
    • M
      ftrace: Remove record freezing · f24bb999
      Masami Hiramatsu 提交于
      Remove record freezing. Because kprobes never puts probe on
      ftrace's mcount call anymore, it doesn't need ftrace to check
      whether kprobes on it.
      Signed-off-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: przemyslaw@pawelczyk.it
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20100202214925.4694.73469.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f24bb999
    • M
      ftrace/alternatives: Introducing *_text_reserved functions · 2cfa1978
      Masami Hiramatsu 提交于
      Introducing *_text_reserved functions for checking the text
      address range is partially reserved or not. This patch provides
      checking routines for x86 smp alternatives and dynamic ftrace.
      Since both functions modify fixed pieces of kernel text, they
      should reserve and protect those from other dynamic text
      modifier, like kprobes.
      
      This will also be extended when introducing other subsystems
      which modify fixed pieces of kernel text. Dynamic text modifiers
      should avoid those.
      Signed-off-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: przemyslaw@pawelczyk.it
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <20100202214911.4694.16587.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2cfa1978
  8. 15 1月, 2010 1 次提交
  9. 14 12月, 2009 3 次提交
  10. 23 11月, 2009 1 次提交
    • I
      tracing, function tracer: Clean up strstrip() usage · 457dc928
      Ingo Molnar 提交于
      Clean up strstrip() usage - which also addresses this build warning:
      
        kernel/trace/ftrace.c: In function 'ftrace_pid_write':
        kernel/trace/ftrace.c:3004: warning: ignoring return value of 'strstrip', declared with attribute warn_unused_result
      
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      457dc928
  11. 18 11月, 2009 1 次提交
  12. 04 11月, 2009 1 次提交
  13. 24 10月, 2009 1 次提交
  14. 15 10月, 2009 1 次提交
  15. 14 10月, 2009 2 次提交
    • J
      tracing: Enable records during the module load · 5cb084bb
      Jiri Olsa 提交于
      I was debuging some module using "function" and "function_graph"
      tracers and noticed, that if you load module after you enabled
      tracing, the module's hooks will convert only to NOP instructions.
      
      The attached patch enables modules' hooks if there's function trace
      allready on, thus allowing to trace module functions.
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20091013203425.896285120@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5cb084bb
    • J
      tracing: Support multiple pids in set_pid_ftrace file · 756d17ee
      jolsa@redhat.com 提交于
      Adding the possibility to set more than 1 pid in the set_pid_ftrace
      file, thus allowing to trace more than 1 independent processes.
      
      Usage:
      
       sh-4.0# echo 284 > ./set_ftrace_pid
       sh-4.0# cat ./set_ftrace_pid
       284
       sh-4.0# echo 1 >> ./set_ftrace_pid
       sh-4.0# echo 0 >> ./set_ftrace_pid
       sh-4.0# cat ./set_ftrace_pid
       swapper tasks
       1
       284
       sh-4.0# echo 4 > ./set_ftrace_pid
       sh-4.0# cat ./set_ftrace_pid
       4
       sh-4.0# echo > ./set_ftrace_pid
       sh-4.0# cat ./set_ftrace_pid
       no pid
       sh-4.0#
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091013203425.565454612@goodmis.org>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      756d17ee
  16. 13 10月, 2009 1 次提交
  17. 08 10月, 2009 2 次提交
  18. 01 10月, 2009 1 次提交
    • M
      tracing: Fix infinite recursion in ftrace_update_pid_func() · 33974093
      Matt Fleming 提交于
      When CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST is enabled
      __ftrace_trace_function contains the current trace function, not
      ftrace_trace_function.
      
      In ftrace_update_pid_func() we currently incorrectly assign the
      value of ftrace_trace_function to __ftrace_trace_funcion before
      returning.
      
      Without this patch it is possible to execute an infinite recursion
      whereby ftrace_test_stop_func() calls __ftrace_trace_function,
      which was assigned ftrace_test_stop_func() in
      ftrace_update_pid_func().
      Signed-off-by: NMatt Fleming <matthew.fleming@imgtec.com>
      Acked-by: NSteven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1254152581-18347-1-git-send-email-matt@console-pimps.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      33974093
  19. 25 9月, 2009 1 次提交
    • F
      tracing/filters: Unify the regex parsing helpers · 3f6fe06d
      Frederic Weisbecker 提交于
      The filter code has stolen the regex parsing function from ftrace to
      get the regex support.
      We have duplicated this code, so factorize it in the filter area and
      make it generally available, as the filter code is the most suited to
      host this feature.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      3f6fe06d
  20. 24 9月, 2009 1 次提交
  21. 23 9月, 2009 1 次提交
  22. 22 9月, 2009 3 次提交
  23. 19 9月, 2009 1 次提交
  24. 18 9月, 2009 1 次提交
  25. 16 9月, 2009 1 次提交
  26. 12 9月, 2009 1 次提交
  27. 19 8月, 2009 1 次提交
    • J
      tracing: handle broken names in ftrace filter · eda1e328
      Jiri Olsa 提交于
      If one filter item (for set_ftrace_filter and set_ftrace_notrace) is being
      setup by more than 1 consecutive writes (FTRACE_ITER_CONT flag), it won't
      be handled corretly.
      
      I used following program to test/verify:
      
      [snip]
      #include <stdio.h>
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
      #include <string.h>
      
      int main(int argc, char **argv)
      {
              int fd, i;
              char *file = argv[1];
      
              if (-1 == (fd = open(file, O_WRONLY))) {
                      perror("open failed");
                      return -1;
              }
      
              for(i = 0; i < (argc - 2); i++) {
                      int len = strlen(argv[2+i]);
                      int cnt, off = 0;
      
                      while(len) {
                              cnt = write(fd, argv[2+i] + off, len);
                              len -= cnt;
                              off += cnt;
                      }
              }
      
              close(fd);
              return 0;
      }
      [snip]
      
      before change:
      sh-4.0# echo > ./set_ftrace_filter
      sh-4.0# /test ./set_ftrace_filter "sys" "_open "
      sh-4.0# cat ./set_ftrace_filter
      #### all functions enabled ####
      sh-4.0#
      
      after change:
      sh-4.0# echo > ./set_ftrace_notrace
      sh-4.0# test ./set_ftrace_notrace "sys" "_open "
      sh-4.0# cat ./set_ftrace_notrace
      sys_open
      sh-4.0#
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      LKML-Reference: <20090811152904.GA26065@jolsa.lab.eng.brq.redhat.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      eda1e328
  28. 17 8月, 2009 1 次提交
  29. 23 7月, 2009 2 次提交
  30. 18 7月, 2009 1 次提交
  31. 17 7月, 2009 1 次提交