1. 28 Jun, 2012 4 commits
    • Steven Rostedt's avatar
      ring-buffer: Fix uninitialized read_stamp · a5fb8331
      Steven Rostedt authored
      The ring buffer reader page is used to swap a page from the writable
      ring buffer. If the writer happens to be on that page, it ends up on the
      reader page, but will simply move off of it, back into the writable ring
      buffer as writes are added.
      
      The time stamp passed back to the readers is stored in the cpu_buffer per
      CPU descriptor. This stamp is updated when a swap of the reader page takes
      place, and it reads the current stamp from the page taken from the writable
      ring buffer. Everytime a writer goes to a new page, it updates the time stamp
      of that page.
      
      The problem happens if a reader reads a page from an empty per CPU ring buffer.
      If the buffer is empty, the swap still takes place, placing the writer at the
      start of the reader page. If at a later time, a write happens, it updates the
      page's time stamp and continues. But the problem is that the read_stamp does
      not get updated, because the page was already swapped.
      
      The solution to this was to not swap the page if the ring buffer happens to
      be empty. This also removes the side effect that the writes on the reader
      page will not get updated because the writer never gets back on the reader
      page without a swap. That is, if a read happens on an empty buffer, but then
      no reads happen for a while. If a swap took place, and the writer were to start
      writing a lot of data (function tracer), it will start overflowing the ring buffer
      and overwrite the older data. But because the writer never goes back onto the
      reader page, the data left on the reader page never gets overwritten. This
      causes the reader to see really old data, followed by a jump to newer data.
      
      Link: http://lkml.kernel.org/r/1340060577-9112-1-git-send-email-dhsharp@google.com
      Google-Bug-Id: 6410455
      Reported-by: default avatarDavid Sharp <dhsharp@google.com>
      tested-by: default avatarDavid Sharp <dhsharp@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      a5fb8331
    • Steven Rostedt's avatar
      tracing: Remove NR_CPUS array from trace_iterator · 6d158a81
      Steven Rostedt authored
      Replace the NR_CPUS array of buffer_iter from the trace_iterator
      with an allocated array. This will just create an array of
      possible CPUS instead of the max number specified.
      
      The use of NR_CPUS in that array caused allocation failures for
      machines that were tight on memory. This did not cause any failures
      to the system itself (no crashes), but caused unnecessary failures
      for reading the trace files.
      
      Added a helper function called 'trace_buffer_iter()' that returns
      the buffer_iter item or NULL if it is not defined or the array was
      not allocated. Some routines do not require the array
      (tracing_open_pipe() for one).
      Reported-by: default avatarDave Jones <davej@redhat.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6d158a81
    • Namhyung Kim's avatar
      tracing/kvm: Use __print_hex() for kvm_emulate_insn tracepoint · b102f1d0
      Namhyung Kim authored
      The kvm_emulate_insn tracepoint used __print_insn()
      for printing its instructions. However it makes the
      format of the event hard to parse as it reveals TP
      internals.
      
      Fortunately, kernel provides __print_hex for almost
      same purpose, we can use it instead of open coding
      it. The user-space can be changed to parse it later.
      
      That means raw kernel tracing will not be affected
      by this change:
      
       # cd /sys/kernel/debug/tracing/
       # cat events/kvm/kvm_emulate_insn/format
       name: kvm_emulate_insn
       ID: 29
       format:
      	...
       print fmt: "%x:%llx:%s (%s)%s", REC->csbase, REC->rip, __print_hex(REC->insn, REC->len), \
       __print_symbolic(REC->flags, { 0, "real" }, { (1 << 0) | (1 << 1), "vm16" }, \
       { (1 << 0), "prot16" }, { (1 << 0) | (1 << 2), "prot32" }, { (1 << 0) | (1 << 3), "prot64" }), \
       REC->failed ? " failed" : ""
      
       # echo 1 > events/kvm/kvm_emulate_insn/enable
       # cat trace
       # tracer: nop
       #
       # entries-in-buffer/entries-written: 2183/2183   #P:12
       #
       #                              _-----=> irqs-off
       #                             / _----=> need-resched
       #                            | / _---=> hardirq/softirq
       #                            || / _--=> preempt-depth
       #                            ||| /     delay
       #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
       #              | |       |   ||||       |         |
               qemu-kvm-1782  [002] ...1   140.931636: kvm_emulate_insn: 0:c102fa25:89 10 (prot32)
               qemu-kvm-1781  [004] ...1   140.931637: kvm_emulate_insn: 0:c102fa25:89 10 (prot32)
      
      Link: http://lkml.kernel.org/n/tip-wfw6y3b9ugtey8snaow9nmg5@git.kernel.org
      Link: http://lkml.kernel.org/r/1340757701-10711-2-git-send-email-namhyung@kernel.org
      
      Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: kvm@vger.kernel.org
      Acked-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      b102f1d0
    • Steven Rostedt's avatar
      tracing/selftest: Add a WARN_ON() if a tracer test fails · 0be61ebc
      Steven Rostedt authored
      Add a WARN_ON() output on test failures so that they are easier to detect
      in automated tests. Although, the WARN_ON() will not print if the test
      causes the system to crash, obviously.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      0be61ebc
  2. 25 Jun, 2012 1 commit
  3. 20 Jun, 2012 1 commit
  4. 19 Jun, 2012 20 commits
  5. 18 Jun, 2012 14 commits