1. 10 12月, 2009 1 次提交
    • S
      tracing: Buffer the output of seq_file in case of filled buffer · a63ce5b3
      Steven Rostedt 提交于
      If the seq_read fills the buffer it will call s_start again on the next
      itertation with the same position. This causes a problem with the
      function_graph tracer because it consumes the iteration in order to
      determine leaf functions.
      
      What happens is that the iterator stores the entry, and the function
      graph plugin will look at the next entry. If that next entry is a return
      of the same function and task, then the function is a leaf and the
      function_graph plugin calls ring_buffer_read which moves the ring buffer
      iterator forward (the trace iterator still points to the function start
      entry).
      
      The copying of the trace_seq to the seq_file buffer will fail if the
      seq_file buffer is full. The seq_read will not show this entry.
      The next read by userspace will cause seq_read to again call s_start
      which will reuse the trace iterator entry (the function start entry).
      But the function return entry was already consumed. The function graph
      plugin will think that this entry is a nested function and not a leaf.
      
      To solve this, the trace code now checks the return status of the
      seq_printf (trace_print_seq). If the writing to the seq_file buffer
      fails, we set a flag in the iterator (leftover) and we do not reset
      the trace_seq buffer. On the next call to s_start, we check the leftover
      flag, and if it is set, we just reuse the trace_seq buffer and do not
      call into the plugin print functions.
      
      Before this patch:
      
       2)               |      fput() {
       2)               |        __fput() {
       2)   0.550 us    |          inotify_inode_queue_event();
       2)               |          __fsnotify_parent() {
       2)   0.540 us    |          inotify_dentry_parent_queue_event();
      
      After the patch:
      
       2)               |      fput() {
       2)               |        __fput() {
       2)   0.550 us    |          inotify_inode_queue_event();
       2)   0.548 us    |          __fsnotify_parent();
       2)   0.540 us    |          inotify_dentry_parent_queue_event();
      
      [
        Updated the patch to fix a missing return 0 from the trace_print_seq()
        stub when CONFIG_TRACING is disabled.
      Reported-by: NIngo Molnar <mingo@elte.hu>
      ]
      Reported-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      a63ce5b3
  2. 24 10月, 2009 1 次提交
  3. 15 6月, 2009 1 次提交
  4. 10 6月, 2009 1 次提交
  5. 21 4月, 2009 1 次提交
  6. 18 4月, 2009 1 次提交
  7. 15 4月, 2009 2 次提交
    • S
      tracing/events: add support for modules to TRACE_EVENT · 6d723736
      Steven Rostedt 提交于
      Impact: allow modules to add TRACE_EVENTS on load
      
      This patch adds the final hooks to allow modules to use the TRACE_EVENT
      macro. A notifier and a data structure are used to link the TRACE_EVENTs
      defined in the module to connect them with the ftrace event tracing system.
      
      It also adds the necessary automated clean ups to the trace events when a
      module is removed.
      
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      6d723736
    • S
      tracing: make trace_seq operations available for core kernel · 9504504c
      Steven Rostedt 提交于
      In the process to make TRACE_EVENT macro work for modules, the trace_seq
      operations must be available for core kernel code.
      
      These operations are quite useful and can be used for other implementations.
      
      The main idea is that we create a trace_seq handle that acts very much
      like the seq_file handle.
      
      	struct trace_seq *s = kmalloc(sizeof(*s, GFP_KERNEL);
      
      	trace_seq_init(s);
      	trace_seq_printf(s, "some data %d\n", variable);
      
      	printk("%s", s->buffer);
      
      The main use is to allow a top level function call several other functions
      that may store printf like data into the buffer. Then at the end, the top
      level function can process all the data with any method it would like to.
      It could be passed to userspace, output via printk or even use seq_file:
      
      	trace_seq_to_user(s, ubuf, cnt);
      	seq_puts(m, s->buffer);
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      9504504c