1. 10 6月, 2014 1 次提交
  2. 07 6月, 2014 1 次提交
    • S
      tracing: Fix memory leak on instance deletion · a9fcaaac
      Steven Rostedt (Red Hat) 提交于
      When an instance is created, it also gets a snapshot ring buffer
      allocated (with minimum of pages). But when it is deleted the snapshot
      buffer is not. There was a helper function added to match the allocation
      of these ring buffers to a way to free them, but it wasn't used by
      the deletion of an instance. Using that helper function solves this
      memory leak.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      a9fcaaac
  3. 06 6月, 2014 2 次提交
  4. 04 6月, 2014 1 次提交
  5. 31 5月, 2014 1 次提交
  6. 30 5月, 2014 3 次提交
    • S
      tracing: Try again for saved cmdline if failed due to locking · 379cfdac
      Steven Rostedt (Red Hat) 提交于
      In order to prevent the saved cmdline cache from being filled when
      tracing is not active, the comms are only recorded after a trace event
      is recorded.
      
      The problem is, a comm can fail to be recorded if the trace_cmdline_lock
      is held. That lock is taken via a trylock to allow it to happen from
      any context (including NMI). If the lock fails to be taken, the comm
      is skipped. No big deal, as we will try again later.
      
      But! Because of the code that was added to only record after an event,
      we may not try again later as the recording is made as a oneshot per
      event per CPU.
      
      Only disable the recording of the comm if the comm is actually recorded.
      
      Fixes: 7ffbd48d "tracing: Cache comms only after an event occurred"
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      379cfdac
    • Y
      tracing: Have saved_cmdlines use the seq_read infrastructure · 42584c81
      Yoshihiro YUNOMAE 提交于
      Current tracing_saved_cmdlines_read() implementation is naive; It allocates
      a large buffer, constructs output data to that buffer for each read
      operation, and then copies a portion of the buffer to the user space
      buffer. This has several issues such as slow memory allocation, high
      CPU usage, and even corruption of the output data.
      
      The seq_read infrastructure is made to handle this type of work.
      By converting it to use seq_read() the code becomes smaller, simplified,
      as well as correct.
      
      Link: http://lkml.kernel.org/p/20140220084431.3839.51793.stgit@yunodevelSigned-off-by: NHidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: NYoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      42584c81
    • S
      tracing: Print nasty banner when trace_printk() is in use · 2184db46
      Steven Rostedt 提交于
      trace_printk() is used to debug fast paths within the kernel. Places
      that gets called in any context (interrupt or NMI) or thousands of
      times a second. Something you do not want to do with a printk().
      
      In order to make it completely lockless as it needs a temporary buffer
      to handle some of the string formatting, a page is created per cpu for
      every context (four per cpu; normal, softirq, irq, NMI).
      
      Since trace_printk() should only be used for debugging purposes,
      there's no reason to waste memory on these buffers on a production
      system. That means, trace_printk() should never be used unless a
      developer is debugging their kernel. There's macro magic to allocate
      the buffers if trace_printk() is used anywhere in the kernel.
      
      To help enforce that trace_printk() isn't used outside of development,
      when it is used, a nasty banner is displayed on bootup (or when a module
      is loaded that uses trace_printk() and the kernel core does not).
      
      Here's the banner:
      
       **********************************************************
       **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
       **                                                      **
       ** trace_printk() being used. Allocating extra memory.  **
       **                                                      **
       ** This means that this is a DEBUG kernel and it is     **
       ** unsafe for produciton use.                           **
       **                                                      **
       ** If you see this message and you are not debugging    **
       ** the kernel, report this immediately to your vendor!  **
       **                                                      **
       **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
       **********************************************************
      
      That should hopefully keep developers from trying to sneak in a
      trace_printk() or two.
      
      Link: http://lkml.kernel.org/p/20140528131440.2283213c@gandalf.local.homeSigned-off-by: NSteven Rostedt <rostedt@goodmis.org>
      2184db46
  7. 06 5月, 2014 1 次提交
  8. 30 4月, 2014 2 次提交
  9. 22 4月, 2014 4 次提交
  10. 12 4月, 2014 1 次提交
  11. 11 4月, 2014 1 次提交
  12. 02 4月, 2014 1 次提交
  13. 26 3月, 2014 1 次提交
    • S
      tracing: Fix traceon trigger condition to actually turn tracing on · 2c4a33ab
      Steven Rostedt (Red Hat) 提交于
      While working on my tutorial for 2014 Linux Collaboration Summit
      I found that the traceon trigger did not work when conditions were
      used. The other triggers worked fine though. Looking into it, it
      is because of the way the triggers use the ring buffer to store
      the fields it will use for the condition. But if tracing is off, nothing
      is stored in the buffer, and the tracepoint exits before calling the
      trigger to test the condition. This is fine for all the triggers that
      only work when tracing is on, but for traceon trigger that is to
      work when tracing is off, nothing happens.
      
      The fix is simple, just use a temp ring buffer to record the event
      if tracing is off and the event has a trace event conditional trigger
      enabled. The rest of the tracepoint code will work just fine, but
      the tracepoint wont be recorded in the other buffers.
      
      Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      2c4a33ab
  14. 21 2月, 2014 8 次提交
  15. 24 1月, 2014 1 次提交
  16. 23 1月, 2014 2 次提交
  17. 20 1月, 2014 1 次提交
    • A
      tracing: Fix buggered tee(2) on tracing_pipe · 92fdd98c
      Al Viro 提交于
      In kernel/trace/trace.c we have this:
      static void tracing_pipe_buf_release(struct pipe_inode_info *pipe,
                                           struct pipe_buffer *buf)
      {
              __free_page(buf->page);
      }
      static const struct pipe_buf_operations tracing_pipe_buf_ops = {
              .can_merge              = 0,
              .map                    = generic_pipe_buf_map,
              .unmap                  = generic_pipe_buf_unmap,
              .confirm                = generic_pipe_buf_confirm,
              .release                = tracing_pipe_buf_release,
              .steal                  = generic_pipe_buf_steal,
              .get                    = generic_pipe_buf_get,
      };
      with
      void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
      {
              page_cache_get(buf->page);
      }
      
      and I don't see anything that would've prevented tee(2) called on the pipe
      that got stuff spliced into it from that sucker.  ->ops->get() will be
      called, then buf gets copied into target pipe's ->bufs[] and eventually
      readers get to both copies of the buffer.  With
      	get_page(page)
      	look at that page
      	__free_page(page)
      	look at that page
      	__free_page(page)
      which is not a good thing, to put it mildly.  AFAICS, that ought to use
      the normal generic_pipe_buf_release() (aka page_cache_release(buf->page)),
      shouldn't it?
      
      [
       SDR - As trace_pipe just allocates the page with alloc_page(GFP_KERNEL),
        and doesn't do anything special with it (no LRU logic). The __free_page()
        should be fine, as it wont actually free a page with reference count.
        Maybe there's a chance to leak memory? Anyway, This change is at a minimum
        good for being symmetric with generic_pipe_buf_get, it is fine to add.
      ]
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      [ SDR - Removed no longer used tracing_pipe_buf_release ]
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      92fdd98c
  18. 14 1月, 2014 1 次提交
    • S
      tracing: Have trace buffer point back to trace_array · dced341b
      Steven Rostedt (Red Hat) 提交于
      The trace buffer has a descriptor pointer that goes back to the trace
      array. But it was never assigned. Luckily, nothing uses it (yet), but
      it will in the future.
      
      Although nothing currently uses this, if any of the new features get
      backported to older kernels, and because this is such a simple change,
      I'm marking it for stable too.
      
      Cc: stable@vger.kernel.org # v3.10+
      Fixes: 12883efb "tracing: Consolidate max_tr into main trace_array structure"
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      dced341b
  19. 03 1月, 2014 1 次提交
  20. 22 12月, 2013 1 次提交
    • T
      tracing: Add 'snapshot' event trigger command · 93e31ffb
      Tom Zanussi 提交于
      Add 'snapshot' event_command.  snapshot event triggers are added by
      the user via this command in a similar way and using practically the
      same syntax as the analogous 'snapshot' ftrace function command, but
      instead of writing to the set_ftrace_filter file, the snapshot event
      trigger is written to the per-event 'trigger' files:
      
          echo 'snapshot' > .../somesys/someevent/trigger
      
      The above command will turn on snapshots for someevent i.e. whenever
      someevent is hit, a snapshot will be done.
      
      This also adds a 'count' version that limits the number of times the
      command will be invoked:
      
          echo 'snapshot:N' > .../somesys/someevent/trigger
      
      Where N is the number of times the command will be invoked.
      
      The above command will snapshot N times for someevent i.e. whenever
      someevent is hit N times, a snapshot will be done.
      
      Also adds a new tracing_alloc_snapshot() function - the existing
      tracing_snapshot_alloc() function is a special version of
      tracing_snapshot() that also does the snapshot allocation - the
      snapshot triggers would like to be able to do just the allocation but
      not take a snapshot; the existing tracing_snapshot_alloc() in turn now
      also calls tracing_alloc_snapshot() underneath to do that allocation.
      
      Link: http://lkml.kernel.org/r/c9524dd07ce01f9dcbd59011290e0a8d5b47d7ad.1382622043.git.tom.zanussi@linux.intel.comSigned-off-by: NTom Zanussi <tom.zanussi@linux.intel.com>
      [ fix up from kbuild test robot <fengguang.wu@intel.com report ]
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      93e31ffb
  21. 11 11月, 2013 1 次提交
  22. 07 11月, 2013 2 次提交
  23. 06 11月, 2013 2 次提交