1. 17 May, 2012 3 commits
    • Steven Rostedt's avatar
      ftrace: Remove selecting FRAME_POINTER with FUNCTION_TRACER · b732d439
      Steven Rostedt authored
      The function tracer will enable the -pg option with gcc, which requires
      that frame pointers. When FRAME_POINTER is defined in the kernel config
      it adds the gcc option -fno-omit-frame-pointer which causes some problems
      on some architectures. For those architectures, the FRAME_POINTER select
      was not set.
      
      When FUNCTION_TRACER was selected on these architectures that can not have
      -fno-omit-frame-pointer, the -pg option is still set. But when
      FRAME_POINTER is not selected, the kernel config would add the gcc option
      -fomit-frame-pointer. Adding this option is incompatible with -pg
      even on archs that do not need frame pointers with -pg.
      
      The answer to this was to just not add either -fno-omit-frame-pointer
      or -fomit-frame-pointer on these archs that want function tracing
      but do not set FRAME_POINTER.
      
      As it turns out, for archs that require frame pointers for function
      tracing, the same can be used. If gcc requires frame pointers with
      -pg, it will simply add it. The best thing to do is not select FRAME_POINTER
      when function tracing is selected, and let gcc add it if needed.
      
      Only add the -fno-omit-frame-pointer when something else selects
      FRAME_POINTER, but do not add -fomit-frame-pointer if function tracing
      is selected.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      b732d439
    • Steven Rostedt's avatar
      ftrace/x86: Have x86 ftrace use the ftrace_modify_all_code() · e4f5d544
      Steven Rostedt authored
      To remove duplicate code, have the ftrace arch_ftrace_update_code()
      use the generic ftrace_modify_all_code(). This requires that the
      default ftrace_replace_code() becomes a weak function so that an
      arch may override it.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      e4f5d544
    • Steven Rostedt's avatar
      ftrace: Make ftrace_modify_all_code() global for archs to use · 8ed3e2cf
      Steven Rostedt authored
      Rename __ftrace_modify_code() to ftrace_modify_all_code() and make
      it global for all archs to use. This will remove the duplication
      of code, as archs that can modify code without stop_machine()
      can use it directly outside of the stop_machine() call.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      8ed3e2cf
  2. 16 May, 2012 12 commits
    • Steven Rostedt's avatar
      ftrace: Return record ip addr for ftrace_location() · f0cf973a
      Steven Rostedt authored
      ftrace_location() is passed an addr, and returns 1 if the addr is
      on a ftrace nop (or caller to ftrace_caller), and 0 otherwise.
      
      To let kprobes know if it should move a breakpoint or not, it
      must return the actual addr that is the start of the ftrace nop.
      This way a kprobe placed on the location of a ftrace nop, can
      instead be placed on the instruction after the nop. Even if the
      probe addr is on the second or later byte of the nop, it can
      simply be moved forward.
      
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      f0cf973a
    • Steven Rostedt's avatar
      ftrace: Consolidate ftrace_location() and ftrace_text_reserved() · a650e02a
      Steven Rostedt authored
      Both ftrace_location() and ftrace_text_reserved() do basically the same thing.
      They search to see if an address is in the ftace table (contains an address
      that may change from nop to call ftrace_caller). The difference is
      that ftrace_location() searches a single address, but ftrace_text_reserved()
      searches a range.
      
      This also makes the ftrace_text_reserved() faster as it now uses a bsearch()
      instead of linearly searching all the addresses within a page.
      
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      a650e02a
    • Steven Rostedt's avatar
      ftrace: Speed up search by skipping pages by address · 9644302e
      Steven Rostedt authored
      As all records in a page of the ftrace table are sorted, we can
      speed up the search algorithm by checking if the address to look for
      falls in between the first and last record ip on the page.
      
      This speeds up both the ftrace_location() and ftrace_text_reserved()
      algorithms, as it can skip full pages when the search address is
      not in them.
      
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      9644302e
    • Steven Rostedt's avatar
      ftrace: Remove extra helper functions · 706c81f8
      Steven Rostedt authored
      The ftrace_record_ip() and ftrace_alloc_dyn_node() were from the
      time of the ftrace daemon. Although they were still used, they
      still make things a bit more complex than necessary.
      
      Move the code into the one function that uses it, and remove the
      helper functions.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      706c81f8
    • Steven Rostedt's avatar
      ftrace: Sort all function addresses, not just per page · 9fd49328
      Steven Rostedt authored
      Instead of just sorting the ip's of the functions per ftrace page,
      sort the entire list before adding them to the ftrace pages.
      
      This will allow the bsearch algorithm to be sped up as it can
      also sort by pages, not just records within a page.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      9fd49328
    • Vaibhav Nagarnaik's avatar
      tracing: change CPU ring buffer state from tracing_cpumask · 71babb27
      Vaibhav Nagarnaik authored
      According to Documentation/trace/ftrace.txt:
      
      tracing_cpumask:
      
              This is a mask that lets the user only trace
              on specified CPUS. The format is a hex string
              representing the CPUS.
      
      The tracing_cpumask currently doesn't affect the tracing state of
      per-CPU ring buffers.
      
      This patch enables/disables CPU recording as its corresponding bit in
      tracing_cpumask is set/unset.
      
      Link: http://lkml.kernel.org/r/1336096792-25373-3-git-send-email-vnagarnaik@google.com
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Laurent Chavey <chavey@google.com>
      Cc: Justin Teravest <teravest@google.com>
      Cc: David Sharp <dhsharp@google.com>
      Signed-off-by: default avatarVaibhav Nagarnaik <vnagarnaik@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      71babb27
    • Namhyung Kim's avatar
      tracing: Check return value of tracing_dentry_percpu() · 0a3d7ce7
      Namhyung Kim authored
      If tracing_dentry_percpu() failed, tracing_init_debugfs_percpu()
      will try to create each cpu directories on debugfs' root directory
      as d_percpu is NULL.
      
      Link: http://lkml.kernel.org/r/1335143517-2285-1-git-send-email-namhyung.kim@lge.com
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung.kim@lge.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      0a3d7ce7
    • Steven Rostedt's avatar
      ring-buffer: Reset head page before running self test · 308f7eeb
      Steven Rostedt authored
      When the ring buffer does its consistency test on itself, it
      removes the head page, runs the tests, and then adds it back
      to what the "head_page" pointer was. But because the head_page
      pointer may lack behind the real head page (held by the link
      list pointer). The reset may be incorrect.
      
      Instead, if the head_page exists (it does not on first allocation)
      reset it back to the real head page before running the consistency
      tests. Then it will be put back to its original location after
      the tests are complete.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      308f7eeb
    • Steven Rostedt's avatar
      ring-buffer: Add integrity check at end of iter read · 659f451f
      Steven Rostedt authored
      There use to be ring buffer integrity checks after updating the
      size of the ring buffer. But now that the ring buffer can modify
      the size while the system is running, the integrity checks were
      removed, as they require the ring buffer to be disabed to perform
      the check.
      
      Move the integrity check to the reading of the ring buffer via the
      iterator reads (the "trace" file). As reading via an iterator requires
      disabling the ring buffer, it is a perfect place to have it.
      
      If the ring buffer happens to be disabled when updating the size,
      we still perform the integrity check.
      
      Cc: Vaibhav Nagarnaik <vnagarnaik@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      659f451f
    • Vaibhav Nagarnaik's avatar
      ring-buffer: Make addition of pages in ring buffer atomic · 5040b4b7
      Vaibhav Nagarnaik authored
      This patch adds the capability to add new pages to a ring buffer
      atomically while write operations are going on. This makes it possible
      to expand the ring buffer size without reinitializing the ring buffer.
      
      The new pages are attached between the head page and its previous page.
      
      Link: http://lkml.kernel.org/r/1336096792-25373-2-git-send-email-vnagarnaik@google.com
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Laurent Chavey <chavey@google.com>
      Cc: Justin Teravest <teravest@google.com>
      Cc: David Sharp <dhsharp@google.com>
      Signed-off-by: default avatarVaibhav Nagarnaik <vnagarnaik@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      5040b4b7
    • Vaibhav Nagarnaik's avatar
      ring-buffer: Make removal of ring buffer pages atomic · 83f40318
      Vaibhav Nagarnaik authored
      This patch adds the capability to remove pages from a ring buffer
      without destroying any existing data in it.
      
      This is done by removing the pages after the tail page. This makes sure
      that first all the empty pages in the ring buffer are removed. If the
      head page is one in the list of pages to be removed, then the page after
      the removed ones is made the head page. This removes the oldest data
      from the ring buffer and keeps the latest data around to be read.
      
      To do this in a non-racey manner, tracing is stopped for a very short
      time while the pages to be removed are identified and unlinked from the
      ring buffer. The pages are freed after the tracing is restarted to
      minimize the time needed to stop tracing.
      
      The context in which the pages from the per-cpu ring buffer are removed
      runs on the respective CPU. This minimizes the events not traced to only
      NMI trace contexts.
      
      Link: http://lkml.kernel.org/r/1336096792-25373-1-git-send-email-vnagarnaik@google.com
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Laurent Chavey <chavey@google.com>
      Cc: Justin Teravest <teravest@google.com>
      Cc: David Sharp <dhsharp@google.com>
      Signed-off-by: default avatarVaibhav Nagarnaik <vnagarnaik@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      83f40318
    • Steven Rostedt's avatar
      tracing: Clean up tracing_mark_write() · 6edb2a8a
      Steven Rostedt authored
      On gcc 4.5 the function tracing_mark_write() would give a warning
      of page2 being uninitialized. This is due to a bug in gcc because
      the logic prevents page2 from being used uninitialized, and
      gcc 4.6+ does not complain (correctly).
      
      Instead of adding a "unitialized" around page2, which could show
      a bug later on, I combined page1 and page2 into an array map_pages[].
      This binds the two and the two are modified according to nr_pages
      (what gcc 4.5 seems to ignore). This no longer gives a warning with
      gcc 4.5 nor with gcc 4.6.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6edb2a8a
  3. 14 May, 2012 2 commits
  4. 12 May, 2012 5 commits
  5. 11 May, 2012 4 commits
  6. 10 May, 2012 1 commit
  7. 09 May, 2012 13 commits