1. 23 May, 2012 1 commit
    • Steven Rostedt's avatar
      ring-buffer: Check for valid buffer before changing size · 6a31e1f1
      Steven Rostedt authored
      On some machines the number of possible CPUS is not the same as the
      number of CPUs that is on the machine. Ftrace uses possible_cpus to
      update the tracing structures but the ring buffer only allocates
      per cpu buffers for online CPUs when they come up.
      
      When the wakeup tracer was enabled in such a case, the ftrace code
      enabled all possible cpu buffers, but the code in ring_buffer_resize()
      did not check to see if the buffer in question was allocated. Since
      boot up CPUs did not match possible CPUs it caused the following
      crash:
      
      BUG: unable to handle kernel NULL pointer dereference at 00000020
      IP: [<c1097851>] ring_buffer_resize+0x16a/0x28d
      *pde = 00000000
      Oops: 0000 [#1] PREEMPT SMP
      Dumping ftrace buffer:
         (ftrace buffer empty)
      Modules linked in: [last unloaded: scsi_wait_scan]
      
      Pid: 1387, comm: bash Not tainted 3.4.0-test+ #13                  /DG965MQ
      EIP: 0060:[<c1097851>] EFLAGS: 00010217 CPU: 0
      EIP is at ring_buffer_resize+0x16a/0x28d
      EAX: f5a14340 EBX: f6026b80 ECX: 00000ff4 EDX: 00000ff3
      ESI: 00000000 EDI: 00000002 EBP: f4275ecc ESP: f4275eb0
       DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
      CR0: 80050033 CR2: 00000020 CR3: 34396000 CR4: 000007d0
      DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
      DR6: ffff0ff0 DR7: 00000400
      Process bash (pid: 1387, ti=f4274000 task=f4380cb0 task.ti=f4274000)
      Stack:
       c109cf9a f6026b98 00000162 00160f68 00000006 00160f68 00000002 f4275ef0
       c109d013 f4275ee8 c123b72a c1c0bf00 c1cc81dc 00000005 f4275f98 00000007
       f4275f70 c109d0c7 7700000e 75656b61 00000070 f5e90900 f5c4e198 00000301
      Call Trace:
       [<c109cf9a>] ? tracing_set_tracer+0x115/0x1e9
       [<c109d013>] tracing_set_tracer+0x18e/0x1e9
       [<c123b72a>] ? _copy_from_user+0x30/0x46
       [<c109d0c7>] tracing_set_trace_write+0x59/0x7f
       [<c10ec01e>] ? fput+0x18/0x1c6
       [<c11f8732>] ? security_file_permission+0x27/0x2b
       [<c10eaacd>] ? rw_verify_area+0xcf/0xf2
       [<c10ec01e>] ? fput+0x18/0x1c6
       [<c109d06e>] ? tracing_set_tracer+0x1e9/0x1e9
       [<c10ead77>] vfs_write+0x8b/0xe3
       [<c10ebead>] ? fget_light+0x30/0x81
       [<c10eaf54>] sys_write+0x42/0x63
       [<c1834fbf>] sysenter_do_call+0x12/0x28
      
      This happens with the latency tracer as the ftrace code updates the
      saved max buffer via its cpumask and not with a global setting.
      
      Adding a check in ring_buffer_resize() to make sure the buffer being resized
      exists, fixes the problem.
      
      Cc: Vaibhav Nagarnaik <vnagarnaik@google.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      6a31e1f1
  2. 21 May, 2012 3 commits
  3. 19 May, 2012 3 commits
  4. 18 May, 2012 3 commits
  5. 17 May, 2012 5 commits
    • Jiri Olsa's avatar
      perf hists: Fix callchain ip printf format · a0187060
      Jiri Olsa authored
      The callchain address is stored as u64. Current code uses following
      format string to display callchain address:
      
        "%p\n", (void *)(long)chain->ip
      
      This way we lose upper 32 bits if we report 64 bit addresses in 32 bit
      environment. Fixing this to always display whole 64 bits.
      
      Note, running following to test perf endianity handling:
      test 1)
        - origin system:
          # perf record -a -- sleep 10 (any perf record will do)
          # perf report > report.origin
          # perf archive perf.data
      
        - copy the perf.data, report.origin and perf.data.tar.bz2
          to a target system and run:
          # tar xjvf perf.data.tar.bz2 -C ~/.debug
          # perf report > report.target
          # diff -u report.origin report.target
      
        - the diff should produce no output
          (besides some white space stuff and possibly different
           date/TZ output)
      
      test 2)
        - origin system:
          # perf record -ag -fo /tmp/perf.data -- sleep 1
        - mount origin system root to the target system on /mnt/origin
        - target system:
          # perf script --symfs /mnt/origin -I -i /mnt/origin/tmp/perf.data \
           --kallsyms /mnt/origin/proc/kallsyms
        - complete perf.data header is displayed
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1337151548-2396-8-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a0187060
    • Namhyung Kim's avatar
      perf target: Add uses_mmap field · d1cb9fce
      Namhyung Kim authored
      If perf doesn't mmap on event (like perf stat), it should not create
      per-task-per-cpu events. So just use a dummy cpu map to create a
      per-task event for this case.
      Signed-off-by: default avatarNamhyung Kim <namhyung.kim@lge.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1337161549-9870-3-git-send-email-namhyung.kim@lge.com
      [ committer note: renamed .need_mmap to .uses_mmap ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d1cb9fce
    • Steven Rostedt's avatar
      ftrace: Remove selecting FRAME_POINTER with FUNCTION_TRACER · b732d439
      Steven Rostedt authored
      The function tracer will enable the -pg option with gcc, which requires
      that frame pointers. When FRAME_POINTER is defined in the kernel config
      it adds the gcc option -fno-omit-frame-pointer which causes some problems
      on some architectures. For those architectures, the FRAME_POINTER select
      was not set.
      
      When FUNCTION_TRACER was selected on these architectures that can not have
      -fno-omit-frame-pointer, the -pg option is still set. But when
      FRAME_POINTER is not selected, the kernel config would add the gcc option
      -fomit-frame-pointer. Adding this option is incompatible with -pg
      even on archs that do not need frame pointers with -pg.
      
      The answer to this was to just not add either -fno-omit-frame-pointer
      or -fomit-frame-pointer on these archs that want function tracing
      but do not set FRAME_POINTER.
      
      As it turns out, for archs that require frame pointers for function
      tracing, the same can be used. If gcc requires frame pointers with
      -pg, it will simply add it. The best thing to do is not select FRAME_POINTER
      when function tracing is selected, and let gcc add it if needed.
      
      Only add the -fno-omit-frame-pointer when something else selects
      FRAME_POINTER, but do not add -fomit-frame-pointer if function tracing
      is selected.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      b732d439
    • Steven Rostedt's avatar
      ftrace/x86: Have x86 ftrace use the ftrace_modify_all_code() · e4f5d544
      Steven Rostedt authored
      To remove duplicate code, have the ftrace arch_ftrace_update_code()
      use the generic ftrace_modify_all_code(). This requires that the
      default ftrace_replace_code() becomes a weak function so that an
      arch may override it.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      e4f5d544
    • Steven Rostedt's avatar
      ftrace: Make ftrace_modify_all_code() global for archs to use · 8ed3e2cf
      Steven Rostedt authored
      Rename __ftrace_modify_code() to ftrace_modify_all_code() and make
      it global for all archs to use. This will remove the duplication
      of code, as archs that can modify code without stop_machine()
      can use it directly outside of the stop_machine() call.
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      8ed3e2cf
  6. 16 May, 2012 14 commits
  7. 14 May, 2012 2 commits
  8. 12 May, 2012 5 commits
  9. 11 May, 2012 4 commits