1. 08 Apr, 2009 1 commit
    • Tetsuo Handa's avatar
      tracing: append a comma to INIT_FTRACE_GRAPH · f876d346
      Tetsuo Handa authored
      Impact: dont break future extensions of INIT_TASK
      While not a problem right now, due to lack of a comma, build fails if
      elements are appended to INIT_TASK() macro in development code:
       arch/x86/kernel/init_task.c:33: error: request for member `XXXXXXXXXX' in something not a structure or union
       arch/x86/kernel/init_task.c:33: error: initializer element is not constant
       arch/x86/kernel/init_task.c:33: error: (near initialization for `init_task.ret_stack')
       make[1]: *** [arch/x86/kernel/init_task.o] Error 1
       make: *** [arch/x86/kernel] Error 2
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: srostedt@redhat.com
      LKML-Reference: <200904080505.n3855hcn017109@www262.sakura.ne.jp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  2. 07 Apr, 2009 1 commit
    • Steven Rostedt's avatar
      function-graph: add proper initialization for init task · 5ac9f622
      Steven Rostedt authored
      Impact: fix to crash going to kexec
      The init task did not properly initialize the function graph pointers.
      Altough these pointers are NULL, they can not be assumed to be NULL
      for the init task, and must still be properly initialize.
      This usually is not an issue since a problem only arises when a task
      exits, and the init tasks do not usually exit. But when doing tests
      with kexec, the init tasks do exit, and the bug appears.
      This patch properly initializes the init tasks function graph data
      Reported-and-Tested-by: default avatarYinghai Lu <yinghai@kernel.org>
      LKML-Reference: <alpine.DEB.2.00.0903252053080.5675@gandalf.stny.rr.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  3. 24 Mar, 2009 2 commits
  4. 13 Mar, 2009 3 commits
  5. 06 Mar, 2009 3 commits
    • Frederic Weisbecker's avatar
      tracing/core: drop the old trace_printk() implementation in favour of trace_bprintk() · 769b0441
      Frederic Weisbecker authored
      Impact: faster and lighter tracing
      Now that we have trace_bprintk() which is faster and consume lesser
      memory than trace_printk() and has the same purpose, we can now drop
      the old implementation in favour of the binary one from trace_bprintk(),
      which means we move all the implementation of trace_bprintk() to
      trace_printk(), so the Api doesn't change except that we must now use
      trace_seq_bprintk() to print the TRACE_PRINT entries.
      Some changes result of this:
      - Previously, trace_bprintk depended of a single tracer and couldn't
        work without. This tracer has been dropped and the whole implementation
        of trace_printk() (like the module formats management) is now integrated
        in the tracing core (comes with CONFIG_TRACING), though we keep the file
        trace_printk (previously trace_bprintk.c) where we can find the module
        management. Thus we don't overflow trace.c
      - changes some parts to use trace_seq_bprintk() to print TRACE_PRINT entries.
      - change a bit trace_printk/trace_vprintk macros to support non-builtin formats
        constants, and fix 'const' qualifiers warnings. But this is all transparent for
      - etc...
      - Rebase against last changes
      - Fix mispell on the changelog
      - Rebase against last changes (moving trace_printk() to kernel.h)
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-5-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Lai Jiangshan's avatar
      tracing: add trace_bprintk() · 1ba28e02
      Lai Jiangshan authored
      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: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Lai Jiangshan's avatar
      tracing: infrastructure for supporting binary record · 1427cdf0
      Lai Jiangshan authored
      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: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1236356510-8381-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  6. 05 Mar, 2009 3 commits
  7. 02 Mar, 2009 1 commit
  8. 20 Feb, 2009 1 commit
  9. 18 Feb, 2009 1 commit
  10. 17 Feb, 2009 4 commits
    • Steven Rostedt's avatar
      ftrace: rename _hook to _probe · b6887d79
      Steven Rostedt authored
      Impact: clean up
      Ingo Molnar did not like the _hook naming convention used by the
      select function tracer. Luis Claudio R. Goncalves suggested using
      the "_probe" extension. This patch implements the change of
      calling the functions and variables "_hook" and replacing them
      with "_probe".
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
    • Ingo Molnar's avatar
      ftrace: fix !CONFIG_FTRACE [un_]register_ftrace_command() prototypes · 97d0bb8d
      Ingo Molnar authored
      Impact: build fix
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Steven Rostedt's avatar
      ftrace: add pretty print to selected fuction traces · 809dcf29
      Steven Rostedt authored
      This patch adds a call back for the tracers that have hooks to
      selected functions. This allows the tracer to show better output
      in the set_ftrace_filter file.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
    • Steven Rostedt's avatar
      ftrace: trace different functions with a different tracer · 59df055f
      Steven Rostedt authored
      Impact: new feature
      Currently, the function tracer only gives you an ability to hook
      a tracer to all functions being traced. The dynamic function trace
      allows you to pick and choose which of those functions will be
      traced, but all functions being traced will call all tracers that
      registered with the function tracer.
      This patch adds a new feature that allows a tracer to hook to specific
      functions, even when all functions are being traced. It allows for
      different functions to call different tracer hooks.
      The way this is accomplished is by a special function that will hook
      to the function tracer and will set up a hash table knowing which
      tracer hook to call with which function. This is the most general
      and easiest method to accomplish this. Later, an arch may choose
      to supply their own method in changing the mcount call of a function
      to call a different tracer. But that will be an exercise for the
      To register a function:
       struct ftrace_hook_ops {
      	void			(*func)(unsigned long ip,
      					unsigned long parent_ip,
      					void **data);
      	int			(*callback)(unsigned long ip, void **data);
      	void			(*free)(void **data);
       int register_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
      				  void *data);
      glob is a simple glob to search for the functions to hook.
      ops is a pointer to the operations (listed below)
      data is the default data to be passed to the hook functions when traced
       func is the hook function to call when the functions are traced
       callback is a callback function that is called when setting up the hash.
         That is, if the tracer needs to do something special for each
         function, that is being traced, and wants to give each function
         its own data. The address of the entry data is passed to this
         callback, so that the callback may wish to update the entry to
         whatever it would like.
       free is a callback for when the entry is freed. In case the tracer
         allocated any data, it is give the chance to free it.
      To unregister we have three functions:
        unregister_ftrace_function_hook(char *glob, struct ftrace_hook_ops *ops,
      				void *data)
      This will unregister all hooks that match glob, point to ops, and
      have its data matching data. (note, if glob is NULL, blank or '*',
      all functions will be tested).
        unregister_ftrace_function_hook_func(char *glob,
      				 struct ftrace_hook_ops *ops)
      This will unregister all functions matching glob that has an entry
      pointing to ops.
        void unregister_ftrace_function_hook_all(char *glob)
      This simply unregisters all funcs.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
  11. 16 Feb, 2009 1 commit
    • Steven Rostedt's avatar
      ftrace: add command interface for function selection · f6180773
      Steven Rostedt authored
      Allow for other tracers to add their own commands for function
      selection. This interface gives a trace the ability to name a
      command for function selection. Right now it is pretty limited
      in what it offers, but this is a building step for more features.
      The :mod: command is converted to this interface and also serves
      as a template for other implementations.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
  12. 09 Feb, 2009 1 commit
  13. 08 Feb, 2009 1 commit
  14. 26 Jan, 2009 1 commit
  15. 20 Jan, 2009 1 commit
  16. 14 Jan, 2009 1 commit
  17. 21 Dec, 2008 1 commit
  18. 18 Dec, 2008 1 commit
    • Steven Rostedt's avatar
      trace: add a way to enable or disable the stack tracer · f38f1d2a
      Steven Rostedt authored
      Impact: enhancement to stack tracer
      The stack tracer currently is either on when configured in or
      off when it is not. It can not be disabled when it is configured on.
      (besides disabling the function tracer that it uses)
      This patch adds a way to enable or disable the stack tracer at
      run time. It defaults off on bootup, but a kernel parameter 'stacktrace'
      has been added to enable it on bootup.
      A new sysctl has been added "kernel.stack_tracer_enabled" to let
      the user enable or disable the stack tracer at run time.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  19. 12 Dec, 2008 1 commit
  20. 10 Dec, 2008 1 commit
  21. 08 Dec, 2008 2 commits
    • Frederic Weisbecker's avatar
      tracing/function-graph-tracer: append the tracing_graph_flag · 380c4b14
      Frederic Weisbecker authored
      Impact: Provide a way to pause the function graph tracer
      As suggested by Steven Rostedt, the previous patch that prevented from
      spinlock function tracing shouldn't use the raw_spinlock to fix it.
      It's much better to follow lockdep with normal spinlock, so this patch
      adds a new flag for each task to make the function graph tracer able
      to be paused. We also can send an ftrace_printk whithout worrying of
      the irrelevant traced spinlock during insertion.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Frederic Weisbecker's avatar
      tracing/function-graph-tracer: introduce __notrace_funcgraph to filter special functions · 8b96f011
      Frederic Weisbecker authored
      Impact: trace more functions
      When the function graph tracer is configured, three more files are not
      traced to prevent only four functions to be traced. And this impacts the
      normal function tracer too.
      I had crashes when I let this file traced. After some debugging, I saw
      that the "current" task point was changed inside__swtich_to(), ie:
      "write_pda(pcurrent, next_p);" inside process_64.c Since the tracer store
      the original return address of the function inside current, we had
      crashes. Only __switch_to() has to be excluded from tracing.
      kernel/module.c and kernel/extable.c:
      Because of a function used internally by the function graph tracer:
      To let the other functions inside these files to be traced, this patch
      introduces the __notrace_funcgraph function prefix which is __notrace if
      function graph tracer is configured and nothing if not.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  22. 05 Dec, 2008 1 commit
  23. 04 Dec, 2008 1 commit
    • Steven Rostedt's avatar
      ftrace: graph of a single function · ea4e2bc4
      Steven Rostedt authored
      This patch adds the file:
      which can be used along with the function graph tracer.
      When this file is empty, the function graph tracer will act as
      usual. When the file has a function in it, the function graph
      tracer will only trace that function.
      For example:
       # echo blk_unplug > /debugfs/tracing/set_graph_function
       # cat /debugfs/tracing/trace
       | 2)  make-19003  =>  kjournald-2219
       2)               |  blk_unplug() {
       2)               |    dm_unplug_all() {
       2)               |      dm_get_table() {
       2)      1.381 us |        _read_lock();
       2)      0.911 us |        dm_table_get();
       2)      1. 76 us |        _read_unlock();
       2) +   12.912 us |      }
       2)               |      dm_table_unplug_all() {
       2)               |        blk_unplug() {
       2)      0.778 us |          generic_unplug_device();
       2)      2.409 us |        }
       2)      5.992 us |      }
       2)      0.813 us |      dm_table_put();
       2) +   29. 90 us |    }
       2) +   34.532 us |  }
      You can add up to 32 functions into this file. Currently we limit it
      to 32, but this may change with later improvements.
      To add another function, use the append '>>':
        # echo sys_read >> /debugfs/tracing/set_graph_function
        # cat /debugfs/tracing/set_graph_function
      Using the '>' will clear out the function and write anew:
        # echo sys_write > /debug/tracing/set_graph_function
        # cat /debug/tracing/set_graph_function
      Note, if you have function graph running while doing this, the small
      time between clearing it and updating it will cause the graph to
      record all functions. This should not be an issue because after
      it sets the filter, only those functions will be recorded from then on.
      If you need to only record a particular function then set this
      file first before starting the function graph tracer. In the future
      this side effect may be corrected.
      The set_graph_function file is similar to the set_ftrace_filter but
      it does not take wild cards nor does it allow for more than one
      function to be set with a single write. There is no technical reason why
      this is the case, I just do not have the time yet to implement that.
      Note, dynamic ftrace must be enabled for this to appear because it
      uses the dynamic ftrace records to match the name to the mcount
      call sites.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  24. 03 Dec, 2008 2 commits
    • Steven Rostedt's avatar
      ftrace: function graph return for function entry · e49dc19c
      Steven Rostedt authored
      Impact: feature, let entry function decide to trace or not
      This patch lets the graph tracer entry function decide if the tracing
      should be done at the end as well. This requires all function graph
      entry functions return 1 if it should trace, or 0 if the return should
      not be traced.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Steven Rostedt's avatar
      ftrace: add ftrace_graph_stop() · 14a866c5
      Steven Rostedt authored
      Impact: new ftrace_graph_stop function
      While developing more features of function graph, I hit a bug that
      caused the WARN_ON to trigger in the prepare_ftrace_return function.
      Well, it was hard for me to find out that was happening because the
      bug would not print, it would just cause a hard lockup or reboot.
      The reason is that it is not safe to call printk from this function.
      Looking further, I also found that it calls unregister_ftrace_graph,
      which grabs a mutex and calls kstop machine. This would definitely
      lock the box up if it were to trigger.
      This patch adds a fast and safe ftrace_graph_stop() which will
      stop the function tracer. Then it is safe to call the WARN ON.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
  25. 26 Nov, 2008 4 commits
    • Arjan van de Ven's avatar
      tracing: add "power-tracer": C/P state tracer to help power optimization · f3f47a67
      Arjan van de Ven authored
      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: default avatarArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Steven Rostedt's avatar
      ftrace: use code patching for ftrace graph tracer · 5a45cfe1
      Steven Rostedt authored
      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: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Frederic Weisbecker's avatar
      tracing/function-return-tracer: set a more human readable output · 287b6e68
      Frederic Weisbecker authored
      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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    • Frederic Weisbecker's avatar
      tracing/function-return-tracer: change the name into function-graph-tracer · fb52607a
      Frederic Weisbecker authored
      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: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>