1. 24 8月, 2016 8 次提交
  2. 19 8月, 2016 1 次提交
    • A
      perf evsel: Do not access outside hw cache name arrays · c53412ee
      Arnaldo Carvalho de Melo 提交于
      We have to check if the values are >= *_MAX, not just >, fix it.
      
      From the bugzilla report:
      
      ''In file /tools/perf/util/evsel.c  function __perf_evsel__hw_cache_name
      it appears that there is a bug that reads beyond the end of the buffer.
      The statement "if (type > PERF_COUNT_HW_CACHE_MAX)" allows type to be
      equal to the maximum value. Later, when statement "if
      (!perf_evsel__is_cache_op_valid(type, op))" is executed, the function
      can access array perf_evsel__hw_cache_stat[type] beyond the end of the
      buffer.
      
      It appears to me that the statement "if (type > PERF_COUNT_HW_CACHE_MAX)"
      should be "if (type >= PERF_COUNT_HW_CACHE_MAX)"
      
      Bug found with Coverity and manual code review. No attempts were made to
      execute the code with a maximum type value.''
      
      Committer note:
      
      Testing it:
      
        $ perf record -e $(echo $(perf list cache | cut -d \[ -f1) | sed 's/ /,/g') usleep 1
        [ perf record: Woken up 16 times to write data ]
        [ perf record: Captured and wrote 0.023 MB perf.data (34 samples) ]
        $ perf evlist
        L1-dcache-load-misses
        L1-dcache-loads
        L1-dcache-stores
        L1-icache-load-misses
        LLC-load-misses
        LLC-loads
        LLC-store-misses
        LLC-stores
        branch-load-misses
        branch-loads
        dTLB-load-misses
        dTLB-loads
        dTLB-store-misses
        dTLB-stores
        iTLB-load-misses
        iTLB-loads
        node-load-misses
        node-loads
        node-store-misses
        node-stores
        $ perf list cache
      
        List of pre-defined events (to be used in -e):
      
          L1-dcache-load-misses        [Hardware cache event]
          L1-dcache-loads              [Hardware cache event]
          L1-dcache-stores             [Hardware cache event]
          L1-icache-load-misses        [Hardware cache event]
          LLC-load-misses              [Hardware cache event]
          LLC-loads                    [Hardware cache event]
          LLC-store-misses             [Hardware cache event]
          LLC-stores                   [Hardware cache event]
          branch-load-misses           [Hardware cache event]
          branch-loads                 [Hardware cache event]
          dTLB-load-misses             [Hardware cache event]
          dTLB-loads                   [Hardware cache event]
          dTLB-store-misses            [Hardware cache event]
          dTLB-stores                  [Hardware cache event]
          iTLB-load-misses             [Hardware cache event]
          iTLB-loads                   [Hardware cache event]
          node-load-misses             [Hardware cache event]
          node-loads                   [Hardware cache event]
          node-store-misses            [Hardware cache event]
          node-stores                  [Hardware cache event]
        $
      Reported-by: NBrian Sweeney <bsweeney@lgsinnovations.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=153351Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c53412ee
  3. 17 8月, 2016 1 次提交
    • M
      perf unwind: Use addr_location::addr instead of ip for entries · 67540759
      Milian Wolff 提交于
      This fixes the srcline translation for call chains of user space
      applications.
      
      Before we got:
      
          perf report --stdio --no-children -s sym,srcline -g address
           8.92%  [.] main                                 mandelbrot.h:41
                  |
                  |--3.70%--main +8390240
                  |          __libc_start_main +139950056726769
                  |          _start +8388650
                  |
                  |--2.74%--main +8390189
                  |
                   --2.08%--main +8390296
                             __libc_start_main +139950056726769
                             _start +8388650
      
           7.59%  [.] main                                 complex:1326
                  |
                  |--4.79%--main +8390203
                  |          __libc_start_main +139950056726769
                  |          _start +8388650
                  |
                   --2.80%--main +8390219
      
           7.12%  [.] __muldc3                             libgcc2.c:1945
                  |
                  |--3.76%--__muldc3 +139950060519490
                  |          main +8390224
                  |          __libc_start_main +139950056726769
                  |          _start +8388650
                  |
                   --3.32%--__muldc3 +139950060519512
                             main +8390224
      
      With this patch applied, we instead get:
      
          perf report --stdio --no-children -s sym,srcline -g address
           8.92%  [.] main                                 mandelbrot.h:41
                  |
                  |--3.70%--main mandelbrot.h:41
                  |          __libc_start_main +241
                  |          _start +4194346
                  |
                  |--2.74%--main mandelbrot.h:41
                  |
                   --2.08%--main mandelbrot.h:41
                             __libc_start_main +241
                             _start +4194346
      
           7.59%  [.] main                                 complex:1326
                  |
                  |--4.79%--main complex:1326
                  |          __libc_start_main +241
                  |          _start +4194346
                  |
                   --2.80%--main complex:1326
      
           7.12%  [.] __muldc3                             libgcc2.c:1945
                  |
                  |--3.76%--__muldc3 libgcc2.c:1945
                  |          main mandelbrot.h:39
                  |          __libc_start_main +241
                  |          _start +4194346
                  |
                   --3.32%--__muldc3 libgcc2.c:1945
                             main mandelbrot.h:39
      Suggested-and-Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LPU-Reference: 20160816153926.11288-1-milian.wolff@kdab.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      67540759
  4. 16 8月, 2016 4 次提交
  5. 13 8月, 2016 1 次提交
  6. 09 8月, 2016 6 次提交
    • R
      perf probe ppc64le: Fix probe location when using DWARF · 99e608b5
      Ravi Bangoria 提交于
      Powerpc has Global Entry Point and Local Entry Point for functions.  LEP
      catches call from both the GEP and the LEP. Symbol table of ELF contains
      GEP and Offset from which we can calculate LEP, but debuginfo does not
      have LEP info.
      
      Currently, perf prioritize symbol table over dwarf to probe on LEP for
      ppc64le. But when user tries to probe with function parameter, we fall
      back to using dwarf(i.e. GEP) and when function called via LEP, probe
      will never hit.
      
      For example:
      
        $ objdump -d vmlinux
          ...
          do_sys_open():
          c0000000002eb4a0:       e8 00 4c 3c     addis   r2,r12,232
          c0000000002eb4a4:       60 00 42 38     addi    r2,r2,96
          c0000000002eb4a8:       a6 02 08 7c     mflr    r0
          c0000000002eb4ac:       d0 ff 41 fb     std     r26,-48(r1)
      
        $ sudo ./perf probe do_sys_open
        $ sudo cat /sys/kernel/debug/tracing/kprobe_events
          p:probe/do_sys_open _text+3060904
      
        $ sudo ./perf probe 'do_sys_open filename:string'
        $ sudo cat /sys/kernel/debug/tracing/kprobe_events
          p:probe/do_sys_open _text+3060896 filename_string=+0(%gpr4):string
      
      For second case, perf probed on GEP. So when function will be called via
      LEP, probe won't hit.
      
        $ sudo ./perf record -a -e probe:do_sys_open ls
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.195 MB perf.data ]
      
      To resolve this issue, let's not prioritize symbol table, let perf
      decide what it wants to use. Perf is already converting GEP to LEP when
      it uses symbol table. When perf uses debuginfo, let it find LEP offset
      form symbol table. This way we fall back to probe on LEP for all cases.
      
      After patch:
      
        $ sudo ./perf probe 'do_sys_open filename:string'
        $ sudo cat /sys/kernel/debug/tracing/kprobe_events
          p:probe/do_sys_open _text+3060904 filename_string=+0(%gpr4):string
      
        $ sudo ./perf record -a -e probe:do_sys_open ls
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.197 MB perf.data (11 samples) ]
      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: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Balbir Singh <bsingharora@gmail.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: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1470723805-5081-2-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      99e608b5
    • R
      perf probe: Add function to post process kernel trace events · d820456d
      Ravi Bangoria 提交于
      Instead of inline code, introduce function to post process kernel
      probe trace events.
      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: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Balbir Singh <bsingharora@gmail.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: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1470723805-5081-1-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d820456d
    • N
      perf probe: Support signedness casting · 19f00b01
      Naohiro Aota 提交于
      The 'perf probe' tool detects a variable's type and use the detected
      type to add a new probe. Then, kprobes prints its variable in
      hexadecimal format if the variable is unsigned and prints in decimal if
      it is signed.
      
      We sometimes want to see unsigned variable in decimal format (i.e.
      sector_t or size_t). In that case, we need to investigate the variable's
      size manually to specify just signedness.
      
      This patch add signedness casting support. By specifying "s" or "u" as a
      type, perf-probe will investigate variable size as usual and use the
      specified signedness.
      
      E.g. without this:
      
        $ perf probe -a 'submit_bio bio->bi_iter.bi_sector'
        Added new event:
          probe:submit_bio     (on submit_bio with bi_sector=bio->bi_iter.bi_sector)
        You can now use it in all perf tools, such as:
                perf record -e probe:submit_bio -aR sleep 1
        $ cat trace_pipe|head
                dbench-9692  [003] d..1   971.096633: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x3a3d00
                dbench-9692  [003] d..1   971.096685: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x1a3d80
                dbench-9692  [003] d..1   971.096687: submit_bio: (submit_bio+0x0/0x140) bi_sector=0x3a3d80
      ...
        // need to investigate the variable size
        $ perf probe -a 'submit_bio bio->bi_iter.bi_sector:s64'
        Added new event:
          probe:submit_bio     (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s64)
        You can now use it in all perf tools, such as:
              perf record -e probe:submit_bio -aR sleep 1
      
        With this:
      
        // just use "s" to cast its signedness
        $ perf probe -v -a 'submit_bio bio->bi_iter.bi_sector:s'
        Added new event:
          probe:submit_bio     (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s)
        You can now use it in all perf tools, such as:
                perf record -e probe:submit_bio -aR sleep 1
        $ cat trace_pipe|head
                dbench-9689  [001] d..1  1212.391237: submit_bio: (submit_bio+0x0/0x140) bi_sector=128
                dbench-9689  [001] d..1  1212.391252: submit_bio: (submit_bio+0x0/0x140) bi_sector=131072
                dbench-9697  [006] d..1  1212.398611: submit_bio: (submit_bio+0x0/0x140) bi_sector=30208
      
        This commit also update perf-probe.txt to describe "types". Most parts
        are based on existing documentation: Documentation/trace/kprobetrace.txt
      
      Committer note:
      
      Testing using 'perf trace':
      
        # perf probe -a 'submit_bio bio->bi_iter.bi_sector'
        Added new event:
          probe:submit_bio     (on submit_bio with bi_sector=bio->bi_iter.bi_sector)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:submit_bio -aR sleep 1
      
        # trace --no-syscalls --ev probe:submit_bio
            0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=0xc133c0)
         3181.861 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffb8)
         3181.881 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffc0)
         3184.488 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x6cffc8)
      <SNIP>
         4717.927 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x4dc7a88)
         4717.970 probe:submit_bio:(ffffffffac3aee00) bi_sector=0x4dc7880)
        ^C[root@jouet ~]#
      
      Now, using this new feature:
      
      [root@jouet ~]# perf probe -a 'submit_bio bio->bi_iter.bi_sector:s'
      Added new event:
        probe:submit_bio     (on submit_bio with bi_sector=bio->bi_iter.bi_sector:s)
      
      You can now use it in all perf tools, such as:
      
      	perf record -e probe:submit_bio -aR sleep 1
      
        [root@jouet ~]# trace --no-syscalls --ev probe:submit_bio
           0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145704)
           0.017 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145712)
           0.019 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145720)
           2.567 probe:submit_bio:(ffffffffac3aee00) bi_sector=7145728)
        5631.919 probe:submit_bio:(ffffffffac3aee00) bi_sector=0)
        5631.941 probe:submit_bio:(ffffffffac3aee00) bi_sector=8)
        5631.945 probe:submit_bio:(ffffffffac3aee00) bi_sector=16)
        5631.948 probe:submit_bio:(ffffffffac3aee00) bi_sector=24)
        ^C#
      
      With callchains:
      
        # trace --no-syscalls --ev probe:submit_bio/max-stack=10/
           0.000 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662544)
                                             submit_bio+0xa8200001 ([kernel.kallsyms])
                                             submit_bh+0xa8200013 ([kernel.kallsyms])
                                             jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
                                             kjournald2+0xa82000ca ([kernel.kallsyms])
                                             kthread+0xa82000d8 ([kernel.kallsyms])
                                             ret_from_fork+0xa820001f ([kernel.kallsyms])
           0.023 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662552)
                                             submit_bio+0xa8200001 ([kernel.kallsyms])
                                             submit_bh+0xa8200013 ([kernel.kallsyms])
                                             jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
                                             kjournald2+0xa82000ca ([kernel.kallsyms])
                                             kthread+0xa82000d8 ([kernel.kallsyms])
                                             ret_from_fork+0xa820001f ([kernel.kallsyms])
           0.027 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662560)
                                             submit_bio+0xa8200001 ([kernel.kallsyms])
                                             submit_bh+0xa8200013 ([kernel.kallsyms])
                                             jbd2_journal_commit_transaction+0xa8200691 ([kernel.kallsyms])
                                             kjournald2+0xa82000ca ([kernel.kallsyms])
                                             kthread+0xa82000d8 ([kernel.kallsyms])
                                             ret_from_fork+0xa820001f ([kernel.kallsyms])
           2.593 probe:submit_bio:(ffffffffac3aee00) bi_sector=50662568)
                                             submit_bio+0xa8200001 ([kernel.kallsyms])
                                             submit_bh+0xa8200013 ([kernel.kallsyms])
                                             journal_submit_commit_record+0xa82001ac ([kernel.kallsyms])
                                             jbd2_journal_commit_transaction+0xa82012e8 ([kernel.kallsyms])
                                             kjournald2+0xa82000ca ([kernel.kallsyms])
                                             kthread+0xa82000d8 ([kernel.kallsyms])
                                             ret_from_fork+0xa820001f ([kernel.kallsyms])
        ^C#
      Signed-off-by: NNaohiro Aota <naohiro.aota@hgst.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1470710408-23515-1-git-send-email-naohiro.aota@hgst.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      19f00b01
    • K
      perf probe: Fix module name matching · cb3f3378
      Konstantin Khlebnikov 提交于
      If module is "module" then dso->short_name is "[module]".  Substring
      comparing is't enough: "raid10" matches to "[raid1]".  This patch also
      checks terminating zero in module name.
      Signed-off-by: NKonstantin Khlebnikov <khlebnikov@yandex-team.ru>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Link: http://lkml.kernel.org/r/147039975648.715620.12985971832789032159.stgit@buzzSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cb3f3378
    • M
      perf probe: Adjust map->reloc offset when finding kernel symbol from map · 8e34189b
      Masami Hiramatsu 提交于
      Adjust map->reloc offset for the unmapped address when finding
      alternative symbol address from map, because KASLR can relocate the
      kernel symbol address.
      
      The same adjustment has been done when finding appropriate kernel symbol
      address from map which was introduced by commit f90acac7 ("perf
      probe: Find given address from offline dwarf")
      Reported-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu@linaro.org>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20160806192948.e366f3fbc4b194de600f8326@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8e34189b
    • A
      perf hists: Trim libtraceevent trace_seq buffers · 887fa86d
      Arnaldo Carvalho de Melo 提交于
      When we use libtraceevent to format trace event fields into printable
      strings to use in hist entries it is important to trim it from the
      default 4 KiB it starts with to what is really used, to reduce the
      memory footprint, so use realloc(seq.buffer, seq.len + 1) when returning
      the seq.buffer formatted with the fields contents.
      Reported-and-Tested-by: NWang Nan <wangnan0@huawei.com>
      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>
      Link: http://lkml.kernel.org/n/tip-t3hl7uxmilrkigzmc90rlhk2@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      887fa86d
  7. 03 8月, 2016 2 次提交
  8. 02 8月, 2016 3 次提交
  9. 29 7月, 2016 3 次提交
  10. 28 7月, 2016 1 次提交
  11. 27 7月, 2016 1 次提交
  12. 25 7月, 2016 1 次提交
  13. 24 7月, 2016 1 次提交
    • D
      x86/insn: remove pcommit · fd1d961d
      Dan Williams 提交于
      The pcommit instruction is being deprecated in favor of either ADR
      (asynchronous DRAM refresh: flush-on-power-fail) at the platform level, or
      posted-write-queue flush addresses as defined by the ACPI 6.x NFIT (NVDIMM
      Firmware Interface Table).
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: x86@kernel.org
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Xiao Guangrong <guangrong.xiao@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Acked-by: NIngo Molnar <mingo@redhat.com>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      fd1d961d
  14. 21 7月, 2016 1 次提交
  15. 20 7月, 2016 1 次提交
  16. 19 7月, 2016 5 次提交