1. 14 7月, 2016 3 次提交
  2. 13 7月, 2016 1 次提交
    • A
      tools: Introduce str_error_r() · c8b5f2c9
      Arnaldo Carvalho de Melo 提交于
      The tools so far have been using the strerror_r() GNU variant, that
      returns a string, be it the buffer passed or something else.
      
      But that, besides being tricky in cases where we expect that the
      function using strerror_r() returns the error formatted in a provided
      buffer (we have to check if it returned something else and copy that
      instead), breaks the build on systems not using glibc, like Alpine
      Linux, where musl libc is used.
      
      So, introduce yet another wrapper, str_error_r(), that has the GNU
      interface, but uses the portable XSI variant of strerror_r(), so that
      users rest asured that the provided buffer is used and it is what is
      returned.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-d4t42fnf48ytlk8rjxs822tf@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c8b5f2c9
  3. 05 7月, 2016 1 次提交
  4. 01 7月, 2016 2 次提交
  5. 23 6月, 2016 2 次提交
  6. 22 6月, 2016 1 次提交
  7. 16 6月, 2016 1 次提交
  8. 14 6月, 2016 3 次提交
  9. 10 5月, 2016 1 次提交
  10. 06 5月, 2016 1 次提交
  11. 28 4月, 2016 1 次提交
  12. 27 4月, 2016 3 次提交
    • R
      perf probe: Fix module probe issue if no dwarf support · c61fb959
      Ravi Bangoria 提交于
      Perf is not able to register probe in kernel module when dwarf supprt
      is not there(and so it goes for symtab). Perf passes full path of
      module where only module name is required which is causing the problem.
      This patch fixes this issue.
      
      Before applying patch:
      
        $ dpkg -s libdw-dev
        dpkg-query: package 'libdw-dev' is not installed and no information is...
      
        $ sudo ./perf probe -m /linux/samples/kprobes/kprobe_example.ko kprobe_init
        Added new event:
          probe:kprobe_init (on kprobe_init in /linux/samples/kprobes/kprobe_example.ko)
      
        You can now use it in all perf tools, such as:
      
        perf record -e probe:kprobe_init -aR sleep 1
      
        $ sudo cat /sys/kernel/debug/tracing/kprobe_events
        p:probe/kprobe_init /linux/samples/kprobes/kprobe_example.ko:kprobe_init
      
        $ sudo ./perf record -a -e probe:kprobe_init
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.105 MB perf.data ]
      
        $ sudo ./perf script 	# No output here
      
      After applying patch:
      
        $ sudo ./perf probe -m /linux/samples/kprobes/kprobe_example.ko kprobe_init
        Added new event:
          probe:kprobe_init    (on kprobe_init in kprobe_example)
      
        You can now use it in all perf tools, such as:
      
        perf record -e probe:kprobe_init -aR sleep 1
      
        $ sudo cat /sys/kernel/debug/tracing/kprobe_events
        p:probe/kprobe_init kprobe_example:kprobe_init
      
        $ sudo ./perf record -a -e probe:kprobe_init
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.105 MB perf.data (2 samples) ]
      
        $ sudo ./perf script
        insmod 13990 [002]  5961.216833: probe:kprobe_init: ...
        insmod 13995 [002]  5962.889384: probe:kprobe_init: ...
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1461680741-12517-1-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c61fb959
    • R
      perf probe: Fix offline module name missmatch issue · 63a29613
      Ravi Bangoria 提交于
      Perf can add a probe on kernel module which has not been loaded yet.
      
      The current implementation finds the module name from path. But if the
      filename is different from the actual module name then perf fails to
      register a probe while loading module because of mismatch in the names.
      
      For example, samples/kobject/kobject-example.ko is loaded as
      kobject_example.
      
      Before applying patch:
      
        $ sudo ./perf probe -m /linux/samples/kobject/kobject-example.ko foo_show
          Added new event:
            probe:foo_show       (on foo_show in kobject-example)
      
          You can now use it in all perf tools, such as:
      
          perf record -e probe:foo_show -aR sleep 1
      
        $ cat /sys/kernel/debug/tracing/kprobe_events
          p:probe/foo_show kobject-example:foo_show
      
        $ insmod kobject-example.ko
      
        $ lsmod
          Module                  Size  Used by
          kobject_example        16384  0
      
        Generate read to /sys/kernel/kobject_example/foo while recording data
        with below command
        $ sudo ./perf record -e probe:foo_show -a
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.093 MB perf.data ]
      
        $./perf report --stdio -F overhead,comm,dso,sym
          Error:
          The perf.data.old file has no samples!
      
      After applying patch:
      
        $ sudo ./perf probe -m /linux/samples/kobject/kobject-example.ko foo_show
          Added new event:
            probe:foo_show       (on foo_show in kobject_example)
      
          You can now use it in all perf tools, such as:
      
          perf record -e probe:foo_show -aR sleep 1
      
        $ sudo cat /sys/kernel/debug/tracing/kprobe_events
          p:probe/foo_show kobject_example:foo_show
      
        $ insmod kobject-example.ko
      
        $ lsmod
          Module                  Size  Used by
          kobject_example        16384  0
      
        Generate read to /sys/kernel/kobject_example/foo while recording data
        with below command
        $ sudo ./perf record -e probe:foo_show -a
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.097 MB perf.data (8 samples) ]
      
        $ sudo ./perf report  --stdio -F overhead,comm,dso,sym
          ...
          # Samples: 8  of event 'probe:foo_show'
          # Event count (approx.): 8
          #
          # Overhead  Command  Shared Object      Symbol
          # ........  .......  .................  ............
          #
             100.00%  cat      [kobject_example]  [k] foo_show
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1461680741-12517-2-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      63a29613
    • M
      perf probe: Set default kprobe group name if it is not given · 2a12ec13
      Masami Hiramatsu 提交于
      Set kprobe group name as "probe" if it is not given.
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20160426090413.11891.95640.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2a12ec13
  13. 26 4月, 2016 1 次提交
  14. 24 3月, 2016 1 次提交
  15. 19 11月, 2015 1 次提交
    • W
      perf bpf: Allow BPF program config probing options · 03e01f56
      Wang Nan 提交于
      By extending the syntax of BPF object section names, this patch allows users to
      config probing options like what they can do in 'perf probe'.
      
      The error message in 'perf probe' is also updated.
      
      Test result:
      
      For following BPF file test_probe_glob.c:
      
        # cat test_probe_glob.c
        __attribute__((section("inlines=no;func=SyS_dup?"), used))
      
        int func(void *ctx)
        {
      	  return 1;
        }
      
        char _license[] __attribute__((section("license"), used)) = "GPL";
        int _version __attribute__((section("version"), used)) = 0x40300;
        #
        # ./perf record  -e ./test_probe_glob.c ls /
        ...
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.013 MB perf.data ]
        # ./perf evlist
        perf_bpf_probe:func_1
        perf_bpf_probe:func
      
      After changing "inlines=no" to "inlines=yes":
      
        # ./perf record  -e ./test_probe_glob.c ls /
        ...
        [ perf record: Woken up 2 times to write data ]
        [ perf record: Captured and wrote 0.013 MB perf.data ]
        # ./perf evlist
        perf_bpf_probe:func_3
        perf_bpf_probe:func_2
        perf_bpf_probe:func_1
        perf_bpf_probe:func
      
      Then test 'force':
      
      Use following program:
      
        # cat test_probe_force.c
        __attribute__((section("func=sys_write"), used))
      
        int funca(void *ctx)
        {
      	  return 1;
        }
      
        __attribute__((section("force=yes;func=sys_write"), used))
      
        int funcb(void *ctx)
        {
        	return 1;
        }
      
        char _license[] __attribute__((section("license"), used)) = "GPL";
        int _version __attribute__((section("version"), used)) = 0x40300;
        #
      
        # perf record -e ./test_probe_force.c usleep 1
        Error: event "func" already exists.
         Hint: Remove existing event by 'perf probe -d'
             or force duplicates by 'perf probe -f'
             or set 'force=yes' in BPF source.
        event syntax error: './test_probe_force.c'
                             \___ Probe point exist. Try 'perf probe -d "*"' and set 'force=yes'
      
        (add -v to see detail)
        ...
      
      Then replace 'force=no' to 'force=yes':
      
        # vim test_probe_force.c
        # perf record -e ./test_probe_force.c usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.017 MB perf.data ]
        # perf evlist
        perf_bpf_probe:func_1
        perf_bpf_probe:func
        #
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1447675815-166222-7-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      03e01f56
  16. 06 11月, 2015 1 次提交
  17. 05 11月, 2015 1 次提交
  18. 03 10月, 2015 1 次提交
  19. 01 10月, 2015 5 次提交
  20. 25 9月, 2015 1 次提交
    • A
      perf probe: Use existing routine to look for a kernel module by dso->short_name · 266fa2b2
      Arnaldo Carvalho de Melo 提交于
      We have map_groups__find_by_name() to look at the list of modules that
      are in place for a given machine, so use it instead of traversing the
      machine dso list, which also includes DSOs for userspace.
      
      When merging the user and kernel DSO lists a bug was introduced where
      'perf probe' stopped being able to add probes to modules using its short
      name:
      
        # perf probe -m usbnet --add usbnet_start_xmit
        usbnet_start_xmit is out of .text, skip it.
          Error: Failed to add events.
        #
      
      With this fix it works again:
      
        # perf probe -m usbnet --add usbnet_start_xmit
        Added new event:
          probe:usbnet_start_xmit (on usbnet_start_xmit in usbnet)
      
        You can now use it in all perf tools, such as:
      
        	perf record -e probe:usbnet_start_xmit -aR sleep 1
        #
      Reported-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Fixes: 3d39ac53 ("perf machine: No need to have two DSOs lists")
      Link: http://lkml.kernel.org/r/20150924015008.GE1897@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      266fa2b2
  21. 15 9月, 2015 2 次提交
  22. 14 9月, 2015 1 次提交
  23. 04 9月, 2015 4 次提交
  24. 26 8月, 2015 1 次提交
    • W
      perf probe: Support probing at absolute address · da15bd9d
      Wang Nan 提交于
      It should be useful to allow 'perf probe' probe at absolute offset of a
      target. For example, when (u)probing at a instruction of a shared object
      in a embedded system where debuginfo is not avaliable but we know the
      offset of that instruction by manually digging.
      
      This patch enables following perf probe command syntax:
      
        # perf probe 0xffffffff811e6615
      
      And
      
        # perf probe /lib/x86_64-linux-gnu/libc-2.19.so 0xeb860
      
      In the above example, we don't need a anchor symbol, so it is possible
      to compute absolute addresses using other methods and then use 'perf
      probe' to create the probing points.
      
      v1 -> v2:
        Drop the leading '+' in cmdline;
        Allow uprobing at offset 0x0;
        Improve 'perf probe -l' result when uprobe at area without debuginfo.
      
      v2 -> v3:
        Split bugfix to a separated patch.
      
      Test result:
      
        # perf probe 0xffffffff8119d175 %ax
        # perf probe sys_write %ax
        # perf probe /lib64/libc-2.18.so 0x0 %ax
        # perf probe /lib64/libc-2.18.so 0x5 %ax
        # perf probe /lib64/libc-2.18.so 0xd8e40 %ax
        # perf probe /lib64/libc-2.18.so __write %ax
        # perf probe /lib64/libc-2.18.so 0xd8e49 %ax
        # cat /sys/kernel/debug/tracing/uprobe_events
      
        p:probe_libc/abs_0 /lib64/libc-2.18.so:0x          (null) arg1=%ax
        p:probe_libc/abs_5 /lib64/libc-2.18.so:0x0000000000000005 arg1=%ax
        p:probe_libc/abs_d8e40 /lib64/libc-2.18.so:0x00000000000d8e40 arg1=%ax
        p:probe_libc/__write /lib64/libc-2.18.so:0x00000000000d8e40 arg1=%ax
        p:probe_libc/abs_d8e49 /lib64/libc-2.18.so:0x00000000000d8e49 arg1=%ax
      
        # cat /sys/kernel/debug/tracing/kprobe_events
      
        p:probe/abs_ffffffff8119d175 0xffffffff8119d175 arg1=%ax
        p:probe/sys_write _text+1692016 arg1=%ax
      
        # perf probe -l
      
        Failed to find debug information for address 5
          probe:abs_ffffffff8119d175 (on sys_write+5 with arg1)
          probe:sys_write      (on sys_write with arg1)
          probe_libc:__write   (on @unix/syscall-template.S:81 in /lib64/libc-2.18.so with arg1)
          probe_libc:abs_0     (on 0x0 in /lib64/libc-2.18.so with arg1)
          probe_libc:abs_5     (on 0x5 in /lib64/libc-2.18.so with arg1)
          probe_libc:abs_d8e40 (on @unix/syscall-template.S:81 in /lib64/libc-2.18.so with arg1)
          probe_libc:abs_d8e49 (on __GI___libc_write+9 in /lib64/libc-2.18.so with arg1)
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1440586666-235233-7-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      da15bd9d