1. 01 May, 2009 2 commits
  2. 29 Apr, 2009 11 commits
    • Heiko Carstens's avatar
      tracing: fix build failure on s390 · a0e39ed3
      Heiko Carstens authored
      "tracing: create automated trace defines" causes this compile error on s390,
      as reported by Sachin Sant against linux-next:
      
       kernel/built-in.o: In function `__do_softirq':
       (.text+0x1c680): undefined reference to `__tracepoint_softirq_entry'
      
      This happens because the definitions of the softirq tracepoints were moved
      from kernel/softirq.c to kernel/irq/handle.c. Since s390 doesn't support
      generic hardirqs handle.c doesn't get compiled and the definitions are
      missing.
      
      So move the tracepoints to softirq.c again.
      
      [ Impact: fix build failure on s390 ]
      Reported-by: default avatarSachin Sant <sachinp@in.ibm.com>
      Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: fweisbec@gmail.com
      LKML-Reference: <20090429135139.5fac79b8@osiris.boeblingen.de.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a0e39ed3
    • Tom Zanussi's avatar
      tracing/filters: a better event parser · 8b372562
      Tom Zanussi authored
      Replace the current event parser hack with a better one.  Filters are
      no longer specified predicate by predicate, but all at once and can
      use parens and any of the following operators:
      
      numeric fields:
      
      ==, !=, <, <=, >, >=
      
      string fields:
      
      ==, !=
      
      predicates can be combined with the logical operators:
      
      &&, ||
      
      examples:
      
      "common_preempt_count > 4" > filter
      
      "((sig >= 10 && sig < 15) || sig == 17) && comm != bash" > filter
      
      If there was an error, the erroneous string along with an error
      message can be seen by looking at the filter e.g.:
      
      ((sig >= 10 && sig < 15) || dsig == 17) && comm != bash
      ^
      parse_error: Field not found
      
      Currently the caret for an error always appears at the beginning of
      the filter; a real position should be used, but the error message
      should be useful even without it.
      
      To clear a filter, '0' can be written to the filter file.
      
      Filters can also be set or cleared for a complete subsystem by writing
      the same filter as would be written to an individual event to the
      filter file at the root of the subsytem.  Note however, that if any
      event in the subsystem lacks a field specified in the filter being
      set, the set will fail and all filters in the subsytem are
      automatically cleared.  This change from the previous version was made
      because using only the fields that happen to exist for a given event
      would most likely result in a meaningless filter.
      
      Because the logical operators are now implemented as predicates, the
      maximum number of predicates in a filter was increased from 8 to 16.
      
      [ Impact: add new, extended trace-filter implementation ]
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Cc: fweisbec@gmail.com
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <1240905899.6416.121.camel@tropicana>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8b372562
    • Tom Zanussi's avatar
      tracing/filters: distinguish between signed and unsigned fields · a118e4d1
      Tom Zanussi authored
      The new filter comparison ops need to be able to distinguish between
      signed and unsigned field types, so add an is_signed flag/param to the
      event field struct/trace_define_fields().  Also define a simple macro,
      is_signed_type() to determine the signedness at compile time, used in the
      trace macros.  If the is_signed_type() macro won't work with a specific
      type, a new slightly modified version of TRACE_FIELD() called
      TRACE_FIELD_SIGN(), allows the signedness to be set explicitly.
      
      [ Impact: extend trace-filter code for new feature ]
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Cc: fweisbec@gmail.com
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <1240905893.6416.120.camel@tropicana>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a118e4d1
    • Tom Zanussi's avatar
      tracing/filters: move preds into event_filter object · 30e673b2
      Tom Zanussi authored
      Create a new event_filter object, and move the pred-related members
      out of the call and subsystem objects and into the filter object - the
      details of the filter implementation don't need to be exposed in the
      call and subsystem in any case, and it will also help make the new
      parser implementation a little cleaner.
      
      [ Impact: refactor trace-filter code to prepare for new features ]
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Cc: fweisbec@gmail.com
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <1240905887.6416.119.camel@tropicana>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      30e673b2
    • Stuart Bennett's avatar
      tracing: x86, mmiotrace: only register for die notifier when tracer active · 0f9a623d
      Stuart Bennett authored
      Follow up to afcfe024 in Linus' tree
      ("x86: mmiotrace: quieten spurious warning message")
      Signed-off-by: default avatarStuart Bennett <stuart@freedesktop.org>
      Acked-by: default avatarPekka Paalanen <pq@iki.fi>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1240946271-7083-5-git-send-email-stuart@freedesktop.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0f9a623d
    • Stuart Bennett's avatar
      tracing: x86, mmiotrace: refactor clearing/restore of page presence · 46e91d00
      Stuart Bennett authored
      * change function names to clear_* from set_*: in reality we only clear
        and restore page presence, and never unconditionally set present.
        Using clear_*({true, false}, ...) is therefore more honest than
        set_*({false, true}, ...)
      
      * upgrade presence storage to pteval_t: doing user-space tracing will
        require saving and manipulation of the _PAGE_PROTNONE bit, in addition
        to the existing _PAGE_PRESENT changes, and having multiple bools stored
        and passed around does not seem optimal
      
      [ Impact: refactor, clean up mmiotrace code ]
      Signed-off-by: default avatarStuart Bennett <stuart@freedesktop.org>
      Acked-by: default avatarPekka Paalanen <pq@iki.fi>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1240946271-7083-4-git-send-email-stuart@freedesktop.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      46e91d00
    • Stuart Bennett's avatar
      tracing: x86, mmiotrace: code consistency/legibility improvement · 0492e1bb
      Stuart Bennett authored
      kmmio_probe being *p and kmmio_fault_page being sometimes *f and
      sometimes *p is not helpful.
      
      [ Impact: cleanup ]
      Signed-off-by: default avatarStuart Bennett <stuart@freedesktop.org>
      Acked-by: default avatarPekka Paalanen <pq@iki.fi>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1240946271-7083-3-git-send-email-stuart@freedesktop.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0492e1bb
    • Steven Rostedt's avatar
      ring-buffer: fix printk output · 7d7d2b80
      Steven Rostedt authored
      The warning output in trace_recursive_lock uses %d for a long when
      it should be %ld.
      
      [ Impact: fix compile warning ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      7d7d2b80
    • Steven Rostedt's avatar
      tracing: have splice only copy full pages · f2957f1f
      Steven Rostedt authored
      Splice works with pages, it is much more effecient to use an entire
      page than to copy bits over several pages.
      
      Using logdev to trace the internals of the splice mechanism, I was
      able to see that splice can be very aggressive. When tracing is
      occurring, and the reader caught up to the writer, and the writer
      is on the reader page, the reader will copy what is there into the
      splice page. Splice may iterate over several pages and if the
      writer is still writing to the page, the reader will keep copying
      bits to new pages to pass to userspace.
      
      This patch changes it to only pass data to userspace if the page
      is full (the writer has left the page). This has a small side effect
      that splice can not read a partial page, and must wait for the
      page to fill. This should not be an issue. If tracing has stopped,
      then a use of "read" will still read all of the page.
      
      [ Impact: better performance for ring buffer splice code ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      f2957f1f
    • Steven Rostedt's avatar
      tracing: only add splice page if entries exist · 93459c6c
      Steven Rostedt authored
      The splice code allocates a page even when the ring buffer is empty.
      It detects the ring buffer being empty when it it fails to copy
      anything from the ring buffer into the page.
      
      This patch adds a check to see if there is anything in the ring buffer
      before allocating a page.
      
      Thanks to logdev for letting me trace the tracer to find this.
      
      [ Impact: speed up due to removing unnecessary allocation ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      93459c6c
    • Steven Rostedt's avatar
      tracing: fix ref count in splice pages · 5beae6ef
      Steven Rostedt authored
      The pages allocated for the splice binary buffer did not initialize
      the ref count correctly. This caused pages not to be freed and causes
      a drastic memory leak.
      
      Thanks to logdev I was able to trace the tracer to find where the leak
      was.
      
      [ Impact: stop memory leak when using splice ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      5beae6ef
  3. 28 Apr, 2009 1 commit
    • Steven Rostedt's avatar
      tracing: convert ftrace_dump spinlocks to raw · cd891ae0
      Steven Rostedt authored
      ftrace_dump is used for printing out the contents of the ftrace ring buffer
      to the console on failure. Currently it uses a spinlock to synchronize
      the output from multiple failures on different CPUs. This spin lock
      currently is a normal spinlock and can cause issues with lockdep and
      lock tracing.
      
      This patch converts it to raw since it is for error handling only.
      The lock is local to the ftrace_dump and is not used by any other
      infrastructure.
      
      [ Impact: prevent ftrace_dump from locking up by internal tracing ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      cd891ae0
  4. 26 Apr, 2009 1 commit
    • Steven Rostedt's avatar
      tracing/events: make modules have their own file_operations structure · 701970b3
      Steven Rostedt authored
      For proper module reference counting, the file_operations that modules use
      must have the "owner" field set to the module. Unfortunately, the trace events
      use share file_operations. The same file_operations are used by all both
      kernel core and all modules.
      
      This patch makes the modules allocate their own file_operations and
      copies the functions from the core kernel. This allows those file
      operations to be owned by the module.
      
      Care is taken to free this code on module unload.
      
      Thanks to Greg KH for reminding me that file_operations must be owned
      by the module to have reference counting take place.
      
      [ Impact: fix modular tracepoints / potential crash ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Acked-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      701970b3
  5. 25 Apr, 2009 1 commit
    • Steven Rostedt's avatar
      tracing/events: reuse trace event ids after overflow · 060fa5c8
      Steven Rostedt authored
      With modules being able to add trace events, and the max trace event
      counter is 16 bits (65536) we can overflow the counter easily
      with a simple while loop adding and removing modules that contain
      trace events.
      
      This patch links together the registered trace events and on overflow
      searches for available trace event ids. It will still fail if
      over 65536 events are registered, but considering that a typical
      kernel only has 22000 functions, 65000 events should be sufficient.
      Reported-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      060fa5c8
  6. 24 Apr, 2009 9 commits
    • Steven Rostedt's avatar
      tracing: remove deprecated TRACE_FORMAT · b8e65554
      Steven Rostedt authored
      The TRACE_FORMAT macro has been deprecated by the TRACE_EVENT macro.
      There are no more users. All new users must use the TRACE_EVENT macro.
      
      [ Impact: remove old functionality ]
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      b8e65554
    • Steven Rostedt's avatar
      tracing/irq: convert irq traces to use TRACE_EVENT macro · 160031b5
      Steven Rostedt authored
      The TRACE_FORMAT will soon be deprecated. This patch converts it to
      the TRACE_EVENT macro.
      
      Note, this change should also speed up the tracing.
      
      [ Impact: remove a user of deprecated TRACE_FORMAT ]
      
      Cc: Jason Baron <jbaron@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      160031b5
    • Steven Rostedt's avatar
      tracing/lockdep: convert lockdep to use TRACE_EVENT macro · 39517091
      Steven Rostedt authored
      The TRACE_FORMAT will soon be deprecated. This patch converts it to
      the TRACE_EVENT macro.
      
      Note, this change should also speed up the tracing.
      
      [ Impact: remove a user of deprecated TRACE_FORMAT ]
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      39517091
    • Lai Jiangshan's avatar
      ring_buffer: compressed event header · 334d4169
      Lai Jiangshan authored
      RB_MAX_SMALL_DATA = 28bytes is too small for most tracers, it wastes
      an 'u32' to save the actually length for events which data size > 28.
      
      This fix uses compressed event header and enlarges RB_MAX_SMALL_DATA.
      
      [ Impact: saves about 0%-12.5%(depends on tracer) memory in ring_buffer ]
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      LKML-Reference: <49F13189.3090000@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      334d4169
    • Steven Rostedt's avatar
      tracing: fix cut and paste macro error · c2518c43
      Steven Rostedt authored
      In case a module uses the TRACE_EVENT macro for creating automated
      events in ftrace, it may choose to use a different file name
      than the defined system name, or choose to use a different path than
      the default "include/trace/events" include path.
      
      If this is done, then before including trace/define_trace.h the
      header would define either "TRACE_INCLUDE_FILE" for the file
      name or "TRACE_INCLUDE_PATH" for the include path.
      
      If it does not define these, then the define_trace.h defines them
      instead. If define trace defines them, then define_trace.h should
      also undefine them before exiting. To do this a macro is used
      to note this:
      
       #ifndef TRACE_INCLUDE_FILE
       # define TRACE_INCLUDE_FILE TRACE_SYSTEM
       # define UNDEF_TRACE_INCLUDE_FILE
       #endif
      
      [...]
      
       #ifdef UNDEF_TRACE_INCLUDE_FILE
       # undef TRACE_INCLUDE_FILE
       # undef UNDEF_TRACE_INCLUDE_FILE
       #endif
      
      The UNDEF_TRACE_INCLUDE_FILE acts as a CPP variable to know to undef
      the TRACE_INCLUDE_FILE before leaving define_trace.h.
      
      Unfortunately, due to cut and paste errors, the macros between
      FILE and PATH got mixed up.
      
      [ Impact: undef TRACE_INCLUDE_FILE and/or TRACE_INCLUDE_PATH when needed ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      c2518c43
    • Chris Wright's avatar
      x86: use native register access for native tlb flushing · d7285c6b
      Chris Wright authored
      currently these are paravirtulaized, doesn't appear any callers rely on
      this (no pv_ops backends are using native_tlb and overriding cr3/4
      access).
      
      [ Impact: fix lockdep warning with paravirt and function tracer ]
      Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
      LKML-Reference: <20090423172138.GR3036@sequoia.sous-sol.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      d7285c6b
    • Steven Rostedt's avatar
      tracing: add size checks for exported ftrace internal structures · 75db37d2
      Steven Rostedt authored
      The events exported by TRACE_EVENT are automated and are guaranteed
      to be correct when used.
      
      The internal ftrace structures on the other hand are more manually
      exported. These require the ftrace maintainer to make sure they
      are up to date.
      
      This patch adds a size check to help flag when a type changes in
      an internal ftrace data structure, and the update needs to be reflected
      in the export.
      
      If a export is incorrect, then the only harm is that the user space
      tools will not know how to correctly read the internal structures of
      ftrace.
      
      [ Impact: help prevent inconsistent ftrace format print outs ]
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      75db37d2
    • Steven Rostedt's avatar
      tracing: increase size of number of possible events · 89ec0dee
      Steven Rostedt authored
      With the new event tracing registration, we must increase the number
      of events that can be registered. Currently the type field is only
      one byte, which leaves us only 256 possible events.
      
      Since we do not save the CPU number in the tracer anymore (it is determined
      by the per cpu ring buffer that is used) we have an extra byte to use.
      
      This patch increases the size of type from 1 byte (256 events) to
      2 bytes (65,536 events).
      
      It also adds a WARN_ON_ONCE if we exceed that limit.
      
      [ Impact: allow more than 255 events ]
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      89ec0dee
    • Steven Rostedt's avatar
      tracing/wakeup: move access to wakeup_cpu into spinlock · 9be24414
      Steven Rostedt authored
      The code had the following outside the lock:
      
              if (next != wakeup_task)
                      return;
      
              pc = preempt_count();
      
              /* The task we are waiting for is waking up */
              data = wakeup_trace->data[wakeup_cpu];
      
      On initialization, wakeup_task is NULL and wakeup_cpu -1. This code
      is not under a lock. If wakeup_task is set on another CPU as that
      task is waking up, we can see the wakeup_task before wakeup_cpu is
      set. If we read wakeup_cpu while it is still -1 then we will have
      a bad data pointer.
      
      This patch moves the reading of wakeup_cpu within the protection of
      the spinlock used to protect the writing of wakeup_cpu and wakeup_task.
      
      [ Impact: remove possible race causing invalid pointer dereference ]
      Reported-by: default avatarManeesh Soni <maneesh@in.ibm.com>
      Signed-off-by: default avatarSteven Rostedt <srostedt@redhat.com>
      9be24414
  7. 22 Apr, 2009 4 commits
    • Frederic Weisbecker's avatar
      tracing/events: protect __get_str() · 6a74aa40
      Frederic Weisbecker authored
      The __get_str() macro is used in a code part then its content should be
      protected with parenthesis.
      
      [ Impact: make macro definition more robust ]
      Reported-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      6a74aa40
    • Frederic Weisbecker's avatar
      tracing/lock: provide lock_acquired event support for dynamic size string · 7e7ca9a2
      Frederic Weisbecker authored
      Now that we can support the dynamic sized string, make the lock tracing
      able to use it, making it safe against modules removal and consuming
      the right amount of memory needed for each lock name
      
      Changes in v2:
      adapt to the __ending_string() updates and the opening_string() removal.
      
      [ Impact: protect lock tracer against module removal ]
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      7e7ca9a2
    • Frederic Weisbecker's avatar
      tracing/events: provide string with undefined size support · 9cbf1176
      Frederic Weisbecker authored
      This patch provides the support for dynamic size strings on
      event tracing.
      
      The key concept is to use a structure with an ending char array field of
      undefined size and use such ability to allocate the minimal size on the
      ring buffer to make one or more string entries fit inside, as opposite
      to a fixed length strings with upper bound.
      
      The strings themselves are represented using fields which have an offset
      value from the beginning of the entry.
      
      This patch provides three new macros:
      
      __string(item, src)
      
      This one declares a string to the structure inside TP_STRUCT__entry.
      You need to provide the name of the string field and the source that will
      be copied inside.
      This will also add the dynamic size of the string needed for the ring
      buffer entry allocation.
      A stack allocated structure is used to temporarily store the offset
      of each strings, avoiding double calls to strlen() on each event
      insertion.
      
      __get_str(field)
      
      This one will give you a pointer to the string you have created. This
      is an abstract helper to resolve the absolute address given the field
      name which is a relative address from the beginning of the trace_structure.
      
      __assign_str(dst, src)
      
      Use this macro to automatically perform the string copy from src to
      dst. src must be a variable to assign and dst is the name of a __string
      field.
      
      Example on how to use it:
      
      TRACE_EVENT(my_event,
      	TP_PROTO(char *src1, char *src2),
      
      	TP_ARGS(src1, src2),
      	TP_STRUCT__entry(
      		__string(str1, src1)
      		__string(str2, src2)
      	),
      	TP_fast_assign(
      		__assign_str(str1, src1);
      		__assign_str(str2, src2);
      	),
      	TP_printk("%s %s", __get_str(src1), __get_str(src2))
      )
      
      Of course you can mix-up any __field or __array inside this
      TRACE_EVENT. The position of the __string or __assign_str
      doesn't matter.
      
      Changes in v2:
      
      Address the suggestion of Steven Rostedt: drop the opening_string() macro
      and redefine __ending_string() to get the size of the string to be copied
      instead of overwritting the whole ring buffer allocation.
      
      Changes in v3:
      
      Address other suggestions of Steven Rostedt and Peter Zijlstra with
      some changes: drop the __ending_string and the need to have only one
      string field.
      Use offsets instead of absolute addresses.
      
      [ Impact: allow more compact memory usage for string tracing ]
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      9cbf1176
    • Li Zefan's avatar
      tracing/events: make struct trace_entry->type to be int type · 7a4f453b
      Li Zefan authored
      struct trace_entry->type is unsigned char, while trace event's id is
      int type, thus for a event with id >= 256, it's entry->type is cast
      to (id % 256), and then we can't see the trace output of this event.
      
       # insmod trace-events-sample.ko
       # echo foo_bar > /mnt/tracing/set_event
       # cat /debug/tracing/events/trace-events-sample/foo_bar/id
       256
       # cat /mnt/tracing/trace_pipe
                 <...>-3548  [001]   215.091142: Unknown type 0
                 <...>-3548  [001]   216.089207: Unknown type 0
                 <...>-3548  [001]   217.087271: Unknown type 0
                 <...>-3548  [001]   218.085332: Unknown type 0
      
      [ Impact: fix output for trace events with id >= 256 ]
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <49EEDB0E.5070207@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7a4f453b
  8. 21 Apr, 2009 3 commits
    • Steven Rostedt's avatar
      ring-buffer: only warn on wrap if buffer is bigger than two pages · 3554228d
      Steven Rostedt authored
      On boot up, to save memory, ftrace allocates the minimum buffer
      which is two pages. Ftrace also goes through a series of tests
      (when configured) on boot up. These tests can fill up a page within
      a single interrupt.
      
      The ring buffer also has a WARN_ON when it detects that the buffer was
      completely filled within a single commit (other commits are allowed to
      be nested).
      
      Combine the small buffer on start up, with the tests that can fill more
      than a single page within an interrupt, this can trigger the WARN_ON.
      
      This patch makes the WARN_ON only happen when the ring buffer consists
      of more than two pages.
      
      [ Impact: prevent false WARN_ON in ftrace startup tests ]
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      LKML-Reference: <20090421094616.GA14561@elte.hu>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3554228d
    • Li Zefan's avatar
      tracing/filters: allow user-input to be integer-like string · f66578a7
      Li Zefan authored
      Suppose we would like to trace all tasks named '123', but this
      will fail:
      
       # echo 'parent_comm == 123' > events/sched/sched_process_fork/filter
       bash: echo: write error: Invalid argument
      
      Don't guess the type of the filter pred in filter_parse(), but instead
      we check it in __filter_add_pred().
      
      [ Impact: extend allowed filter field string values ]
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <49ED8DEB.6000700@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f66578a7
    • Li Zefan's avatar
      tracing/filters: don't remove old filters when failed to write subsys->filter · e8082f3f
      Li Zefan authored
      If writing subsys->filter returns EINVAL or ENOSPC, the original
      filters in subsys/ and subsys/events/ will be removed. This is
      definitely wrong.
      
      [ Impact: fix filter setting semantics on error condition ]
      Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <49ED8DD2.2070700@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e8082f3f
  9. 20 Apr, 2009 8 commits
    • Steven Rostedt's avatar
      tracing: use nowakeup version of commit for function event trace tests · cb4764a6
      Steven Rostedt authored
      The startup tests for the event tracer also runs with the function
      tracer enabled. The "wakeup" version of the trace commit was used
      which can grab spinlocks. If a task was preempted by an NMI
      that called a function being traced, it could deadlock due to the
      function tracer trying to grab the same lock.
      
      Thanks to Frederic Weisbecker for pointing out where the bug was.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Reported-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      cb4764a6
    • Steven Rostedt's avatar
      tracing: use recursive counter over irq level · aa18efb2
      Steven Rostedt authored
      Althought using the irq level (hardirq_count, softirq_count and in_nmi)
      was nice to detect bad recursion right away, but since the counters are
      not atomically updated with respect to the interrupts, the function tracer
      might trigger the test from an interrupt handler before the hardirq_count
      is updated. This will trigger a false warning.
      
      This patch converts the recursive detection to a simple counter.
      If the depth is greater than 16 then the recursive detection will trigger.
      16 is more than enough for any nested interrupts.
      
      [ Impact: fix false positive trace recursion detection ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      aa18efb2
    • Steven Rostedt's avatar
      tracing: remove recursive test from ring_buffer_event_discard · e395898e
      Steven Rostedt authored
      The ring_buffer_event_discard is not tied to ring_buffer_lock_reserve.
      It can be called inside or outside the reserve/commit. Even if it
      is called inside the reserve/commit the commit part must also be called.
      
      Only ring_buffer_discard_commit can be used as a replacement for
      ring_buffer_unlock_commit.
      
      This patch removes the trace_recursive_unlock from ring_buffer_event_discard
      since it would be the wrong place to do so.
      
      [Impact: prevent breakage in trace recursive testing ]
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      e395898e
    • Steven Rostedt's avatar
      tracing: fix recursive test level calculation · 17487bfe
      Steven Rostedt authored
      The recursive tests to detect same level recursion in the ring buffers
      did not account for the hard/softirq_counts to be shifted. Thus the
      numbers could be larger than then mask to be tested.
      
      This patch includes the shift for the calculation of the irq depth.
      
      [ Impact: stop false positives in trace recursion detection ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      17487bfe
    • Steven Rostedt's avatar
      tracing: remove dangling semicolon · 23de29de
      Steven Rostedt authored
      Due to a cut and paste error, the trace_seq_putc had a semicolon
      after the prototype but before the stub function when tracing is
      disabled.
      
      [Impact: fix compile error ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      23de29de
    • Steven Rostedt's avatar
      tracing/events: call the correct event trace selftest init function · 28d20e2d
      Steven Rostedt authored
      The late_initcall calls a helper function instead of the proper
      init event selftest function.
      
      This update may have been lost due to conflicting merges.
      
      [ Impact: fix compiler warning and call extended event trace self tests ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      28d20e2d
    • Steven Rostedt's avatar
      tracing: rename EVENT_TRACER config to ENABLE_EVENT_TRACING · a7abe97f
      Steven Rostedt authored
      Currently we have two configs: EVENT_TRACING and EVENT_TRACER.
      All tracers enable EVENT_TRACING. The EVENT_TRACER is only a
      convenience to enable the EVENT_TRACING when no other tracers
      are enabled.
      
      The names EVENT_TRACER and EVENT_TRACING are too similar and confusing.
      This patch renames EVENT_TRACER to ENABLE_EVENT_TRACING to be more
      appropriate to what it actually does, as well as add a comment in
      the help menu to explain the option's purpose.
      
      [ Impact: rename config option to reduce confusion ]
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      a7abe97f
    • Steven Rostedt's avatar
      tracing: create menuconfig for tracing infrastructure · 4ed9f071
      Steven Rostedt authored
      During testing we often use randconfig to test various kernels.
      The current configuration set up does not give an easy way to disable
      all tracing with a single config. The case where randconfig would
      test all tracing disabled is very unlikely.
      
      This patch adds a config option to enable or disable all tracing.
      It is hooked into the tracing menu just like other submenus are done.
      
      [ Impact: allow randconfig to easily produce all traces disabled ]
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      4ed9f071