1. 23 9月, 2016 3 次提交
  2. 22 9月, 2016 2 次提交
  3. 21 9月, 2016 3 次提交
  4. 20 9月, 2016 4 次提交
    • A
      perf annotate: Resolve 'call' operands to function names · 5f62d4fd
      Arnaldo Carvalho de Melo 提交于
      Before this patch the '_raw_spin_lock_irqsave' and 'update_rq_clock' operands
      were appearing just as hexadecimal numbers:
      
        update_blocked_averages  /proc/kcore
             │       push   %r12
             │       push   %rbx
             │       and    $0xfffffffffffffff0,%rsp
             │       sub    $0x40,%rsp
             │       add    -0x662cac00(,%rdi,8),%rax
             │       mov    %rax,%rbx
             │       mov    %rax,%rdi
             │       mov    %rax,0x38(%rsp)
             │     → callq  _raw_spin_lock_irqsave
             │       mov    %rbx,%rdi
             │       mov    %rax,0x30(%rsp)
             │     → callq  update_rq_clock
             │       mov    0x8d0(%rbx),%rax
             │       lea    0x8d0(%rbx),%r11
      
      To check that all is right one can always use the 'o' hotkey and see
      the original objdump -dS output, that for this case is:
      
        update_blocked_averages  /proc/kcore
             │ffffffff990d5489:   push   %r12
             │ffffffff990d548b:   push   %rbx
             │ffffffff990d548c:   and    $0xfffffffffffffff0,%rsp
             │ffffffff990d5490:   sub    $0x40,%rsp
             │ffffffff990d5494:   add    -0x662cac00(,%rdi,8),%rax
             │ffffffff990d549c:   mov    %rax,%rbx
             │ffffffff990d549f:   mov    %rax,%rdi
             │ffffffff990d54a2:   mov    %rax,0x38(%rsp)
             │ffffffff990d54a7: → callq  0xffffffff997eb7a0
             │ffffffff990d54ac:   mov    %rbx,%rdi
             │ffffffff990d54af:   mov    %rax,0x30(%rsp)
             │ffffffff990d54b4: → callq  0xffffffff990c7720
             │ffffffff990d54b9:   mov    0x8d0(%rbx),%rax
             │ffffffff990d54c0:   lea    0x8d0(%rbx),%r11
      
      Use the 'h' hotkey to see a list of available hotkeys.
      
      More work needed to cover operands for other instructions, such as 'mov',
      that can resolve variable names, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-xqgtw9mzmzcjgwkis9kiiv1p@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5f62d4fd
    • A
      perf annotate: Pass the symbol's map/dso to the instruction parsers · bff5c306
      Arnaldo Carvalho de Melo 提交于
      So that things like:
      
             → callq  0xffffffff993e3230
      
      found while disassembling /proc/kcore can be beautified by later
      patches, that will resolve that address to a function, looking it up in
      /proc/kallsyms.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-p76myuke4j7gplg54amaklxk@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bff5c306
    • R
      perf annotate: Do not ignore call instruction with indirect target · 88a7fcf9
      Ravi Bangoria 提交于
      Do not ignore call instruction with indirect target when its already
      identified as a call. This is an extension of commit e8ea1561 ("perf
      annotate: Use raw form for register indirect call instructions") to
      generalize annotation for all instructions with indirect calls.
      
      This is needed for certain powerpc call instructions that use address in
      a register (such as bctrl, btarl, ...).
      
      Apart from that, when kcore is used to disassemble function, all call
      instructions were ignored. This patch will fix it as a side effect by
      not ignoring them. For example,
      
      Before (with kcore):
             mov    %r13,%rdi
             callq  0xffffffff811a7e70
           ^ jmpq   64
             mov    %gs:0x7ef41a6e(%rip),%al
      
      After (with kcore):
             mov    %r13,%rdi
           > callq  0xffffffff811a7e70
           ^ jmpq   64
             mov    %gs:0x7ef41a6e(%rip),%al
      Suggested-by: NMichael Ellerman <mpe@ellerman.id.au>
      [Suggested about 'bctrl' instruction]
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Chris Riyder <chris.ryder@arm.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Pawel Moll <pawel.moll@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Russell King <rmk+kernel@arm.linux.org.uk>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: http://lkml.kernel.org/r/1471611578-11255-5-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      88a7fcf9
    • J
      perf hists: Fix width computation for srcline sort entry · f666ac0d
      Jiri Olsa 提交于
      Adding header size to width computation for srcline sort entry,
      because it's possible to get empty data with ':0' which set width
      of 2 which is lower than width needed to display column header.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Joe Mario <jmario@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1474290610-23241-62-git-send-email-jolsa@kernel.org
      [ Added declaration to sort.h ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f666ac0d
  5. 14 9月, 2016 5 次提交
  6. 09 9月, 2016 3 次提交
    • M
      perf pmu: Support alternative sysfs cpumask · 7e3fcffe
      Mark Rutland 提交于
      The perf tools can read a cpumask file for a PMU, describing a subset of
      CPUs which that PMU covers. So far this has only been used to cater for
      uncore PMUs, which in practice happen to only have a single CPU
      described in the mask.
      
      Until recently, the perf tools only correctly handled cpumask containing
      a single CPU, and only when monitoring in system-wide mode. For example,
      prior to commit 00e727bb ("perf stat: Balance opening and
      reading events"), a mask with more than a single CPU could cause perf
      stat to hang. When a CPU PMU covers a subset of CPUs, but lacks a
      cpumask, perf record will fail to open events (on the cores the PMU does
      not support), and gives up.
      
      For systems with heterogeneous CPUs such as ARM big.LITTLE systems, this
      presents a problem. We have a PMU for each microarchitecture (e.g. a big
      PMU and a little PMU), and would like to expose a cpumask for each (so
      as to allow perf record and other tools to do the right thing). However,
      doing so kernel-side will cause old perf binaries to not function (e.g.
      hitting the issue solved by 00e727bb), and thus commits the
      cardinal sin of breaking (existing) userspace.
      
      To address this chicken-and-egg problem, this patch adds support got a
      new file, cpus, which is largely identical to the existing cpumask file.
      A kernel can expose this file, knowing that new perf binaries will
      correctly support it, while old perf binaries will not look for it (and
      thus will not be broken).
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1473330112-28528-8-git-send-email-mark.rutland@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7e3fcffe
    • M
      perf evlist: Only open events on CPUs an evsel permits · 9f21b815
      Mark Rutland 提交于
      In systems with heterogeneous CPU PMUs, it's possible for each evsel to
      cover a distinct set of CPUs, and hence the cpu_map associated with each
      evsel may have a distinct idx<->id mapping. Any of these may be distinct
      from the evlist's cpu map.
      
      Events can be tied to the same fd so long as they use the same per-cpu
      ringbuffer (i.e. so long as they are on the same CPU). To acquire the
      correct FDs, we must compare the Linux logical IDs rather than the evsel
      or evlist indices.
      
      This path adds logic to perf_evlist__mmap_per_evsel to handle this,
      translating IDs as required. As PMUs may cover a subset of CPUs from the
      evlist, we skip the CPUs a PMU cannot handle.
      
      Without this patch, perf record may try to mmap erroneous FDs on
      heterogeneous systems, and will bail out early rather than running the
      workload.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Link: http://lkml.kernel.org/r/1473330112-28528-7-git-send-email-mark.rutland@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9f21b815
    • P
      perf annotate: Add branch stack / basic block · 70fbe057
      Peter Zijlstra 提交于
      I wanted to know the hottest path through a function and figured the
      branch-stack (LBR) information should be able to help out with that.
      
      The below uses the branch-stack to create basic blocks and generate
      statistics from them.
      
              from    to              branch_i
              * ----> *
                      |
                      | block
                      v
                      * ----> *
                      from    to      branch_i+1
      
      The blocks are broken down into non-overlapping ranges, while tracking
      if the start of each range is an entry point and/or the end of a range
      is a branch.
      
      Each block iterates all ranges it covers (while splitting where required
      to exactly match the block) and increments the 'coverage' count.
      
      For the range including the branch we increment the taken counter, as
      well as the pred counter if flags.predicted.
      
      Using these number we can find if an instruction:
      
       - had coverage; given by:
      
              br->coverage / br->sym->max_coverage
      
         This metric ensures each symbol has a 100% spot, which reflects the
         observation that each symbol must have a most covered/hottest
         block.
      
       - is a branch target: br->is_target && br->start == add
      
       - for targets, how much of a branch's coverages comes from it:
      
      	target->entry / branch->coverage
      
       - is a branch: br->is_branch && br->end == addr
      
       - for branches, how often it was taken:
      
              br->taken / br->coverage
      
         after all, all execution that didn't take the branch would have
         incremented the coverage and continued onward to a later branch.
      
       - for branches, how often it was predicted:
      
              br->pred / br->taken
      
      The coverage percentage is used to color the address and asm sections;
      for low (<1%) coverage we use NORMAL (uncolored), indicating that these
      instructions are not 'important'. For high coverage (>75%) we color the
      address RED.
      
      For each branch, we add an asm comment after the instruction with
      information on how often it was taken and predicted.
      
      Output looks like (sans color, which does loose a lot of the
      information :/)
      
      $ perf record --branch-filter u,any -e cycles:p ./branches 27
      $ perf annotate branches
      
       Percent |	Source code & Disassembly of branches for cycles:pu (217 samples)
      ---------------------------------------------------------------------------------
               :	branches():
          0.00 :	  40057a:       push   %rbp
          0.00 :	  40057b:       mov    %rsp,%rbp
          0.00 :	  40057e:       sub    $0x20,%rsp
          0.00 :	  400582:       mov    %rdi,-0x18(%rbp)
          0.00 :	  400586:       mov    %rsi,-0x20(%rbp)
          0.00 :	  40058a:       mov    -0x18(%rbp),%rax
          0.00 :	  40058e:       mov    %rax,-0x10(%rbp)
          0.00 :	  400592:       movq   $0x0,-0x8(%rbp)
          0.00 :	  40059a:       jmpq   400656 <branches+0xdc>
          1.84 :	  40059f:       mov    -0x10(%rbp),%rax	# +100.00%
          3.23 :	  4005a3:       and    $0x1,%eax
          1.84 :	  4005a6:       test   %rax,%rax
          0.00 :	  4005a9:       je     4005bf <branches+0x45>	# -54.50% (p:42.00%)
          0.46 :	  4005ab:       mov    0x200bbe(%rip),%rax        # 601170 <acc>
         12.90 :	  4005b2:       add    $0x1,%rax
          2.30 :	  4005b6:       mov    %rax,0x200bb3(%rip)        # 601170 <acc>
          0.46 :	  4005bd:       jmp    4005d1 <branches+0x57>	# -100.00% (p:100.00%)
          0.92 :	  4005bf:       mov    0x200baa(%rip),%rax        # 601170 <acc>	# +49.54%
         13.82 :	  4005c6:       sub    $0x1,%rax
          0.46 :	  4005ca:       mov    %rax,0x200b9f(%rip)        # 601170 <acc>
          2.30 :	  4005d1:       mov    -0x10(%rbp),%rax	# +50.46%
          0.46 :	  4005d5:       mov    %rax,%rdi
          0.46 :	  4005d8:       callq  400526 <lfsr>	# -100.00% (p:100.00%)
          0.00 :	  4005dd:       mov    %rax,-0x10(%rbp)	# +100.00%
          0.92 :	  4005e1:       mov    -0x18(%rbp),%rax
          0.00 :	  4005e5:       and    $0x1,%eax
          0.00 :	  4005e8:       test   %rax,%rax
          0.00 :	  4005eb:       je     4005ff <branches+0x85>	# -100.00% (p:100.00%)
          0.00 :	  4005ed:       mov    0x200b7c(%rip),%rax        # 601170 <acc>
          0.00 :	  4005f4:       shr    $0x2,%rax
          0.00 :	  4005f8:       mov    %rax,0x200b71(%rip)        # 601170 <acc>
          0.00 :	  4005ff:       mov    -0x10(%rbp),%rax	# +100.00%
          7.37 :	  400603:       and    $0x1,%eax
          3.69 :	  400606:       test   %rax,%rax
          0.00 :	  400609:       jne    400612 <branches+0x98>	# -59.25% (p:42.99%)
          1.84 :	  40060b:       mov    $0x1,%eax
         14.29 :	  400610:       jmp    400617 <branches+0x9d>	# -100.00% (p:100.00%)
          1.38 :	  400612:       mov    $0x0,%eax	# +57.65%
         10.14 :	  400617:       test   %al,%al	# +42.35%
          0.00 :	  400619:       je     40062f <branches+0xb5>	# -57.65% (p:100.00%)
          0.46 :	  40061b:       mov    0x200b4e(%rip),%rax        # 601170 <acc>
          2.76 :	  400622:       sub    $0x1,%rax
          0.00 :	  400626:       mov    %rax,0x200b43(%rip)        # 601170 <acc>
          0.46 :	  40062d:       jmp    400641 <branches+0xc7>	# -100.00% (p:100.00%)
          0.92 :	  40062f:       mov    0x200b3a(%rip),%rax        # 601170 <acc>	# +56.13%
          2.30 :	  400636:       add    $0x1,%rax
          0.92 :	  40063a:       mov    %rax,0x200b2f(%rip)        # 601170 <acc>
          0.92 :	  400641:       mov    -0x10(%rbp),%rax	# +43.87%
          2.30 :	  400645:       mov    %rax,%rdi
          0.00 :	  400648:       callq  400526 <lfsr>	# -100.00% (p:100.00%)
          0.00 :	  40064d:       mov    %rax,-0x10(%rbp)	# +100.00%
          1.84 :	  400651:       addq   $0x1,-0x8(%rbp)
          0.92 :	  400656:       mov    -0x8(%rbp),%rax
          5.07 :	  40065a:       cmp    -0x20(%rbp),%rax
          0.00 :	  40065e:       jb     40059f <branches+0x25>	# -100.00% (p:100.00%)
          0.00 :	  400664:       nop
          0.00 :	  400665:       leaveq
          0.00 :	  400666:       retq
      
      (Note: the --branch-filter u,any was used to avoid spurious target and
      branch points due to interrupts/faults, they show up as very small -/+
      annotations on 'weird' locations)
      
      Committer note:
      
      Please take a look at:
      
        http://vger.kernel.org/~acme/perf/annotate_basic_blocks.png
      
      To see the colors.
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Anshuman Khandual <khandual@linux.vnet.ibm.com>
      Cc: David Carrillo-Cisneros <davidcc@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      [ Moved sym->max_coverage to 'struct annotate', aka symbol__annotate(sym) ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70fbe057
  7. 08 9月, 2016 2 次提交
  8. 05 9月, 2016 3 次提交
  9. 01 9月, 2016 10 次提交
    • R
      perf probe: Move dwarf specific functions to dwarf-aux.c · 6243b9dc
      Ravi Bangoria 提交于
      Move generic dwarf related functions from util/probe-finder.c to
      util/dwarf-aux.c. Functions name and their prototype are also changed
      accordingly. No functionality changes.
      Suggested-and-Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      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/1472546377-25612-1-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6243b9dc
    • R
      perf uprobe: Skip prologue if program compiled without optimization · e47392bf
      Ravi Bangoria 提交于
      The function prologue prepares stack and registers before executing
      function logic.
      
      When target program is compiled without optimization, function parameter
      information is only valid after the prologue.
      
      When we probe entrypc of the function, and try to record a function
      parameter, it contains a garbage value.
      
      For example:
      
        $ vim test.c
          #include <stdio.h>
      
          void foo(int i)
          {
             printf("i: %d\n", i);
          }
      
          int main()
          {
            foo(42);
            return 0;
          }
      
        $ gcc -g test.c -o test
        $ objdump -dl test | less
          foo():
          /home/ravi/test.c:4
            400536:       55                      push   %rbp
            400537:       48 89 e5                mov    %rsp,%rbp
            40053a:       48 83 ec 10             sub    -bashx10,%rsp
            40053e:       89 7d fc                mov    %edi,-0x4(%rbp)
          /home/ravi/test.c:5
            400541:       8b 45 fc                mov    -0x4(%rbp),%eax
          ...
          ...
          main():
          /home/ravi/test.c:9
            400558:       55                      push   %rbp
            400559:       48 89 e5                mov    %rsp,%rbp
          /home/ravi/test.c:10
            40055c:       bf 2a 00 00 00          mov    -bashx2a,%edi
            400561:       e8 d0 ff ff ff          callq  400536 <foo>
      
        $ perf probe -x ./test 'foo i'
        $ cat /sys/kernel/debug/tracing/uprobe_events
           p:probe_test/foo /home/ravi/test:0x0000000000000536 i=-12(%sp):s32
      
        $ perf record -e probe_test:foo ./test
        $ perf script
           test  5778 [001]  4918.562027: probe_test:foo: (400536) i=0
      
      Here variable 'i' is passed via stack which is pushed on stack at
      0x40053e. But we are probing at 0x400536.
      
      To resolve this issues, we need to probe on next instruction after
      prologue.  gdb and systemtap also does same thing. I've implemented this
      patch based on approach systemtap has used.
      
      After applying patch:
      
        $ perf probe -x ./test 'foo i'
        $ cat /sys/kernel/debug/tracing/uprobe_events
          p:probe_test/foo /home/ravi/test:0x0000000000000541 i=-4(%bp):s32
      
        $ perf record -e probe_test:foo ./test
        $ perf script
          test  6300 [001]  5877.879327: probe_test:foo: (400541) i=42
      
      No need to skip prologue for optimized case since debug info is correct
      for each instructions for -O2 -g. For more details please visit:
      
              https://bugzilla.redhat.com/show_bug.cgi?id=612253#c6
      
      Changes in v2:
      
      - Skipping prologue only when any ARG is either C variable, $params or
        $vars.
      
      - Probe on line(:1) may not be always possible. Recommend only address
        to force probe on function entry.
      
      Committer notes:
      
      Testing it with 'perf trace':
      
        # perf probe -x ./test foo i
        Added new event:
          probe_test:foo       (on foo in /home/acme/c/test with i)
      
        You can now use it in all perf tools, such as:
      
      	  perf record -e probe_test:foo -aR sleep 1
      
        # cat /sys/kernel/debug/tracing/uprobe_events
        p:probe_test/foo /home/acme/c/test:0x0000000000000526 i=-12(%sp):s32
        # trace --no-sys --event probe_*:* ./test
        i: 42
           0.000 probe_test:foo:(400526) i=0)
        #
      
      After the patch:
      
        # perf probe -d *:*
        Removed event: probe_test:foo
        # perf probe -x ./test foo i
        Target program is compiled without optimization. Skipping prologue.
        Probe on address 0x400526 to force probing at the function entry.
      
        Added new event:
          probe_test:foo       (on foo in /home/acme/c/test with i)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe_test:foo -aR sleep 1
      
        # cat /sys/kernel/debug/tracing/uprobe_events
        p:probe_test/foo /home/acme/c/test:0x0000000000000531 i=-4(%bp):s32
        # trace --no-sys --event probe_*:* ./test
        i: 42
           0.000 probe_test:foo:(400531) i=42)
        #
      Reported-by: NMichael Petlan <mpetlan@redhat.com>
      Report-Link: https://www.mail-archive.com/linux-perf-users@vger.kernel.org/msg02348.htmlSigned-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Acked-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1299021
      Link: http://lkml.kernel.org/r/1470214725-5023-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com
      [ Rename 'die' to 'cu_die' to avoid shadowing a die() definition on at least centos 5, Debian 7 and ubuntu:12.04.5]
      [ Use PRIx64 instead of lx to format a Dwarf_Addr, aka long long unsigned int, fixing the build on 32-bit systems ]
      [ dwarf_getsrclines() expects a size_t * argument ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e47392bf
    • R
      perf probe: Add helper function to check if probe with variable · b3f33f93
      Ravi Bangoria 提交于
      Introduce helper function instead of inline code and replace hardcoded
      strings "$vars" and "$params" with their corresponding macros.
      
      perf_probe_with_var() is not declared as static since it will be called
      from different file in subsequent patch.
      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: Hemant Kumar <hemant@linux.vnet.ibm.com>
      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/1470214725-5023-1-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b3f33f93
    • A
      perf symbols: Fixup symbol sizes before picking best ones · 432746f8
      Arnaldo Carvalho de Melo 提交于
      When we call symbol__fixup_duplicate() we use algorithms to pick the
      "best" symbols for cases where there are various functions/aliases to an
      address, and those check zero size symbols, which, before calling
      symbol__fixup_end() are _all_ symbols in a just parsed kallsyms file.
      
      So first fixup the end, then fixup the duplicates.
      
      Found while trying to figure out why 'perf test vmlinux' failed, see the
      output of 'perf test -v vmlinux' to see cases where the symbols picked
      as best for vmlinux don't match the ones picked for kallsyms.
      
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 694bf407 ("perf symbols: Add some heuristics for choosing the best duplicate symbol")
      Link: http://lkml.kernel.org/n/tip-rxqvdgr0mqjdxee0kf8i2ufn@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      432746f8
    • A
      perf symbols: Check symbol_conf.allow_aliases for kallsyms loading too · c97b40e4
      Arnaldo Carvalho de Melo 提交于
      We can allow aliases to be kept, but we were checking this just when
      loading vmlinux files, be consistent, do it for any symbol table loading
      code that calls symbol__fixup_duplicate() by making this function check
      .allow_aliases instead.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Fixes: 680d926a ("perf symbols: Allow symbol alias when loading map for symbol name")
      Link: http://lkml.kernel.org/n/tip-z0avp0s6cfjckc4xj3pdfjdz@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c97b40e4
    • M
      perf probe: Support probing on offline cross-arch binary · 293d5b43
      Masami Hiramatsu 提交于
      Support probing on offline cross-architecture binary by adding getting
      the target machine arch from ELF and choose correct register string for
      the machine.
      
      Here is an example:
        -----
        $ perf probe --vmlinux=./vmlinux-arm --definition 'do_sys_open $params'
        p:probe/do_sys_open do_sys_open+0 dfd=%r5:s32 filename=%r1:u32 flags=%r6:s32 mode=%r3:u16
        -----
      
      Here, we can get probe/do_sys_open from above and append it to to the target
      machine's tracing/kprobe_events file in the tracefs mountput, usually
      /sys/kernel/debug/tracing/kprobe_events (or /sys/kernel/tracing/kprobe_events).
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147214229717.23638.6440579792548044658.stgit@devbox
      [ Add definition for EM_AARCH64 to fix the build on at least centos 6, debian 7 & ubuntu 12.04.5 ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      293d5b43
    • M
      perf probe: Ignore vmlinux buildid if offline kernel is given · 428aff82
      Masami Hiramatsu 提交于
      Ignore the buildid of running kernel when both of --definition and
      --vmlinux is given because that kernel should be off-line.
      
      This also skips post-processing of kprobe event for relocating symbol
      and checking blacklist, because it can not be done on off-line kernel.
      
      E.g. without this fix perf shows an error as below
        ----
        $ perf probe --vmlinux=./vmlinux-arm --definition do_sys_open
        ./vmlinux-arm with build id 7a1f76dd56e9c4da707cd3d6333f50748141434b not found, continuing without symbols
        Failed to find symbol do_sys_open in kernel
          Error: Failed to add events.
        ----
      with this fix, we can get the definition
        ----
        $ perf probe --vmlinux=./vmlinux-arm --definition do_sys_open
        p:probe/do_sys_open do_sys_open+0
        ----
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147214228193.23638.12581984840822162131.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      428aff82
    • M
      perf probe: Show trace event definition · 1c20b1d1
      Masami Hiramatsu 提交于
      Add --definition/-D option for showing the trace-event definition in
      stdout. This can be useful in debugging or combined with a shell script.
      
      e.g.
        ----
        # perf probe --definition 'do_sys_open $params'
        p:probe/do_sys_open _text+2261728 dfd=%di:s32 filename=%si:u64 flags=%dx:s32 mode=%cx:u16
        ----
      Suggested-and-Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/147214226712.23638.2240534040014013658.stgit@devboxSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1c20b1d1
    • M
      perf symbols: Demangle symbols for synthesized @plt entries. · 2a8d41b4
      Milian Wolff 提交于
      The symbols in the synthesized @plt entries where not demangled before,
      i.e. we could end up with entries such as:
      
          $ perf report
          Samples: 7K of event 'cycles:ppp', Event count (approx.): 6223833141
          Children      Self  Command          Shared Object           Symbol
          -   93.63%    28.89%  lab_mandelbrot   lab_mandelbrot        [.] main
              - 73.81% main
                  - 33.57% hypot
                    27.76% __hypot_finite
                    15.97% __muldc3
                     2.90% __muldc3@plt
                     2.40% _ZNK6QImage6heightEv@plt
                   + 2.14% QColor::rgb
                     1.94% _ZNK6QImage5widthEv@plt
                     1.92% cabs@plt
      
      This patch remedies this issue by also applying demangling to the
      synthesized symbols. The output for the above is now:
      
          $ perf report
          Samples: 7K of event 'cycles:ppp', Event count (approx.): 6223833141
          Children      Self  Command          Shared Object           Symbol
          -   93.63%    28.89%  lab_mandelbrot   lab_mandelbrot        [.] main
              - 73.81% main
                  - 33.57% hypot
                    27.76% __hypot_finite
                    15.97% __muldc3
                     2.90% __muldc3@plt
                     2.40% QImage::height() const@plt
                   + 2.14% QColor::rgb
                     1.94% QImage::width() const@plt
                     1.92% cabs@plt
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      LPU-Reference: 20160830114102.30863-1-milian.wolff@kdab.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2a8d41b4
    • A
      perf probe: Do not use map_load filters for function · fd227598
      Arnaldo Carvalho de Melo 提交于
      It is simpler to just do the loop, no need for globals and the last user
      of such facility disappears.
      
      Testing:
      
        # perf probe -F [a-z]*recvmsg
        aead_recvmsg
        compat_SyS_recvmsg
        compat_sys_recvmsg
        hash_recvmsg
        inet_recvmsg
        kernel_recvmsg
        netlink_recvmsg
        packet_recvmsg
        ping_recvmsg
        raw_recvmsg
        rawv6_recvmsg
        rng_recvmsg
        security_socket_recvmsg
        selinux_socket_recvmsg
        skcipher_recvmsg
        sock_common_recvmsg
        sock_no_recvmsg
        sock_recvmsg
        sys_recvmsg
        tcp_recvmsg
        udp_recvmsg
        udpv6_recvmsg
        unix_dgram_recvmsg
        unix_seqpacket_recvmsg
        unix_stream_recvmsg
        #
      
      Without filters:
      
        # perf probe -F | tail -5
        zswap_pool_create
        zswap_pool_current
        zswap_update_total_size
        zswap_writeback_entry
        zswap_zpool_param_set
        #
        # perf probe -F | wc -l
        33311
        #
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      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/r/20160831130427.GA13095@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd227598
  10. 30 8月, 2016 2 次提交
  11. 24 8月, 2016 3 次提交