1. 19 11月, 2008 3 次提交
    • S
      ftrace: fix dyn ftrace filter selection · 32464779
      Steven Rostedt 提交于
      Impact: clean up and fix for dyn ftrace filter selection
      
      The previous logic of the dynamic ftrace selection of enabling
      or disabling functions was complex and incorrect. This patch simplifies
      the code and corrects the usage. This simplification also makes the
      code more robust.
      
      Here is the correct logic:
      
        Given a function that can be traced by dynamic ftrace:
      
        If the function is not to be traced, disable it if it was enabled.
        (this is if the function is in the set_ftrace_notrace file)
      
        (filter is on if there exists any functions in set_ftrace_filter file)
      
        If the filter is on, and we are enabling functions:
          If the function is in set_ftrace_filter, enable it if it is not
            already enabled.
          If the function is not in set_ftrace_filter, disable it if it is not
            already disabled.
      
        Otherwise, if the filter is off and we are enabling function tracing:
          Enable the function if it is not already enabled.
      
        Otherwise, if we are disabling function tracing:
          Disable the function if it is not already disabled.
      
      This code now sets or clears the ENABLED flag in the record, and at the
      end it will enable the function if the flag is set, or disable the function
      if the flag is cleared.
      
      The parameters for the function that does the above logic is also
      simplified. Instead of passing in confusing "new" and "old" where
      they might be swapped if the "enabled" flag is not set. The old logic
      even had one of the above always NULL and had to be filled in. The new
      logic simply passes in one parameter called "nop". A "call" is calculated
      in the code, and at the end of the logic, when we know we need to either
      disable or enable the function, we can then use the "nop" and "call"
      properly.
      
      This code is more robust than the previous version.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      32464779
    • S
      ftrace: make filtered functions effective on setting · 82043278
      Steven Rostedt 提交于
      Impact: fix filter selection to apply when set
      
      It can be confusing when the set_filter_functions is set (or cleared)
      and the functions being recorded by the dynamic tracer does not
      match.
      
      This patch causes the code to be updated if the function tracer is
      enabled and the filter is changed.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      82043278
    • S
      ftrace: fix set_ftrace_filter · f10ed36e
      Steven Rostedt 提交于
      Impact: fix of output of set_ftrace_filter
      
      The commit "ftrace: do not show freed records in
                   available_filter_functions"
      
      Removed a bit too much from the set_ftrace_filter code, where we now see
      all functions in the set_ftrace_filter file even when we set a filter.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f10ed36e
  2. 29 10月, 2008 1 次提交
    • F
      ftrace: perform an initialization for ftrace to enable it · 0b6e4d56
      Frederic Weisbecker 提交于
      Impact: corrects a bug which made the non-dyn function tracer not functional
      
      With latest git, the non-dynamic function tracer didn't get any trace.
      
      The problem was the fact that ftrace_enabled wasn't initialized to 1
      because ftrace hasn't any init function when DYNAMIC_FTRACE is disabled.
      
      So when a tracer tries to register an ftrace_ops struct,
      __register_ftrace_function failed to set the hook.
      
      This patch corrects it by setting an init function to initialize
      ftrace during the boot.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0b6e4d56
  3. 24 10月, 2008 1 次提交
    • I
      ftrace: warning in kernel/trace/ftrace.c · f17845e5
      Ingo Molnar 提交于
      this warning:
      
        kernel/trace/ftrace.c:189: warning: ‘frozen_record_count’ defined but not used
      
      triggers because frozen_record_count is only used in the KCONFIG_MARKERS
      case. Move the variable it there.
      
      Alas, this frozen-record facility seems to have little use. The
      frozen_record_count variable is not used by anything, nor the flags.
      
      So this section might need a bit of dead-code-removal care as well.
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f17845e5
  4. 23 10月, 2008 7 次提交
  5. 21 10月, 2008 1 次提交
    • S
      ftrace: release functions from hash · bd95b88d
      Steven Rostedt 提交于
      The x86 architecture uses a static recording of mcount caller locations
      and is not affected by this patch.
      
      For architectures still using the dynamic ftrace daemon, this patch is
      critical. It removes the race between the recording of a function that
      calls mcount, the unloading of a module, and the ftrace daemon updating
      the call sites.
      
      This patch adds the releasing of the hash functions that the daemon uses
      to update the mcount call sites. When a module is unloaded, not only
      are the replaced call site table update, but now so is the hash recorded
      functions that the ftrace daemon will use.
      
      Again, architectures that implement MCOUNT_RECORD are not affected by
      this (which currently only x86 has).
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bd95b88d
  6. 14 10月, 2008 12 次提交
  7. 28 7月, 2008 1 次提交
  8. 11 7月, 2008 2 次提交
    • I
      ftrace: build fix for ftraced_suspend · b2613e37
      Ingo Molnar 提交于
      fix:
      
       kernel/trace/ftrace.c:1615: error: 'ftraced_suspend' undeclared (first use in this function)
       kernel/trace/ftrace.c:1615: error: (Each undeclared identifier is reported only once
       kernel/trace/ftrace.c:1615: error: for each function it appears in.)
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b2613e37
    • S
      ftrace: add ftrace_kill_atomic · a2bb6a3d
      Steven Rostedt 提交于
      It has been suggested that I add a way to disable the function tracer
      on an oops. This code adds a ftrace_kill_atomic. It is not meant to be
      used in normal situations. It will disable the ftrace tracer, but will
      not perform the nice shutdown that requires scheduling.
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Cc: Steven Rostedt <srostedt@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a2bb6a3d
  9. 03 7月, 2008 1 次提交
  10. 24 6月, 2008 3 次提交
    • A
      ftrace: avoid modifying kprobe'd records · f22f9a89
      Abhishek Sagar 提交于
      Avoid modifying the mcount call-site if there is a kprobe installed on it.
      These records are not marked as failed however. This allowed the filter
      rules on them to remain up-to-date. Whenever the kprobe on the corresponding
      record is removed, the record gets updated as normal.
      Signed-off-by: NAbhishek Sagar <sagar.abhishek@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f22f9a89
    • A
      ftrace: freeze kprobe'd records · ecea656d
      Abhishek Sagar 提交于
      Let records identified as being kprobe'd be marked as "frozen". The trouble
      with records which have a kprobe installed on their mcount call-site is
      that they don't get updated. So if such a function which is currently being
      traced gets its tracing disabled due to a new filter rule (or because it
      was added to the notrace list) then it won't be updated and continue being
      traced. This patch allows scanning of all frozen records during tracing to
      check if they should be traced.
      Signed-off-by: NAbhishek Sagar <sagar.abhishek@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ecea656d
    • A
      ftrace: store mcount address in rec->ip · 395a59d0
      Abhishek Sagar 提交于
      Record the address of the mcount call-site. Currently all archs except sparc64
      record the address of the instruction following the mcount call-site. Some
      general cleanups are entailed. Storing mcount addresses in rec->ip enables
      looking them up in the kprobe hash table later on to check if they're kprobe'd.
      Signed-off-by: NAbhishek Sagar <sagar.abhishek@gmail.com>
      Cc: davem@davemloft.net
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      395a59d0
  11. 16 6月, 2008 1 次提交
  12. 14 6月, 2008 1 次提交
  13. 10 6月, 2008 4 次提交
  14. 02 6月, 2008 1 次提交
    • S
      ftrace: user update and disable dynamic ftrace daemon · ad90c0e3
      Steven Rostedt 提交于
      In dynamic ftrace, the mcount function starts off pointing to a stub
      function that just returns.
      
      On start up, the call to the stub is modified to point to a "record_ip"
      function. The job of the record_ip function is to add the function to
      a pre-allocated hash list. If the function is already there, it simply is
      ignored, otherwise it is added to the list.
      
      Later, a ftraced daemon wakes up and calls kstop_machine if any functions
      have been recorded, and changes the calls to the recorded functions to
      a simple nop.  If no functions were recorded, the daemon goes back to sleep.
      
      The daemon wakes up once a second to see if it needs to update any newly
      recorded functions into nops.  Usually it does not, but if a lot of code
      has been executed for the first time in the kernel, the ftraced daemon
      will call kstop_machine to update those into nops.
      
      The problem currently is that there's no way to stop the daemon from doing
      this, and it can cause unneeded latencies (800us which for some is bothersome).
      
      This patch adds a new file /debugfs/tracing/ftraced_enabled. If the daemon
      is active, reading this will return "enabled\n" and "disabled\n" when the
      daemon is not running. To disable the daemon, the user can echo "0" or
      "disable" into this file, and "1" or "enable" to re-enable the daemon.
      
      Since the daemon is used to convert the functions into nops to increase
      the performance of the system, I also added that anytime something is
      written into the ftraced_enabled file, kstop_machine will run if there
      are new functions that have been detected that need to be converted.
      
      This way the user can disable the daemon but still be able to control the
      conversion of the mcount calls to nops by simply,
      
        "echo 0 > /debugfs/tracing/ftraced_enabled"
      
      when they need to do more conversions.
      
      To see the number of converted functions:
      
        "cat /debugfs/tracing/dyn_ftrace_total_info"
      Signed-off-by: NSteven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ad90c0e3
  15. 27 5月, 2008 1 次提交