Skip to content
  1. Aug 08, 2009
  2. Aug 07, 2009
  3. Aug 06, 2009
    • Robert Richter's avatar
      ring-buffer: Fix advance of reader in rb_buffer_peek() · 469535a5
      Robert Richter authored
      
      
      When calling rb_buffer_peek() from ring_buffer_consume() and a
      padding event is returned, the function rb_advance_reader() is
      called twice. This may lead to missing samples or under high
      workloads to the warning below. This patch fixes this. If a padding
      event is returned by rb_buffer_peek() it will be consumed by the
      calling function now.
      
      Also, I simplified some code in ring_buffer_consume().
      
      ------------[ cut here ]------------
      WARNING: at /dev/shm/.source/linux/kernel/trace/ring_buffer.c:2289 rb_advance_reader+0x2e/0xc5()
      Hardware name: Anaheim
      Modules linked in:
      Pid: 29, comm: events/2 Tainted: G        W  2.6.31-rc3-oprofile-x86_64-standard-00059-g5050dc2 #1
      Call Trace:
      [<ffffffff8106776f>] ? rb_advance_reader+0x2e/0xc5
      [<ffffffff81039ffe>] warn_slowpath_common+0x77/0x8f
      [<ffffffff8103a025>] warn_slowpath_null+0xf/0x11
      [<ffffffff8106776f>] rb_advance_reader+0x2e/0xc5
      [<ffffffff81068bda>] ring_buffer_consume+0xa0/0xd2
      [<ffffffff81326933>] op_cpu_buffer_read_entry+0x21/0x9e
      [<ffffffff810be3af>] ? __find_get_block+0x4b/0x165
      [<ffffffff8132749b>] sync_buffer+0xa5/0x401
      [<ffffffff810be3af>] ? __find_get_block+0x4b/0x165
      [<ffffffff81326c1b>] ? wq_sync_buffer+0x0/0x78
      [<ffffffff81326c76>] wq_sync_buffer+0x5b/0x78
      [<ffffffff8104aa30>] worker_thread+0x113/0x1ac
      [<ffffffff8104dd95>] ? autoremove_wake_function+0x0/0x38
      [<ffffffff8104a91d>] ? worker_thread+0x0/0x1ac
      [<ffffffff8104dc9a>] kthread+0x88/0x92
      [<ffffffff8100bdba>] child_rip+0xa/0x20
      [<ffffffff8104dc12>] ? kthread+0x0/0x92
      [<ffffffff8100bdb0>] ? child_rip+0x0/0x20
      ---[ end trace f561c0a58fcc89bd ]---
      
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarRobert Richter <robert.richter@amd.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      469535a5
    • Steven Rostedt's avatar
      tracing: do not use functions starting with .L in recordmcount.pl · 3f6e968e
      Steven Rostedt authored
      
      
      On Wed, 5 Aug 2009, Ingo Molnar wrote:
      > * Dave Airlie <airlied@gmail.com> wrote:
      >
      > > Hey,
      > >
      > > So I spent 3-4 hrs today (I'm stupid yes) tracking down a .o
      > > breakage by blaming rawhide gcc/binutils as I was using make
      > > V=1and seeing only the compiler chain running,
      >
      > Hm, is this that powerpc related build bug you just reported?
      
      Well we tracked it down and it is powerpc64 specific.
      
      Seems that in drivers/hwmon/lm93.c there's a function called:
      
         LM93_IN_FROM_REG()
      
      But PPC64 has function descriptors and the real function names (the ones
      you see in objdump) start with a '.'. Thus this in objdump you have:
      
       Disassembly of section .text:
      
       0000000000000000 <.LM93_IN_FROM_REG>:
             0:       7c 08 02 a6     mflr    r0
             4:       fb 81 ff e0     std     r28,-32(r1)
      
      The function name used is .LM93_IN_FROM_REG. But gcc considers symbols
      that start with ".L" as a special symbol that is used inside the assembly
      stage.
      
      The nm passed into recordmcount uses the --synthetic option which shows
      the ".L" symbols (my runs outside of the build did not include the
      --synthetic option, so my older patch worked). We see the function as a
      local.
      
      Now to capture all the locations that use "mcount" we need to have a
      reference to link into the object file a list of mcount callers. We need a
      reference that will not disappear. We try to use a global function and if
      that does not work, we use a local function as a reference. But to relink
      the section back into the object, we need to make it global. In this case,
      we run objcopy using --globalize-symbol and --localize-symbol to convert
      the symbol into a global symbol, link the mcount list, then convert it
      back to a local symbol.
      
      This works great except for this case. .L* symbols can not be converted
      into a global symbol, and the mcount section referencing it will remain
      unresolved.
      
      Reported-by: default avatarDave Airlie <airlied@gmail.com>
      LKML-Reference: <alpine.DEB.2.00.0908052011590.5010@gandalf.stny.rr.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      3f6e968e
    • Steven Rostedt's avatar
      ring-buffer: do not disable ring buffer on oops_in_progress · 464e85eb
      Steven Rostedt authored
      The commit:
      
        commit e0fdace1
      
      
        Author: David Miller <davem@davemloft.net>
        Date:   Fri Aug 1 01:11:22 2008 -0700
      
          debug_locks: set oops_in_progress if we will log messages.
      
          Otherwise lock debugging messages on runqueue locks can deadlock the
          system due to the wakeups performed by printk().
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      
      Will permanently set oops_in_progress on any lockdep failure.
      When this triggers it will cause any read from the ring buffer to
      permanently disable the ring buffer (not to mention no locking of
      printk).
      
      This patch removes the check. It keeps the print in NMI which makes
      sense. This is probably OK, since the ring buffer should not cause
      something to set oops_in_progress anyway.
      
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      464e85eb
    • Steven Rostedt's avatar
      ring-buffer: fix check of try_to_discard result · 0f2541d2
      Steven Rostedt authored
      
      
      The function ring_buffer_discard_commit inversed the code path
      of the result of try_to_discard. It should skip incrementing the
      entry counter if try_to_discard succeeded. But instead, it increments
      the entry conder if it succeeded to discard, and does not increment
      it if it fails.
      
      The result of this bug is that filtering will make the stat counters
      incorrect.
      
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      0f2541d2
  4. Aug 04, 2009
  5. Jul 29, 2009
    • Lai Jiangshan's avatar
      tracing: Fix missing function_graph events when we splice_read from trace_pipe · 74e7ff8c
      Lai Jiangshan authored
      
      
      About a half events are missing when we splice_read
      from trace_pipe. They are unexpectedly consumed because we ignore
      the TRACE_TYPE_NO_CONSUME return value used by the function graph
      tracer when it needs to consume the events by itself to walk on
      the ring buffer.
      
      The same problem appears with ftrace_dump()
      
      Example of an output before this patch:
      
      1)               |      ktime_get_real() {
      1)   2.846 us    |          read_hpet();
      1)   4.558 us    |        }
      1)   6.195 us    |      }
      
      After this patch:
      
      0)               |      ktime_get_real() {
      0)               |        getnstimeofday() {
      0)   1.960 us    |          read_hpet();
      0)   3.597 us    |        }
      0)   5.196 us    |      }
      
      The fix also applies on 2.6.30
      
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: stable@kernel.org
      LKML-Reference: <4A6EEC52.90704@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      74e7ff8c
    • Lai Jiangshan's avatar
      tracing: Fix invalid function_graph entry · 38ceb592
      Lai Jiangshan authored
      
      
      When print_graph_entry() computes a function call entry event, it needs
      to also check the next entry to guess if it matches the return event of
      the current function entry.
      In order to look at this next event, it needs to consume the current
      entry before going ahead in the ring buffer.
      
      However, if the current event that gets consumed is the last one in the
      ring buffer head page, the ring_buffer may reuse the page for writers.
      The consumed entry will then become invalid because of possible
      racy overwriting.
      
      Me must then handle this entry by making a copy of it.
      
      The fix also applies on 2.6.30
      
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: stable@kernel.org
      LKML-Reference: <4A6EEAEC.3050508@cn.fujitsu.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      38ceb592
  6. Jul 28, 2009
  7. Jul 27, 2009