1. 05 9月, 2009 10 次提交
    • S
      ring-buffer: only enable ring_buffer_swap_cpu when needed · 85bac32c
      Steven Rostedt 提交于
      Since the ability to swap the cpu buffers adds a small overhead to
      the recording of a trace, we only want to add it when needed.
      
      Only the irqsoff and preemptoff tracers use this feature, and both are
      not recommended for production kernels. This patch disables its use
      when neither irqsoff nor preemptoff is configured.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      85bac32c
    • S
      ring-buffer: check for swapped buffers in start of committing · 62f0b3eb
      Steven Rostedt 提交于
      Because the irqsoff tracer can swap an internal CPU buffer, it is possible
      that a swap happens between the start of the write and before the committing
      bit is set (the committing bit will disable swapping).
      
      This patch adds a check for this and will fail the write if it detects it.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      62f0b3eb
    • S
      tracing: report error in trace if we fail to swap latency buffer · e8165dbb
      Steven Rostedt 提交于
      The irqsoff tracer will fail to swap the cpu buffer with the max
      buffer if it preempts a commit. Instead of ignoring this, this patch
      makes the tracer report it if the last max latency failed due to preempting
      a current commit.
      
      The output of the latency tracer will look like this:
      
       # tracer: irqsoff
       #
       # irqsoff latency trace v1.1.5 on 2.6.31-rc5
       # --------------------------------------------------------------------
       # latency: 112 us, #1/1, CPU#1 | (M:preempt VP:0, KP:0, SP:0 HP:0 #P:4)
       #    -----------------
       #    | task: -4281 (uid:0 nice:0 policy:0 rt_prio:0)
       #    -----------------
       #  => started at: save_args
       #  => ended at:   __do_softirq
       #
       #
       #                  _------=> CPU#
       #                 / _-----=> irqs-off
       #                | / _----=> need-resched
       #                || / _---=> hardirq/softirq
       #                ||| / _--=> preempt-depth
       #                |||| /
       #                |||||     delay
       #  cmd     pid   ||||| time  |   caller
       #     \   /      |||||   \   |   /
          bash-4281    1d.s6  265us : update_max_tr_single: Failed to swap buffers due to commit in progress
      
      Note the latency time and the functions that disabled the irqs or preemption
      will still be listed.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      e8165dbb
    • S
      tracing: add trace_array_printk for internal tracers to use · 659372d3
      Steven Rostedt 提交于
      This patch adds a trace_array_printk to allow a tracer to use the
      trace_printk on its own trace array.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      659372d3
    • S
      tracing: pass around ring buffer instead of tracer · e77405ad
      Steven Rostedt 提交于
      The latency tracers (irqsoff and wakeup) can swap trace buffers
      on the fly. If an event is happening and has reserved data on one of
      the buffers, and the latency tracer swaps the global buffer with the
      max buffer, the result is that the event may commit the data to the
      wrong buffer.
      
      This patch changes the API to the trace recording to be recieve the
      buffer that was used to reserve a commit. Then this buffer can be passed
      in to the commit.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      e77405ad
    • S
      tracing: make tracing_reset safe for external use · f633903a
      Steven Rostedt 提交于
      Reseting the trace buffer without first disabling the buffer and
      waiting for any writers to complete, can corrupt the ring buffer.
      
      This patch makes the external version of tracing_reset safe from
      corruption by disabling the ring buffer and calling synchronize_sched.
      
      This version can no longer be called from interrupt context. But all those
      callers have been removed.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      f633903a
    • S
      tracing: use timestamp to determine start of latency traces · 2f26ebd5
      Steven Rostedt 提交于
      Currently the latency tracers reset the ring buffer. Unfortunately
      if a commit is in process (due to a trace event), this can corrupt
      the ring buffer. When this happens, the ring buffer will detect
      the corruption and then permanently disable the ring buffer.
      
      The bug does not crash the system, but it does prevent further tracing
      after the bug is hit.
      
      Instead of reseting the trace buffers, the timestamp of the start of
      the trace is used instead. The buffers will still contain the previous
      data, but the output will not count any data that is before the
      timestamp of the trace.
      
      Note, this only affects the static trace output (trace) and not the
      runtime trace output (trace_pipe). The runtime trace output does not
      make sense for the latency tracers anyway.
      Reported-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      2f26ebd5
    • L
      tracing/filters: Defer pred allocation, fix memory leak · c58b4321
      Li Zefan 提交于
      The predicates of an event and their filter structure are allocated
      when we create an event filter for the first time.
      
      These objects must be created once but each time we come with a new
      filter, we overwrite such pre-existing allocation, if any.
      
      Thus, this patch checks if the filter has already been allocated
      before going ahead.
      Spotted-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <4A9CB1BA.3060402@cn.fujitsu.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      c58b4321
    • S
      tracing: remove users of tracing_reset · 76f0d073
      Steven Rostedt 提交于
      The function tracing_reset is deprecated for outside use of trace.c.
      
      The new function to reset the the buffers is tracing_reset_online_cpus.
      
      The reason for this is that resetting the buffers while the event
      trace points are active can corrupt the buffers, because they may
      be writing at the time of reset. The tracing_reset_online_cpus disables
      writes and waits for current writers to finish.
      
      This patch replaces all users of tracing_reset except for the latency
      tracers. Those changes require more work and will be removed in the
      following patches.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      76f0d073
    • S
      tracing: disable buffers and synchronize_sched before resetting · 621968cd
      Steven Rostedt 提交于
      Resetting the ring buffers while traces are happening can corrupt
      the ring buffer and disable it (no kernel crash to worry about).
      
      The safest thing to do is disable the ring buffers, call synchronize_sched()
      to wait for all current writers to finish and then reset the buffer.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      621968cd
  2. 04 9月, 2009 9 次提交
    • S
      tracing: disable update max tracer while reading trace · b8de7bd1
      Steven Rostedt 提交于
      When reading the tracer from the trace file, updating the max latency
      may corrupt the output. This patch disables the tracing of the max
      latency while reading the trace file.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      b8de7bd1
    • S
      tracing: print out start and stop in latency traces · 8248ac05
      Steven Rostedt 提交于
      During development of the tracer, we would copy information from
      the live tracer to the max tracer with one memcpy. Since then we
      added a generic ring buffer and we handle the copies differently now.
      Unfortunately, we never copied the critical section information, and
      we lost the output:
      
       #  => started at: kmem_cache_alloc
       #  => ended at:   kmem_cache_alloc
      
      This patch adds back the critical start and end copying as well as
      removes the unused "trace_idx" and "overrun" fields of the
      trace_array_cpu structure.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8248ac05
    • S
      ring-buffer: disable all cpu buffers when one finds a problem · 077c5407
      Steven Rostedt 提交于
      Currently the way RB_WARN_ON works, is to disable either the current
      CPU buffer or all CPU buffers, depending on whether a ring_buffer or
      ring_buffer_per_cpu struct was passed into the macro.
      
      Most users of the RB_WARN_ON pass in the CPU buffer, so only the one
      CPU buffer gets disabled but the rest are still active. This may
      confuse users even though a warning is sent to the console.
      
      This patch changes the macro to disable the entire buffer even if
      the CPU buffer is passed in.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      077c5407
    • S
      ring-buffer: do not count discarded events · a1863c21
      Steven Rostedt 提交于
      The latency tracers report the number of items in the trace buffer.
      This uses the ring buffer data to calculate this. Because discarded
      events are also counted, the numbers do not match the number of items
      that are printed. The ring buffer also adds a "padding" item to the
      end of each buffer page which also gets counted as a discarded item.
      
      This patch decrements the counter to the page entries on a discard.
      This allows us to ignore discarded entries while reading the buffer.
      
      Decrementing the counter is still safe since it can only happen while
      the committing flag is still set.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      a1863c21
    • S
      ring-buffer: remove ring_buffer_event_discard · dc892f73
      Steven Rostedt 提交于
      The function ring_buffer_event_discard can be used on any item in the
      ring buffer, even after the item was committed. This function provides
      no safety nets and is very race prone.
      
      An item may be safely removed from the ring buffer before it is committed
      with the ring_buffer_discard_commit.
      
      Since there are currently no users of this function, and because this
      function is racey and error prone, this patch removes it altogether.
      
      Note, removing this function also allows the counters to ignore
      all discarded events (patches will follow).
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      dc892f73
    • S
      ring-buffer: fix ring_buffer_read crossing pages · 7e9391cf
      Steven Rostedt 提交于
      When the ring buffer uses an iterator (static read mode, not on the
      fly reading), when it crosses a page boundery, it will skip the first
      entry on the next page. The reason is that the last entry of a page
      is usually padding if the page is not full. The padding will not be
      returned to the user.
      
      The problem arises on ring_buffer_read because it also increments the
      iterator. Because both the read and peek use the same rb_iter_peek,
      the rb_iter_peak will return the padding but also increment to the next
      item. This is because the ring_buffer_peek will not incerment it
      itself.
      
      The ring_buffer_read will increment it again and then call rb_iter_peek
      again to get the next item. But that will be the second item, not the
      first one on the page.
      
      The reason this never showed up before, is because the ftrace utility
      always calls ring_buffer_peek first and only uses ring_buffer_read
      to increment to the next item. The ring_buffer_peek will always keep
      the pointer to a valid item and not padding. This just hid the bug.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      7e9391cf
    • S
      ring-buffer: remove unnecessary cpu_relax · 1b959e18
      Steven Rostedt 提交于
      The loops in the ring buffer that use cpu_relax are not dependent on
      other CPUs. They simply came across some padding in the ring buffer and
      are skipping over them. It is a normal loop and does not require a
      cpu_relax.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      1b959e18
    • S
      ring-buffer: do not swap buffers during a commit · 98277991
      Steven Rostedt 提交于
      If a commit is taking place on a CPU ring buffer, do not allow it to
      be swapped. Return -EBUSY when this is detected instead.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      98277991
    • S
      ring-buffer: do not reset while in a commit · 41b6a95d
      Steven Rostedt 提交于
      The callers of reset must ensure that no commit can be taking place
      at the time of the reset. If it does then we may corrupt the ring buffer.
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      41b6a95d
  3. 31 8月, 2009 1 次提交
    • L
      tracing/filters: Defer pred allocation · 8e254c1d
      Li Zefan 提交于
      init_preds() allocates about 5392 bytes of memory (on x86_32) for
      a TRACE_EVENT. With my config, at system boot total memory occupied
      is:
      
      	5392 * (642 + 15) == 3459KB
      
      642 == cat available_events | wc -l
      15 == number of dirs in events/ftrace
      
      That's quite a lot, so we'd better defer memory allocation util
      it's needed, that's when filter is used.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <4A9B8EA5.6020700@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8e254c1d
  4. 28 8月, 2009 2 次提交
  5. 27 8月, 2009 2 次提交
    • J
      tracing: Convert event tracing code to use NR_syscalls · 57421dbb
      Jason Baron 提交于
      Convert the syscalls event tracing code to use NR_syscalls, instead of
      FTRACE_SYSCALL_MAX. NR_syscalls is standard accross most arches, and
      reduces code confusion/complexity.
      Signed-off-by: NJason Baron <jbaron@redhat.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Josh Stone <jistone@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: H. Peter Anwin <hpa@zytor.com>
      Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      LKML-Reference: <9b4f1a84ecae57cc6599412772efa36f0d2b815b.1251146513.git.jbaron@redhat.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      57421dbb
    • H
      tracing: Check invalid syscall nr while tracing syscalls · cd0980fc
      Hendrik Brueckner 提交于
      Most arch syscall_get_nr() implementations returns -1 if the syscall
      number is not valid.  Accessing the bit field without a check might
      result in a kernel oops (at least I saw it on s390 for ftrace selftest).
      
      Before this change, this problem did not occur, because the invalid
      syscall number (-1) caused syscall_nr_to_meta() to return NULL.
      
      There are at least two scenarios where syscall_get_nr() can return -1:
      
      1. For example, ptrace stores an invalid syscall number, and thus,
         tracing code resets it.
         (see do_syscall_trace_enter in arch/s390/kernel/ptrace.c)
      
      2. The syscall_regfunc() (kernel/tracepoint.c) sets the
         TIF_SYSCALL_FTRACE (now: TIF_SYSCALL_TRACEPOINT) flag for all threads
         which include kernel threads.
         However, the ftrace selftest triggers a kernel oops when testing
         syscall trace points:
            - The kernel thread is started as ususal (do_fork()),
            - tracing code sets TIF_SYSCALL_FTRACE,
            - the ret_from_fork() function is triggered and starts
      	ftrace_syscall_exit() with an invalid syscall number.
      
      To avoid these scenarios, I suggest to check the syscall_nr.
      
      For instance, the ftrace selftest fails for s390 (with config option
      CONFIG_FTRACE_SYSCALLS set) and produces the following kernel oops.
      
      Unable to handle kernel pointer dereference at virtual kernel address 2000000000
      
      Oops: 0038 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 0 Not tainted 2.6.31-rc6-next-20090819-dirty #18
      Process kthreadd (pid: 818, task: 000000003ea207e8, ksp: 000000003e813eb8)
      Krnl PSW : 0704100180000000 00000000000ea54c (ftrace_syscall_exit+0x58/0xdc)
                 R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:0 CC:1 PM:0 EA:3
      Krnl GPRS: 0000000000000000 00000000000e0000 ffffffffffffffff 20000000008c2650
                 0000000000000007 0000000000000000 0000000000000000 0000000000000000
                 0000000000000000 0000000000000000 ffffffffffffffff 000000003e813d78
                 000000003e813f58 0000000000505ba8 000000003e813e18 000000003e813d78
      Krnl Code: 00000000000ea540: e330d0000008       ag      %r3,0(%r13)
                 00000000000ea546: a7480007           lhi     %r4,7
                 00000000000ea54a: 1442               nr      %r4,%r2
                >00000000000ea54c: e31030000090       llgc    %r1,0(%r3)
                 00000000000ea552: 5410d008           n       %r1,8(%r13)
                 00000000000ea556: 8a104000           sra     %r1,0(%r4)
                 00000000000ea55a: 5410d00c           n       %r1,12(%r13)
                 00000000000ea55e: 1211               ltr     %r1,%r1
      Call Trace:
      ([<0000000000000000>] 0x0)
       [<000000000001fa22>] do_syscall_trace_exit+0x132/0x18c
       [<000000000002d0c4>] sysc_return+0x0/0x8
       [<000000000001c738>] kernel_thread_starter+0x0/0xc
      Last Breaking-Event-Address:
       [<00000000000ea51e>] ftrace_syscall_exit+0x2a/0xdc
      Signed-off-by: NHendrik Brueckner <brueckner@linux.vnet.ibm.com>
      Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      LKML-Reference: <20090825125027.GE4639@cetus.boeblingen.de.ibm.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      cd0980fc
  6. 26 8月, 2009 6 次提交
    • Z
      ftrace: Move setting of clock-source out of options · 5079f326
      Zhaolei 提交于
      There are many clock sources for the tracing system but we can only
      enable/disable one at a time with the trace/options file.
      We can move the setting of clock-source out of options and add a separate
      file for it:
       # cat trace_clock
       [local] global
       # echo global > trace_clock
       # cat trace_clock
       local [global]
      Signed-off-by: NZhao Lei <zhaolei@cn.fujitsu.com>
      LKML-Reference: <4A939D08.6050604@cn.fujitsu.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      5079f326
    • L
      tracing/filters: Support filtering for char * strings · 87a342f5
      Li Zefan 提交于
      Usually, char * entries are dangerous in traces because the string
      can be released whereas a pointer to it can still wait to be read from
      the ring buffer.
      
      But sometimes we can assume it's safe, like in case of RO data
      (eg: __file__ or __line__, used in bkl trace event). If these RO data
      are in a module and so is the call to the trace event, then it's safe,
      because the ring buffer will be flushed once this module get unloaded.
      
      To allow char * to be treated as a string:
      
      	TRACE_EVENT(...,
      
      		TP_STRUCT__entry(
      			__field_ext(const char *, name, FILTER_PTR_STRING)
      			...
      		)
      
      		...
      	);
      
      The filtering will not dereference "char *" unless the developer
      explicitly sets FILTER_PTR_STR in __field_ext.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A7B9287.90205@cn.fujitsu.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      87a342f5
    • L
      tracing/filters: Add __field_ext() to TRACE_EVENT · 43b51ead
      Li Zefan 提交于
      Add __field_ext(), so a field can be assigned to a specific
      filter_type, which matches a corresponding filter function.
      
      For example, a later patch will allow this:
      	__field_ext(const char *, str, FILTER_PTR_STR);
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A7B9272.60507095@cn.fujitsu.com>
      
      [
        Fixed a -1 to FILTER_OTHER
        Forward ported to latest kernel.
      ]
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      43b51ead
    • L
      tracing/filters: Add filter_type to struct ftrace_event_field · aa38e9fc
      Li Zefan 提交于
      The type of a field is stored as a string in @type, and here
      we add @filter_type which is an enum value.
      
      This prepares for later patches, so we can specifically assign
      different @filter_type for the same @type.
      
      For example normally a "char *" field is treated as a ptr,
      but we may want it to be treated as a string when doing filting.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      LKML-Reference: <4A7B925E.9030605@cn.fujitsu.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      aa38e9fc
    • J
      tracing: Create generic syscall TRACE_EVENTs · 1c569f02
      Josh Stone 提交于
      This converts the syscall_enter/exit tracepoints into TRACE_EVENTs, so
      you can have generic ftrace events that capture all system calls with
      arguments and return values.  These generic events are also renamed to
      sys_enter/exit, so they're more closely aligned to the specific
      sys_enter_foo events.
      Signed-off-by: NJosh Stone <jistone@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      LKML-Reference: <1251150194-1713-5-git-send-email-jistone@redhat.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      1c569f02
    • J
      tracing: Rename FTRACE_SYSCALLS for tracepoints · 66700001
      Josh Stone 提交于
      s/HAVE_FTRACE_SYSCALLS/HAVE_SYSCALL_TRACEPOINTS/g
      s/TIF_SYSCALL_FTRACE/TIF_SYSCALL_TRACEPOINT/g
      
      The syscall enter/exit tracing is no longer specific to just ftrace, so
      they now have names that reflect their tie to tracepoints instead.
      Signed-off-by: NJosh Stone <jistone@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Martin Bligh <mbligh@google.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      LKML-Reference: <1251150194-1713-2-git-send-email-jistone@redhat.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      66700001
  7. 20 8月, 2009 1 次提交
    • L
      tracing/syscalls: Fix the output of syscalls with no arguments · 4539f077
      Li Zefan 提交于
      Before:
      
        # echo 1 > events/syscalls/sys_enter_sync/enable
        # cat events/syscalls/sys_enter_sync/format
        ...
              field:int nr;   offset:12;      size:4;
      
        print fmt: "# sync
        # cat trace
        ...
                  sync-8950  [000]  2366.087670: sys_sync(
      
      After:
      
        # echo 1 > events/syscalls/sys_enter_sync/enable
        # cat events/syscalls/sys_enter_sync/format
        ...
              field:int nr;   offset:12;      size:4;
      
        print fmt: ""
        # sync
        # cat trace
                  sync-2134  [001]   136.780735: sys_sync()
      Reported-by: NMasami Hiramatsu <mhiramat@redhat.com>
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <4A8D05AF.20103@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4539f077
  8. 19 8月, 2009 6 次提交
    • L
      tracing/syscalls: Add filtering support · 540b7b8d
      Li Zefan 提交于
      Add filtering support for syscall events:
      
       # echo 'mode == 0666' > events/syscalls/sys_enter_open
       # echo 'ret == 0' > events/syscalls/sys_exit_open
       # echo 1 > events/syscalls/sys_enter_open
       # echo 1 > events/syscalls/sys_exit_open
       # cat trace
       ...
         modprobe-3084 [001] 117.463140: sys_open(filename: 917d3e8, flags: 0, mode: 1b6)
         modprobe-3084 [001] 117.463176: sys_open -> 0x0
             less-3086 [001] 117.510455: sys_open(filename: 9c6bdb8, flags: 8000, mode: 1b6)
         sendmail-2574 [001] 122.145840: sys_open(filename: b807a365, flags: 0, mode: 1b6)
       ...
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAFCB.1040006@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      540b7b8d
    • L
      tracing/events: Add trace_define_common_fields() · e647d6b3
      Li Zefan 提交于
      Extract duplicate code. Also prepare for the later patch.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAFB8.1010304@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e647d6b3
    • L
      tracing/events: Add ftrace_event_call param to define_fields() · 14be96c9
      Li Zefan 提交于
      This parameter is needed by syscall events to add define_fields()
      handler.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAF90.6060801@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      14be96c9
    • L
      tracing/syscalls: Add fields format for exit events · 10a5b66f
      Li Zefan 提交于
      Add "format" file for syscall exit events:
      
       # cat events/syscalls/sys_exit_open/format
       name: sys_exit_open
       ID: 344
       format:
               field:unsigned short common_type;       offset:0;       size:2;
               field:unsigned char common_flags;       offset:2;       size:1;
               field:unsigned char common_preempt_count;       offset:3;       size:1;
               field:int common_pid;   offset:4;       size:4;
               field:int common_tgid;  offset:8;       size:4;
      
               field:int nr;   offset:12;      size:4;
               field:unsigned long ret;        offset:16;      size:4;
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAF61.3060307@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      10a5b66f
    • L
      tracing/syscalls: Fix fields format for enter events · e6971969
      Li Zefan 提交于
      The "format" file of a trace event is originally for parsers to
      parse ftrace binary output.
      
      But the "format" file of a syscall event can only be used by
      perfcounter, because it describes the format of struct
      syscall_enter_record not struct syscall_trace_enter.
      
      To fix this, we remove struct syscall_enter_record, and then
      struct syscall_trace_enter will be used by both perf profile
      and ftrace.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <4A8BAF39.1030404@cn.fujitsu.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e6971969
    • J
      tracing: handle broken names in ftrace filter · eda1e328
      Jiri Olsa 提交于
      If one filter item (for set_ftrace_filter and set_ftrace_notrace) is being
      setup by more than 1 consecutive writes (FTRACE_ITER_CONT flag), it won't
      be handled corretly.
      
      I used following program to test/verify:
      
      [snip]
      #include <stdio.h>
      #include <sys/types.h>
      #include <sys/stat.h>
      #include <fcntl.h>
      #include <string.h>
      
      int main(int argc, char **argv)
      {
              int fd, i;
              char *file = argv[1];
      
              if (-1 == (fd = open(file, O_WRONLY))) {
                      perror("open failed");
                      return -1;
              }
      
              for(i = 0; i < (argc - 2); i++) {
                      int len = strlen(argv[2+i]);
                      int cnt, off = 0;
      
                      while(len) {
                              cnt = write(fd, argv[2+i] + off, len);
                              len -= cnt;
                              off += cnt;
                      }
              }
      
              close(fd);
              return 0;
      }
      [snip]
      
      before change:
      sh-4.0# echo > ./set_ftrace_filter
      sh-4.0# /test ./set_ftrace_filter "sys" "_open "
      sh-4.0# cat ./set_ftrace_filter
      #### all functions enabled ####
      sh-4.0#
      
      after change:
      sh-4.0# echo > ./set_ftrace_notrace
      sh-4.0# test ./set_ftrace_notrace "sys" "_open "
      sh-4.0# cat ./set_ftrace_notrace
      sys_open
      sh-4.0#
      Signed-off-by: NJiri Olsa <jolsa@redhat.com>
      LKML-Reference: <20090811152904.GA26065@jolsa.lab.eng.brq.redhat.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      eda1e328
  9. 18 8月, 2009 1 次提交
  10. 17 8月, 2009 2 次提交