1. 17 Feb, 2009 15 commits
  2. 16 Feb, 2009 9 commits
    • Steven Rostedt's avatar
      ftrace: consolidate mutexes · e6ea44e9
      Steven Rostedt authored
      Impact: clean up
      
      Now that ftrace_lock is a mutex, there is no reason to have three
      different mutexes protecting similar data. All the mutex paths
      are not in hot paths, so having a mutex to cover more data is
      not a problem.
      
      This patch removes the ftrace_sysctl_lock and ftrace_start_lock
      and uses the ftrace_lock to protect the locations that were protected
      by these locks. By doing so, this change also removes some of
      the lock nesting that was taking place.
      
      There are still more mutexes in ftrace.c that can probably be
      consolidated, but they can be dealt with later. We need to be careful
      about the way the locks are nested, and by consolidating, we can cause
      a recursive deadlock.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e6ea44e9
    • Steven Rostedt's avatar
      ftrace: convert ftrace_lock from a spinlock to mutex · 52baf119
      Steven Rostedt authored
      Impact: clean up
      
      The older versions of ftrace required doing the ftrace list
      search under atomic context. Now all the calls are in non-atomic
      context. There is no reason to keep the ftrace_lock as a spinlock.
      
      This patch converts it to a mutex.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      52baf119
    • 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>
      f6180773
    • Steven Rostedt's avatar
      ftrace: enable filtering only when a function is filtered on · e68746a2
      Steven Rostedt authored
      Impact: fix to prevent empty set_ftrace_filter and no ftrace output
      
      The function filter is used to only trace a given set of functions.
      The filter is enabled when a function name is echoed into the
      set_ftrace_filter file. But if the name has a typo and the function
      is not found, the filter is enabled, but no function is listed.
      
      This makes a confusing situation where set_ftrace_filter is empty
      but no functions ever get enabled for tracing.
      
      For example:
      
       # cat /debug/tracing/set_ftrace_filter
      
        #### all functions enabled ####
      
       # echo bad_name > set_ftrace_filter
       # cat /debug/tracing/set_ftrace_filter
      
       # echo function > current_tracer
       # cat trace
      
        # tracer: nop
        #
        #           TASK-PID    CPU#    TIMESTAMP  FUNCTION
        #              | |       |          |         |
      
      This patch changes that to only enable filtering if a function
      is set to be filtered on. Now, the filter is not enabled if
      a bad name is echoed into set_ftrace_filter.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e68746a2
    • Steven Rostedt's avatar
      ftrace: add module command function filter selection · 64e7c440
      Steven Rostedt authored
      This patch adds a "command" syntax to the function filtering files:
      
        /debugfs/tracing/set_ftrace_filter
        /debugfs/tracing/set_ftrace_notrace
      
      Of the format:  <function>:<command>:<parameter>
      
      The command is optional, and dependent on the command, so are
      the parameters.
      
       echo do_fork > set_ftrace_filter
      
      Will only trace 'do_fork'.
      
       echo 'sched_*' > set_ftrace_filter
      
      Will only trace functions starting with the letters 'sched_'.
      
       echo '*:mod:ext3' > set_ftrace_filter
      
      Will trace only the ext3 module functions.
      
       echo '*write*:mod:ext3' > set_ftrace_notrace
      
      Will prevent the ext3 functions with the letters 'write' in
      the name from being traced.
      
       echo '!*_allocate:mod:ext3' > set_ftrace_filter
      
      Will remove the functions in ext3 that end with the letters
      '_allocate' from the ftrace filter.
      
      Although this patch implements the 'command' format, only the
      'mod' command is supported. More commands to follow.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      64e7c440
    • Steven Rostedt's avatar
      ftrace: break up ftrace_match_records into smaller components · 9f4801e3
      Steven Rostedt authored
      Impact: clean up
      
      ftrace_match_records does a lot of things that other features
      can use. This patch breaks up ftrace_match_records and pulls
      out ftrace_setup_glob and ftrace_match_record.
      
      ftrace_setup_glob prepares a simple glob expression for use with
      ftrace_match_record. ftrace_match_record compares a single record
      with a glob type.
      
      Breaking this up will allow for more features to run on individual
      records.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      9f4801e3
    • Steven Rostedt's avatar
      ftrace: rename ftrace_match to ftrace_match_records · 7f24b31b
      Steven Rostedt authored
      Impact: clean up
      
      ftrace_match is too generic of a name. What it really does is
      search all records and matches the records with the given string,
      and either sets or unsets the functions to be traced depending
      on if the parameter 'enable' is set or not.
      
      This allows us to make another function called ftrace_match that
      can be used to test a single record.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      7f24b31b
    • Steven Rostedt's avatar
      ftrace: add do_for_each_ftrace_rec and while_for_each_ftrace_rec · 265c831c
      Steven Rostedt authored
      Impact: clean up
      
      To iterate over all the functions that dynamic trace knows about
      it requires two for loops. One to iterate over the pages and the
      other to iterate over the records within the page.
      
      There are several duplications of these loops in ftrace.c. This
      patch creates the macros do_for_each_ftrace_rec and
      while_for_each_ftrace_rec to handle this logic, and removes the
      duplicate code.
      
      While making this change, I also discovered and fixed a small
      bug that one of the iterations should exit the loop after it found the
      record it was searching for. This used a break when it should have
      used a goto, since there were two loops it needed to break out
      from.  No real harm was done by this bug since it would only continue
      to search the other records, and the code was in a slow path anyway.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      265c831c
    • Steven Rostedt's avatar
      ftrace: state that all functions are enabled in set_ftrace_filter · 0c75a3ed
      Steven Rostedt authored
      Impact: clean up, make set_ftrace_filter less confusing
      
      The set_ftrace_filter shows only the functions that will be traced.
      But when it is empty, it will trace all functions. This can be a bit
      confusing.
      
      This patch makes set_ftrace_filter show:
      
        #### all functions enabled ####
      
      When all functions will be traced, and we do not filter only a select
      few.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      0c75a3ed
  3. 15 Feb, 2009 6 commits
    • Ingo Molnar's avatar
      Merge branch 'tip/tracing/ftrace' of... · 72b623c7
      Ingo Molnar authored
      Merge branch 'tip/tracing/ftrace' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace into tracing/power-tracer
      72b623c7
    • Rakib Mullick's avatar
      tracing: fix section mismatch in trace_hw_branches.c · a234aa9e
      Rakib Mullick authored
      The function bts_trace_init() references a variable
      bts_hotcpu_notifier which is marked
      as __cpuinitdata. Thus causes section mismatch. This patch fixes it.
      
         LD      kernel/trace/built-in.o
       WARNING: kernel/trace/built-in.o(.text+0xc90c): Section mismatch in
       reference from the function bts_trace_init() to the variable
       .cpuinit.data:bts_hotcpu_notifier
       The function bts_trace_init() references
       the variable __cpuinitdata bts_hotcpu_notifier.
       This is often because bts_trace_init lacks a __cpuinitdata
       annotation or the annotation of bts_hotcpu_notifier is wrong.
      
       WARNING: kernel/trace/built-in.o(.text+0xc92a): Section mismatch in
       reference from the function bts_trace_reset() to the variable
       .cpuinit.data:bts_hotcpu_notifier
       The function bts_trace_reset() references
       the variable __cpuinitdata bts_hotcpu_notifier.
       This is often because bts_trace_reset lacks a __cpuinitdata
       annotation or the annotation of bts_hotcpu_notifier is wrong.
      Signed-off-by: default avatarRakib Mullick <rakib.mullick@gmail.com>
      Cc: markus.t.metzger@gmail.com
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a234aa9e
    • Ingo Molnar's avatar
      Merge branches 'tracing/ftrace' and 'tracing/urgent' into tracing/core · 9abd6030
      Ingo Molnar authored
      Conflicts:
      	kernel/trace/trace_mmiotrace.c
      9abd6030
    • Pekka Paalanen's avatar
      doc: mmiotrace.txt, buffer size control change · f9aa28ad
      Pekka Paalanen authored
      Impact: prevents confusing the user when buffer size is inadequate
      
      The tracing framework offers a resizeable buffer, which mmiotrace uses
      to record events. If the buffer is full, the following events will be
      lost. Events should not be lost, so the documentation instructs the user
      to increase the buffer size. The buffer size is set via a debugfs file.
      
      Mmiotrace documentation was not updated the same time the debugfs file
      was changed. The old file was tracing/trace_entries and first contained
      the number of entries the buffer had space for, per cpu. Nowadays this
      file is replaced with the file tracing/buffer_size_kb, which tells the
      amount of memory reserved for the buffer, per cpu, in kilobytes.
      
      Previously, a flag had to be toggled via the debugfs file
      tracing/tracing_enabled when the buffer size was changed. This is no
      longer necessary.
      
      The mmiotrace documentation is updated to reflect the current state of
      the tracing framework.
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f9aa28ad
    • Pekka Paalanen's avatar
      trace: mmiotrace to the tracer menu in Kconfig · 6bc5c366
      Pekka Paalanen authored
      Impact: cosmetic change in Kconfig menu layout
      
      This patch was originally suggested by Peter Zijlstra, but seems it
      was forgotten.
      
      CONFIG_MMIOTRACE and CONFIG_MMIOTRACE_TEST were selectable
      directly under the Kernel hacking / debugging menu in the kernel
      configuration system. They were present only for x86 and x86_64.
      
      Other tracers that use the ftrace tracing framework are in their own
      sub-menu. This patch moves the mmiotrace configuration options there.
      Since the Kconfig file, where the tracer menu is, is not architecture
      specific, HAVE_MMIOTRACE_SUPPORT is introduced and provided only by
      x86/x86_64. CONFIG_MMIOTRACE now depends on it.
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6bc5c366
    • Pekka Paalanen's avatar
      mmiotrace: count events lost due to not recording · 391b170f
      Pekka Paalanen authored
      Impact: enhances lost events counting in mmiotrace
      
      The tracing framework, or the ring buffer facility it uses, has a switch
      to stop recording data. When recording is off, the trace events will be
      lost. The framework does not count these, so mmiotrace has to count them
      itself.
      Signed-off-by: default avatarPekka Paalanen <pq@iki.fi>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      391b170f
  4. 13 Feb, 2009 10 commits