1. 23 Mar, 2017 1 commit
    • Andi Kleen's avatar
      perf tools: Add a simple expression parser for JSON · 07516736
      Andi Kleen authored
      Add a simple expression parser good enough to parse JSON relation
      expressions. The parser is implemented using bison.
      
      This is just intended as an simple parser for internal usage in the
      event lists, not the beginning of a "perf scripting language"
      
      v2: Use expr__ prefix instead of expr_
          Support multiple free variables for parser
      
      Committer note:
      
      The v2 patch had:
      
        %define api.pure full
      
      In expr.y, that is a feature introduced in bison 2.7, to have reentrant
      parsers, not using global variables, which would make tools/perf stop
      building with the bison version shipped in older distros, so Andi
      realised that the other parsers (e.g. parse-events.y) were using:
      
        %pure-parser
      
      Which is present in older versions of bison and fits the bill.
      
      I added:
      
        CFLAGS_expr-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
      
      To finally make it build, copying what was there for pmu-bison.o,
      another parser.
      Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Link: http://lkml.kernel.org/r/20170320201711.14142-8-andi@firstfloor.org
      [ stdlib.h is needed in tests/expr.c for free() fixing build in systems such as ubuntu:16.04-x-s390 ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      07516736
  2. 21 Mar, 2017 14 commits
  3. 20 Mar, 2017 4 commits
  4. 17 Mar, 2017 7 commits
  5. 16 Mar, 2017 9 commits
  6. 15 Mar, 2017 5 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 69eea5a4
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "Four small fixes for this cycle:
      
         - followup fix from Neil for a fix that went in before -rc2, ensuring
           that we always see the full per-task bio_list.
      
         - fix for blk-mq-sched from me that ensures that we retain similar
           direct-to-issue behavior on running the queue.
      
         - fix from Sagi fixing a potential NULL pointer dereference in blk-mq
           on spurious CPU unplug.
      
         - a memory leak fix in writeback from Tahsin, fixing a case where
           device removal of a mounted device can leak a struct
           wb_writeback_work"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        blk-mq-sched: don't run the queue async from blk_mq_try_issue_directly()
        writeback: fix memory leak in wb_queue_work()
        blk-mq: Fix tagset reinit in the presence of cpu hot-unplug
        blk: Ensure users for current->bio_list can see the full list.
      69eea5a4
    • Stephane Eranian's avatar
      perf tools: Make perf_event__synthesize_mmap_events() scale · 88b897a3
      Stephane Eranian authored
      This patch significantly improves the execution time of
      perf_event__synthesize_mmap_events() when running perf record on systems
      where processes have lots of threads.
      
      It just happens that cat /proc/pid/maps support uses a O(N^2) algorithm to
      generate each map line in the maps file.  If you have 1000 threads, then you
      have necessarily 1000 stacks.  For each vma, you need to check if it
      corresponds to a thread's stack.  With a large number of threads, this can take
      a very long time. I have seen latencies >> 10mn.
      
      As of today, perf does not use the fact that a mapping is a stack, therefore we
      can work around the issue by using /proc/pid/tasks/pid/maps.  This entry does
      not try to map a vma to stack and is thus much faster with no loss of
      functonality.
      
      The proc-map-timeout logic is kept in case users still want some upper limit.
      
      In V2, we fix the file path from /proc/pid/tasks/pid/maps to actual
      /proc/pid/task/pid/maps, tasks -> task.  Thanks Arnaldo for catching this.
      
      Committer note:
      
      This problem seems to have been elliminated in the kernel since commit :
      b18cb64e ("fs/proc: Stop trying to report thread stacks").
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20170315135059.GC2177@redhat.com
      Link: http://lkml.kernel.org/r/1489598233-25586-1-git-send-email-eranian@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      88b897a3
    • Naveen N. Rao's avatar
      trace/kprobes: Fix check for kretprobe offset within function entry · 1d585e70
      Naveen N. Rao authored
      perf specifies an offset from _text and since this offset is fed
      directly into the arch-specific helper, kprobes tracer rejects
      installation of kretprobes through perf. Fix this by looking up the
      actual offset from a function for the specified sym+offset.
      
      Refactor and reuse existing routines to limit code duplication -- we
      repurpose kprobe_addr() for determining final kprobe address and we
      split out the function entry offset determination into a separate
      generic helper.
      
      Before patch:
      
        naveen@ubuntu:~/linux/tools/perf$ sudo ./perf probe -v do_open%return
        probe-definition(0): do_open%return
        symbol:do_open file:(null) line:0 offset:0 return:1 lazy:(null)
        0 arguments
        Looking at the vmlinux_path (8 entries long)
        Using /boot/vmlinux for symbols
        Open Debuginfo file: /boot/vmlinux
        Try to find probe point from debuginfo.
        Matched function: do_open [2d0c7ff]
        Probe point found: do_open+0
        Matched function: do_open [35d76dc]
        found inline addr: 0xc0000000004ba9c4
        Failed to find "do_open%return",
         because do_open is an inlined function and has no return point.
        An error occurred in debuginfo analysis (-22).
        Trying to use symbols.
        Opening /sys/kernel/debug/tracing//README write=0
        Opening /sys/kernel/debug/tracing//kprobe_events write=1
        Writing event: r:probe/do_open _text+4469776
        Failed to write event: Invalid argument
          Error: Failed to add events. Reason: Invalid argument (Code: -22)
        naveen@ubuntu:~/linux/tools/perf$ dmesg | tail
        <snip>
        [   33.568656] Given offset is not valid for return probe.
      
      After patch:
      
        naveen@ubuntu:~/linux/tools/perf$ sudo ./perf probe -v do_open%return
        probe-definition(0): do_open%return
        symbol:do_open file:(null) line:0 offset:0 return:1 lazy:(null)
        0 arguments
        Looking at the vmlinux_path (8 entries long)
        Using /boot/vmlinux for symbols
        Open Debuginfo file: /boot/vmlinux
        Try to find probe point from debuginfo.
        Matched function: do_open [2d0c7d6]
        Probe point found: do_open+0
        Matched function: do_open [35d76b3]
        found inline addr: 0xc0000000004ba9e4
        Failed to find "do_open%return",
         because do_open is an inlined function and has no return point.
        An error occurred in debuginfo analysis (-22).
        Trying to use symbols.
        Opening /sys/kernel/debug/tracing//README write=0
        Opening /sys/kernel/debug/tracing//kprobe_events write=1
        Writing event: r:probe/do_open _text+4469808
        Writing event: r:probe/do_open_1 _text+4956344
        Added new events:
          probe:do_open        (on do_open%return)
          probe:do_open_1      (on do_open%return)
      
        You can now use it in all perf tools, such as:
      
      	  perf record -e probe:do_open_1 -aR sleep 1
      
        naveen@ubuntu:~/linux/tools/perf$ sudo cat /sys/kernel/debug/kprobes/list
        c000000000041370  k  kretprobe_trampoline+0x0    [OPTIMIZED]
        c0000000004ba0b8  r  do_open+0x8    [DISABLED]
        c000000000443430  r  do_open+0x0    [DISABLED]
      Signed-off-by: default avatarNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: linuxppc-dev@lists.ozlabs.org
      Link: http://lkml.kernel.org/r/d8cd1ef420ec22e3643ac332fdabcffc77319a42.1488961018.git.naveen.n.rao@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1d585e70
    • Ravi Bangoria's avatar
      perf probe: Introduce util func is_sdt_event() · af9100ad
      Ravi Bangoria authored
      Factor out the SDT event name checking routine as is_sdt_event().
      Signed-off-by: default avatarRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170314150658.7065-2-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      af9100ad
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-4.12-20170314' of... · ffa86c2f
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-4.12-20170314' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      New features:
      
      - Add PERF_RECORD_NAMESPACES so that the kernel can record information
        required to associate samples to namespaces, helping in container
        problem characterization.
      
        Now the 'perf record has a --namespace' option to ask for such info,
        and when present, it can be used, initially, via a new sort order,
        'cgroup_id', allowing histogram entry bucketization by a (device, inode)
        based cgroup identifier (Hari Bathini)
      
      - Add --next option to 'perf sched timehist', showing what is the next
        thread to run (Brendan Gregg)
      
      Fixes:
      
      - Fix segfault with basic block 'cycles' sort dimension (Changbin Du)
      
      - Add c2c to command-list.txt, making it appear in the 'perf help'
        output (Changbin Du)
      
      - Fix zeroing of 'abs_path' variable in the perf hists browser switch
        file code (Changbin Du)
      
      - Hide tips messages when -q/--quiet is given to 'perf report' (Namhyung Kim)
      
      Infrastructure changes:
      
      - Use ref_reloc_sym + offset to setup kretprobes (Naveen Rao)
      
      - Ignore generated files pmu-events/{jevents,pmu-events.c} for git (Changbin Du)
      
      Documentation changes:
      
      - Document +field style argument support for --field option (Changbin Du)
      
      - Clarify 'perf c2c --stats' help message (Namhyung Kim)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      ffa86c2f