1. 20 4月, 2014 2 次提交
  2. 14 4月, 2014 3 次提交
  3. 19 3月, 2014 9 次提交
  4. 15 3月, 2014 9 次提交
  5. 14 3月, 2014 1 次提交
    • D
      perf tools: Fix synthesizing mmaps for threads · bfd66cc7
      Don Zickus 提交于
      Currently if a process creates a bunch of threads using pthread_create
      and then perf is run in system_wide mode, the mmaps for those threads
      are not captured with a synthesized mmap event.
      
      The reason is those threads are not visible when walking the /proc/
      directory looking for /proc/<pid>/maps files.  Instead they are
      discovered using the /proc/<pid>/tasks file (which the synthesized comm
      event uses).
      
      This causes problems when a program is trying to map a data address to a
      tid.  Because the tid has no maps, the event is dropped.  Changing the
      program to look up using the pid instead of the tid, finds the correct
      maps but creates ugly hacks in the program to carry the correct tid
      around.
      
      Fix this by moving the walking of the /proc/<pid>/tasks up a level (out
      of the comm function) based on Arnaldo's suggestion.
      
      Tweaked things a bit to special case the 'full' bit and 'guest' check.
      Signed-off-by: NDon Zickus <dzickus@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1393429527-167840-2-git-send-email-dzickus@redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bfd66cc7
  6. 11 3月, 2014 1 次提交
  7. 10 3月, 2014 2 次提交
  8. 28 2月, 2014 1 次提交
    • J
      perf tools: Fix strict alias issue for find_first_bit · b39c2a57
      Jiri Olsa 提交于
      When compiling perf tool code with gcc 4.4.7 I'm getting
      following error:
      
          CC       util/session.o
        cc1: warnings being treated as errors
        util/session.c: In function ‘perf_session_deliver_event’:
        tools/perf/util/include/linux/bitops.h:109: error: dereferencing pointer ‘p’ does break strict-aliasing rules
        tools/perf/util/include/linux/bitops.h:101: error: dereferencing pointer ‘p’ does break strict-aliasing rules
        util/session.c:697: note: initialized from here
        tools/perf/util/include/linux/bitops.h:101: note: initialized from here
        make[1]: *** [util/session.o] Error 1
        make: *** [util/session.o] Error 2
      
      The aliased types here are u64 and unsigned long pointers, which is safe
      for the find_first_bit processing.
      
      This error shows up for me only for gcc 4.4 on 32bit x86, even for
      -Wstrict-aliasing=3, while newer gcc are quiet and scream here for
      -Wstrict-aliasing={2,1}. Looks like newer gcc changed the rules for
      strict alias warnings.
      
      The gcc documentation offers workaround for valid aliasing by using
      __may_alias__ attribute:
      
        http://gcc.gnu.org/onlinedocs/gcc-4.4.0/gcc/Type-Attributes.html
      
      Using this workaround for the find_first_bit function.
      Signed-off-by: NJiri 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: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1393434867-20271-1-git-send-email-jolsa@redhat.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b39c2a57
  9. 25 2月, 2014 2 次提交
  10. 24 2月, 2014 3 次提交
  11. 18 2月, 2014 7 次提交
    • M
      perf probe: Support distro-style debuginfo for uprobe · a15ad2f5
      Masami Hiramatsu 提交于
      Support distro-style debuginfo supported by dso for setting uprobes.
      Note that this tries to find a debuginfo file based on the real path of
      the target binary. If the debuginfo is not correctly installed on the
      system, this can not find it.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053227.29635.54434.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a15ad2f5
    • M
      perf probe: Allow to add events on the local functions · eb948e50
      Masami Hiramatsu 提交于
      Allow to add events on the local functions without debuginfo.
      (With the debuginfo, we can add events even on inlined functions)
      Currently, probing on local functions requires debuginfo to
      locate actual address. It is also possible without debuginfo since
      we have symbol maps.
      
      Without this change;
        ----
        # ./perf probe -a t_show
        Added new event:
          probe:t_show         (on t_show)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe:t_show -aR sleep 1
      
        # ./perf probe -x perf -a identity__map_ip
        no symbols found in /kbuild/ksrc/linux-3/tools/perf/perf, maybe install a debug package?
        Failed to load map.
          Error: Failed to add events. (-22)
        ----
      As the above results, perf probe just put one event
      on the first found symbol for kprobe event. Moreover,
      for uprobe event, perf probe failed to find local
      functions.
      
      With this change;
        ----
        # ./perf probe -a t_show
        Added new events:
          probe:t_show         (on t_show)
          probe:t_show_1       (on t_show)
          probe:t_show_2       (on t_show)
          probe:t_show_3       (on t_show)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe:t_show_3 -aR sleep 1
      
        # ./perf probe -x perf -a identity__map_ip
        Added new events:
          probe_perf:identity__map_ip (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf)
          probe_perf:identity__map_ip_1 (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf)
          probe_perf:identity__map_ip_2 (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf)
          probe_perf:identity__map_ip_3 (on identity__map_ip in /kbuild/ksrc/linux-3/tools/perf/perf)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe_perf:identity__map_ip_3 -aR sleep 1
        ----
      Now we succeed to put events on every given local functions
      for both kprobes and uprobes. :)
      
      Note that this also introduces some symbol rbtree
      iteration macros; symbols__for_each, dso__for_each_symbol,
      and map__for_each_symbol. These are for walking through
      the symbol list in a map.
      
      Changes from v2:
        - Fix add_exec_to_probe_trace_events() not to convert address
          to tp->symbol any more.
        - Fix to set kernel probes based on ref_reloc_sym.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053225.29635.15026.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      eb948e50
    • M
      perf probe: Show source-level or symbol-level info for uprobes · 5a6f6314
      Masami Hiramatsu 提交于
      Show source-level or symbol-level information for uprobe events.
      
      Without this change;
        # ./perf probe -l
          probe_perf:dso__load_vmlinux (on 0x000000000006d110 in /kbuild/ksrc/linux-3/tools/perf/perf)
      
      With this change;
        # ./perf probe -l
          probe_perf:dso__load_vmlinux (on dso__load_vmlinux@util/symbol.c in /kbuild/ksrc/linux-3/tools/perf/perf)
      
      Changes from v2:
       - Update according to previous patches.
      
      Changes from v1:
       - Rewrite the code based on new series.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053223.29635.51280.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5a6f6314
    • M
      perf probe: Show appropriate symbol for ref_reloc_sym based kprobes · 8f33f7de
      Masami Hiramatsu 提交于
      Show appropriate symbol for ref_reloc_sym based kprobes instead of
      refpoint+offset when perf-probe -l runs without debuginfo.
      
      Without this change:
        # ./perf probe -l
          probe:t_show         (on _stext+889880 with m v)
          probe:t_show_1       (on _stext+928568 with m v t)
          probe:t_show_2       (on _stext+969512 with m v fmt)
          probe:t_show_3       (on _stext+1001416 with m v file)
      
      With this change:
        # ./perf probe -l
          probe:t_show         (on t_show with m v)
          probe:t_show_1       (on t_show with m v t)
          probe:t_show_2       (on t_show with m v fmt)
          probe:t_show_3       (on t_show with m v file)
      
      Changes from v2:
       - Check ref_reloc_sym to find correct unrelocated address.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053220.29635.81819.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8f33f7de
    • M
      perf probe: Find given address from offline dwarf · f90acac7
      Masami Hiramatsu 提交于
      Find the given address from offline dwarfs instead of online kernel
      dwarfs.
      
      On the KASLR enabled kernel, the kernel text section is loaded with
      random offset, and the debuginfo__new_online_kernel can't handle it. So
      let's move to the offline dwarf loader instead of using the online dwarf
      loader.
      
      As a result, since we don't need debuginfo__new_online_kernel any more,
      this also removes the functions related to that.
      
      Without this change;
      
        # ./perf probe -l
          probe:t_show         (on _stext+901288 with m v)
          probe:t_show_1       (on _stext+939624 with m v t)
          probe:t_show_2       (on _stext+980296 with m v fmt)
          probe:t_show_3       (on _stext+1014392 with m v file)
      
      With this change;
      
        # ./perf probe -l
          probe:t_show         (on t_show@linux-3/kernel/trace/ftrace.c with m v)
          probe:t_show_1       (on t_show@linux-3/kernel/trace/trace.c with m v t)
          probe:t_show_2       (on t_show@kernel/trace/trace_printk.c with m v fmt)
          probe:t_show_3       (on t_show@kernel/trace/trace_events.c with m v file)
      
      Changes from v2:
       - Instead of retrying, directly opens offline dwarf.
       - Remove debuginfo__new_online_kernel and related functions.
       - Refer map->reloc to get the correct address of a symbol.
       - Add a special case for handling ref_reloc_sym based address.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053218.29635.74821.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f90acac7
    • M
      perf probe: Use ref_reloc_sym based address instead of the symbol name · dfef99cd
      Masami Hiramatsu 提交于
      Since several local symbols can have same name (e.g. t_show), we need to
      use the relative address from the symbol referred by kmap->ref_reloc_sym
      instead of the target symbol name itself.
      
      Because the kernel address space layout randomize (kASLR) changes the
      absolute address of kernel symbols, we can't rely on the absolute
      address.
      
      Note that this works only with debuginfo.
      
      E.g. without this change;
        ----
        # ./perf probe -a "t_show \$vars"
        Added new events:
          probe:t_show         (on t_show with $vars)
          probe:t_show_1       (on t_show with $vars)
          probe:t_show_2       (on t_show with $vars)
          probe:t_show_3       (on t_show with $vars)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe:t_show_3 -aR sleep 1
        ----
      OK, we have 4 different t_show()s. All functions have
      different arguments as below;
        ----
        # cat /sys/kernel/debug/tracing/kprobe_events
        p:probe/t_show t_show m=%di:u64 v=%si:u64
        p:probe/t_show_1 t_show m=%di:u64 v=%si:u64 t=%si:u64
        p:probe/t_show_2 t_show m=%di:u64 v=%si:u64 fmt=%si:u64
        p:probe/t_show_3 t_show m=%di:u64 v=%si:u64 file=%si:u64
        ----
      However, all of them have been put on the *same* address.
        ----
        # cat /sys/kernel/debug/kprobes/list
        ffffffff810d9720  k  t_show+0x0    [DISABLED]
        ffffffff810d9720  k  t_show+0x0    [DISABLED]
        ffffffff810d9720  k  t_show+0x0    [DISABLED]
        ffffffff810d9720  k  t_show+0x0    [DISABLED]
        ----
      
      With this change;
        ----
        # ./perf probe -a "t_show \$vars"
        Added new events:
          probe:t_show         (on t_show with $vars)
          probe:t_show_1       (on t_show with $vars)
          probe:t_show_2       (on t_show with $vars)
          probe:t_show_3       (on t_show with $vars)
      
        You can now use it in all perf tools, such as:
      
                perf record -e probe:t_show_3 -aR sleep 1
      
        # cat /sys/kernel/debug/tracing/kprobe_events
        p:probe/t_show _stext+889880 m=%di:u64 v=%si:u64
        p:probe/t_show_1 _stext+928568 m=%di:u64 v=%si:u64 t=%si:u64
        p:probe/t_show_2 _stext+969512 m=%di:u64 v=%si:u64 fmt=%si:u64
        p:probe/t_show_3 _stext+1001416 m=%di:u64 v=%si:u64 file=%si:u64
      
        # cat /sys/kernel/debug/kprobes/list
        ffffffffb50d95e0  k  t_show+0x0    [DISABLED]
        ffffffffb50e2d00  k  t_show+0x0    [DISABLED]
        ffffffffb50f4990  k  t_show+0x0    [DISABLED]
        ffffffffb50eccf0  k  t_show+0x0    [DISABLED]
        ----
      This time, each event is put in different address
      correctly.
      
      Note that currently this doesn't support address-based
      probe on modules (thus the probes on modules are symbol
      based), since it requires relative address probe syntax
      for kprobe-tracer, and it isn't implemented yet.
      
      One more note, this allows us to put events on correct
      address, but --list option should be updated to show
      correct corresponding source code.
      
      Changes from v2:
        - Refer kmap->ref_reloc_sym instead of "_stext".
        - Refer map->reloc to catch up the kASLR perf fix.
      
      Changes from v1:
        - Use _stext relative address instead of actual
          absolute address recorded in debuginfo.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053216.29635.22584.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dfef99cd
    • M
      perf probe: Show in what binaries/modules probes are set · fb226ccd
      Masami Hiramatsu 提交于
      Show the name of binary file or modules in which the probes are set with
      --list option.
      
      Without this change;
      
        # ./perf probe -m drm drm_av_sync_delay
        # ./perf probe -x perf dso__load_vmlinux
      
        # ./perf probe -l
          probe:drm_av_sync_delay (on drm_av_sync_delay)
          probe_perf:dso__load_vmlinux (on 0x000000000006d110)
      
      With this change;
      
        # ./perf probe -l
          probe:drm_av_sync_delay (on drm_av_sync_delay in drm)
          probe_perf:dso__load_vmlinux (on 0x000000000006d110 in /kbuild/ksrc/linux-3/tools/perf/perf)
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: "David A. Long" <dave.long@linaro.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20140206053213.29635.69948.stgit@kbuild-fedora.yrl.intra.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fb226ccd