1. 06 Mar, 2009 3 commits
    • Steven Rostedt's avatar
      tracing: add format files for ftrace default entries · 770cb243
      Steven Rostedt authored
      Impact: allow user apps to read binary format of basic ftrace entries
      
      Currently, only defined raw events export their formats so a binary
      reader can parse them. There's no reason that the default ftrace entries
      can't export their formats.
      
      This patch adds a subsystem called "ftrace" in the events directory
      that includes the ftrace entries for basic ftrace recorded items.
      
      These only have three files in the events directory:
      
       type             : printf
       available_types  : printf
       format           : format for the event entry
      
      For example:
      
       # cat /debug/tracing/events/ftrace/wakeup/format
      name: wakeup
      ID: 3
      format:
              field:unsigned char type;       offset:0;       size:1;
              field:unsigned char flags;      offset:1;       size:1;
              field:unsigned char preempt_count;      offset:2;       size:1;
              field:int pid;  offset:4;       size:4;
              field:int tgid; offset:8;       size:4;
      
              field:unsigned int prev_pid;    offset:12;      size:4;
              field:unsigned char prev_prio;  offset:16;      size:1;
              field:unsigned char prev_state; offset:17;      size:1;
              field:unsigned int next_pid;    offset:20;      size:4;
              field:unsigned char next_prio;  offset:24;      size:1;
              field:unsigned char next_state; offset:25;      size:1;
              field:unsigned int next_cpu;    offset:28;      size:4;
      
      print fmt: "%u:%u:%u  ==+ %u:%u:%u [%03u]"
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      770cb243
    • Steven Rostedt's avatar
      tracing: move print of event format to separate file · 33b0c229
      Steven Rostedt authored
      Impact: clean up
      
      Move the macro that creates the event format file to a separate header.
      This will allow the default ftrace events to use this same macro
      to create the formats to read those events.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      33b0c229
    • Steven Rostedt's avatar
      tracing: make all file_operations const · 5e2336a0
      Steven Rostedt authored
      Impact: cleanup
      
      All file_operations structures should be constant. No one is going to
      change them.
      Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5e2336a0
  2. 05 Mar, 2009 12 commits
    • Steven Rostedt's avatar
      tracing: add tracing_on/tracing_off to kernel.h · 2002c258
      Steven Rostedt authored
      Impact: cleanup
      
      The functions tracing_start/tracing_stop have been moved to kernel.h.
      These are not the functions a developer most likely wants to use
      when they want to insert a place to stop tracing and restart it from
      user space.
      
      tracing_start/tracing_stop was created to work with things like
      suspend to ram, where even calling smp_processor_id() can crash the
      system. The tracing_start/tracing_stop was used to stop the tracer from
      doing anything. These are still light weight functions, but add a bit
      more overhead to be able to stop the tracers. They also have no interface
      back to userland. That is, if the kernel calls tracing_stop, userland
      can not start tracing.
      
      What a developer most likely wants to use is tracing_on/tracing_off.
      These are very light weight functions (simply sets or clears a bit).
      These functions just stop recording into the ring buffer. The tracers
      don't even know that this happens except that they would receive NULL
      from the ring_buffer_lock_reserve function.
      
      Also, there's a way for the user land to enable or disable this bit.
      In debugfs/tracing/tracing_on, a user may echo "0" (same as tracing_off())
      or echo "1" (same as tracing_on()) into this file. This becomes handy when
      a kernel developer is debugging and wants tracing to turn off when it
      hits an anomaly. Then the developer can examine the trace, and restart
      tracing if they want to try again (echo 1 > tracing_on).
      
      This patch moves the prototypes for tracing_on/tracing_off to kernel.h
      and comments their use, so that a kernel developer will know how
      to use them.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      2002c258
    • Ingo Molnar's avatar
      tracing: move utility functions from ftrace.h to kernel.h · 526211bc
      Ingo Molnar authored
      Make common utility functions such as trace_printk() and
      tracing_start()/tracing_stop() generally available to kernel
      code.
      
      Cc: Steven Rostedt <srostedt@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      526211bc
    • Ingo Molnar's avatar
      tracing: rename ftrace_printk() => trace_printk() · 5e1607a0
      Ingo Molnar authored
      Impact: cleanup
      
      Use a more generic name - this also allows the prototype to move
      to kernel.h and be generally available to kernel developers who
      want to do some quick tracing.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5e1607a0
    • Ingo Molnar's avatar
      Merge branch 'tip/tracing/ftrace' of... · 53664738
      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/ftrace
      53664738
    • Ingo Molnar's avatar
      c4ef144a
    • Steven Rostedt's avatar
      tracing: have latency tracers set the latency format · e9d25fe6
      Steven Rostedt authored
      The latency tracers (irqsoff, preemptoff, preemptirqsoff, and wakeup)
      are pretty useless with the default output format. This patch makes them
      automatically enable the latency format when they are selected. They
      also record the state of the latency option, and if it was not enabled
      when selected, they disable it on reset.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e9d25fe6
    • Steven Rostedt's avatar
      tracing: consolidate print_lat_fmt and print_trace_fmt · 27d48be8
      Steven Rostedt authored
      Impact: clean up
      
      Both print_lat_fmt and print_trace_fmt do pretty much the same thing
      except for one different function call. This patch consolidates the
      two functions and adds an if statement to perform the difference.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      27d48be8
    • Steven Rostedt's avatar
      tracing: remove extra latency_trace method from trace structure · 5fd73f86
      Steven Rostedt authored
      Impact: clean up
      
      The trace and latency_trace function pointers are identical for
      every tracer but the function tracer. The differences in the function
      tracer are trivial (latency output puts paranthesis around parent).
      
      This patch removes the latency_trace pointer and all prints will
      now just use the trace output function pointer.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      5fd73f86
    • Steven Rostedt's avatar
      tracing: add latency output format option · c032ef64
      Steven Rostedt authored
      With the removal of the latency_trace file, we lost the ability
      to see some of the finer details in a trace. Like the state of
      interrupts enabled, the preempt count, need resched, and if we
      are in an interrupt handler, softirq handler or not.
      
      This patch simply creates an option to bring back the old format.
      This also removes the warning about an unused variable that held
      the latency_trace file operations.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      c032ef64
    • Steven Rostedt's avatar
      tracing: fix seq read from trace files · e74da523
      Steven Rostedt authored
      The buffer used by trace_seq was updated incorrectly. Instead
      of consuming what was actually read, it consumed the rest of the
      buffer on reads.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      e74da523
    • Steven Rostedt's avatar
      tracing: do not return EFAULT if read copied anything · 2dc5d12b
      Steven Rostedt authored
      Impact: fix trace read to conform to standards
      
      Andrew Morton, Theodore Tso and H. Peter Anvin brought to my attention
      that a userspace read should not return -EFAULT if it succeeded in
      copying anything. It should only return -EFAULT if it failed to copy
      at all.
      
      This patch modifies the check of copy_from_user and updates the return
      code appropriately.
      
      I also used H. Peter Anvin's short cut rule to just test ret == count.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      2dc5d12b
    • Steven Rostedt's avatar
      ring-buffer: fix timestamp in partial ring_buffer_page_read · 4f3640f8
      Steven Rostedt authored
      If a partial ring_buffer_page_read happens, then some of the
      incremental timestamps may be lost. This patch writes the
      recent timestamp into the page that is passed back to the caller.
      
      A partial ring_buffer_page_read is where the full page would not
      be written back to the user, and instead, just part of the page
      is copied to the user. A full page would be a page swap with the
      ring buffer and the timestamps would be correct.
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      4f3640f8
  3. 04 Mar, 2009 16 commits
  4. 03 Mar, 2009 9 commits