1. 02 3月, 2019 8 次提交
  2. 01 3月, 2019 5 次提交
    • J
      perf time-utils: Refactor time range parsing code · 284c4e18
      Jin Yao 提交于
      Jiri points out that we don't need any time checking and time string
      parsing if the --time option is not set. That makes sense.
      
      This patch refactors the time range parsing code, move the duplicated
      code from perf report and perf script to time_utils and check if --time
      option is set before parsing the time string. This patch is no logic
      change expected. So the usage of --time is same as before.
      
      For example:
      
      Select the first and second 10% time slices:
        perf report --time 10%/1,10%/2
        perf script --time 10%/1,10%/2
      
      Select the slices from 0% to 10% and from 30% to 40%:
        perf report --time 0%-10%,30%-40%
        perf script --time 0%-10%,30%-40%
      
      Select the time slices from timestamp 3971 to 3973
        perf report --time 3971,3973
        perf script --time 3971,3973
      
      Committer testing:
      
      Using the above examples, check before and after to see if it remains
      the same:
      
        $ perf record -F 10000 -- find . -name "*.[ch]" -exec cat {} + > /dev/null
        [ perf record: Woken up 3 times to write data ]
        [ perf record: Captured and wrote 1.626 MB perf.data (42392 samples) ]
        $
        $ perf report --time 10%/1,10%/2 > /tmp/report.before.1
        $ perf script --time 10%/1,10%/2 > /tmp/script.before.1
        $ perf report --time 0%-10%,30%-40% > /tmp/report.before.2
        $ perf script --time 0%-10%,30%-40% > /tmp/script.before.2
        $ perf report --time 180457.375844,180457.377717 > /tmp/report.before.3
        $ perf script --time 180457.375844,180457.377717 > /tmp/script.before.3
      
      For example, the 3rd test produces this slice:
      
        $ cat /tmp/script.before.3
              cat  3147 180457.375844:   2143 cycles:uppp:      7f79362590d9 cfree@GLIBC_2.2.5+0x9 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.375986:   2245 cycles:uppp:      558b70f3d86e [unknown] (/usr/bin/cat)
              cat  3147 180457.376012:   2164 cycles:uppp:      7f7936257430 _int_malloc+0x8c0 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.376140:   2921 cycles:uppp:      558b70f3a554 [unknown] (/usr/bin/cat)
              cat  3147 180457.376296:   2844 cycles:uppp:      7f7936258abe malloc+0x4e (/usr/lib64/libc-2.28.so)
              cat  3147 180457.376431:   2717 cycles:uppp:      558b70f3b0ca [unknown] (/usr/bin/cat)
              cat  3147 180457.376667:   2630 cycles:uppp:      558b70f3d86e [unknown] (/usr/bin/cat)
              cat  3147 180457.376795:   2442 cycles:uppp:      7f79362bff55 read+0x15 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.376927:   2376 cycles:uppp:  ffffffff9aa00163 [unknown] ([unknown])
              cat  3147 180457.376954:   2307 cycles:uppp:      7f7936257438 _int_malloc+0x8c8 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.377116:   3091 cycles:uppp:      7f7936258a70 malloc+0x0 (/usr/lib64/libc-2.28.so)
              cat  3147 180457.377362:   2945 cycles:uppp:      558b70f3a3b0 [unknown] (/usr/bin/cat)
              cat  3147 180457.377517:   2727 cycles:uppp:      558b70f3a9aa [unknown] (/usr/bin/cat)
        $
      
      Install 'coreutils-debuginfo' to see cat's guts (symbols), but then, the
      above chunk translates into this 'perf report' output:
      
        $ cat /tmp/report.before.3
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 13  of event 'cycles:uppp' (time slices: 180457.375844,180457.377717)
        # Event count (approx.): 33552
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ......................
        #
            17.69%  cat      libc-2.28.so      [.] malloc
            14.53%  cat      cat               [.] 0x000000000000586e
            13.33%  cat      libc-2.28.so      [.] _int_malloc
             8.78%  cat      cat               [.] 0x00000000000023b0
             8.71%  cat      cat               [.] 0x0000000000002554
             8.13%  cat      cat               [.] 0x00000000000029aa
             8.10%  cat      cat               [.] 0x00000000000030ca
             7.28%  cat      libc-2.28.so      [.] read
             7.08%  cat      [unknown]         [k] 0xffffffff9aa00163
             6.39%  cat      libc-2.28.so      [.] cfree@GLIBC_2.2.5
      
        #
        # (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
        #
        $
      
      Now lets see after applying this patch, nothing should change:
      
        $ perf report --time 10%/1,10%/2 > /tmp/report.after.1
        $ perf script --time 10%/1,10%/2 > /tmp/script.after.1
        $ perf report --time 0%-10%,30%-40% > /tmp/report.after.2
        $ perf script --time 0%-10%,30%-40% > /tmp/script.after.2
        $ perf report --time 180457.375844,180457.377717 > /tmp/report.after.3
        $ perf script --time 180457.375844,180457.377717 > /tmp/script.after.3
        $ diff -u /tmp/report.before.1 /tmp/report.after.1
        $ diff -u /tmp/script.before.1 /tmp/script.after.1
        $ diff -u /tmp/report.before.2 /tmp/report.after.2
        --- /tmp/report.before.2	2019-03-01 11:01:53.526094883 -0300
        +++ /tmp/report.after.2	2019-03-01 11:09:18.231770467 -0300
        @@ -352,5 +352,5 @@
      
         #
        -# (Tip: Generate a script for your data: perf script -g <lang>)
        +# (Tip: Treat branches as callchains: perf report --branch-history)
         #
        $ diff -u /tmp/script.before.2 /tmp/script.after.2
        $ diff -u /tmp/report.before.3 /tmp/report.after.3
        --- /tmp/report.before.3	2019-03-01 11:03:08.890045588 -0300
        +++ /tmp/report.after.3	2019-03-01 11:09:40.660224002 -0300
        @@ -22,5 +22,5 @@
      
         #
        -# (Tip: Order by the overhead of source file name and line number: perf report -s srcline)
        +# (Tip: List events using substring match: perf list <keyword>)
         #
        $ diff -u /tmp/script.before.3 /tmp/script.after.3
        $
      
      Cool, just the 'perf report' tips changed, QED.
      Signed-off-by: NJin Yao <yao.jin@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jin Yao <yao.jin@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1551435186-6008-1-git-send-email-yao.jin@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      284c4e18
    • G
      perf: Mark expected switch fall-through · 10c3405f
      Gustavo A. R. Silva 提交于
      In preparation to enabling -Wimplicit-fallthrough, mark switch cases
      where we are expecting to fall through.
      
      This patch fixes the following warning:
      
        kernel/events/core.c: In function ‘perf_event_parse_addr_filter’:
        kernel/events/core.c:9154:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
            kernel = 1;
            ~~~~~~~^~~
        kernel/events/core.c:9156:3: note: here
           case IF_SRC_FILEADDR:
           ^~~~
      
      Warning level 3 was used: -Wimplicit-fallthrough=3
      
      This patch is part of the ongoing efforts to enable -Wimplicit-fallthrough.
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Gustavo A. R. Silva <gustavo@embeddedor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kees Kook <keescook@chromium.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190212205430.GA8446@embeddedorSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      10c3405f
    • T
      tools lib traceevent: Fix buffer overflow in arg_eval · 7c5b019e
      Tony Jones 提交于
      Fix buffer overflow observed when running perf test.
      
      The overflow is when trying to evaluate "1ULL << (64 - 1)" which is
      resulting in -9223372036854775808 which overflows the 20 character
      buffer.
      
      If is possible this bug has been reported before but I still don't see
      any fix checked in:
      
      See: https://www.spinics.net/lists/linux-perf-users/msg07714.htmlReported-by: NMichael Sartain <mikesart@fastmail.com>
      Reported-by: NMathias Krause <minipli@googlemail.com>
      Signed-off-by: NTony Jones <tonyj@suse.de>
      Acked-by: NSteven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Fixes: f7d82350 ("tools/events: Add files to create libtraceevent.a")
      Link: http://lkml.kernel.org/r/20190228015532.8941-1-tonyj@suse.deSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7c5b019e
    • A
      perf probe: Clarify error message about not finding kernel modules debuginfo · 4d6101f5
      Arnaldo Carvalho de Melo 提交于
      'perf probe' supports using just the kernel module name, but that will
      work only when the module is loaded, or using the full pathname to the
      file with the DWARF debug info, but the warning was cryptic:
      
      Before:
      
        # perf probe -m cls_flower -L fl_change
        Failed to find the path for cls_flower: No such file or directory
          Error: Failed to show lines.
        #
      
      After:
      
        # perf probe -m cls_flower -L fl_change
        Module cls_flower is not loaded, please specify its full path name.
          Error: Failed to show lines.
        # perf probe -m /lib/modules/5.0.0-rc7+/kernel/net/sched/cls_flower.ko -L fl_change | head -7
        <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
              0  static int fl_change(struct net *net, struct sk_buff *in_skb,
               		       struct tcf_proto *tp, unsigned long base,
               		       u32 handle, struct nlattr **tca,
               		       void **arg, bool ovr, struct netlink_ext_ack *extack)
              4  {
              5  	struct cls_fl_head *head = rtnl_dereference(tp->root);
        #
      
      The behaviour doesn't change when the module is loaded:
      
        # modprobe cls_flower
        # perf probe -m cls_flower -L fl_change | head -7
        <fl_change@/home/acme/git/linux/net/sched/cls_flower.c:0>
              0  static int fl_change(struct net *net, struct sk_buff *in_skb,
                                     struct tcf_proto *tp, unsigned long base,
                                     u32 handle, struct nlattr **tca,
                                     void **arg, bool ovr, struct netlink_ext_ack *extack)
              4  {
              5         struct cls_fl_head *head = rtnl_dereference(tp->root);
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Marcelo Ricardo Leitner <mleitner@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-q4njvk9mshra00jacqjbzfn5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4d6101f5
    • S
      perf, bpf: Consider events with attr.bpf_event as side-band events · 21038f2b
      Song Liu 提交于
      Events with attr.bpf_event set should be considered as side-band events,
      as they carry information about BPF programs.
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-team@fb.com
      Cc: netdev@vger.kernel.org
      Fixes: 6ee52e2a ("perf, bpf: Introduce PERF_RECORD_BPF_EVENT")
      Link: http://lkml.kernel.org/r/20190226002019.3748539-2-songliubraving@fb.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      21038f2b
  3. 28 2月, 2019 3 次提交
    • I
      Merge tag 'perf-core-for-mingo-5.1-20190225' of... · c978b946
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo-5.1-20190225' 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:
      
      perf annotate:
      
        Wei Li:
      
        - Fix getting source line failure
      
      perf script:
      
        Andi Kleen:
      
        - Handle missing fields with -F +...
      
      perf data:
      
        Jiri Olsa:
      
        - Prep work to support per-cpu files in a directory.
      
      Intel PT:
      
        Adrian Hunter:
      
        - Improve thread_stack__no_call_return()
      
        - Hide x86 retpolines in thread stacks.
      
        - exported SQL viewer refactorings, new 'top calls' report..
      
        Alexander Shishkin:
      
        - Copy parent's address filter offsets on clone
      
        - Fix address filters for vmas with non-zero offset. Applies to
          ARM's CoreSight as well.
      
      python scripts:
      
        Tony Jones:
      
        - Python3 support for several 'perf script' python scripts.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      c978b946
    • I
      Merge tag 'perf-core-for-mingo-5.1-20190220' of... · 0a157124
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo-5.1-20190220' 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:
      
      perf report:
      
        He Kuang:
      
        - Don't shadow inlined symbol with different addr range.
      
      perf script:
      
        Jiri Olsa:
      
        - Allow +- operator to ask for -F to add/remove fields to
          the default set, for instance to ask for the removal of the
          'cpu' field in tracepoint events, adding 'period' to that
          kind of events, etc.
      
      perf test:
      
        Thomas Richter:
      
        - Fix scheduler tracepoint signedness of COMM fields failure of
          'evsel-tp-sched' test on s390 and other arches.
      
        Tommi Rantala:
      
        - Skip trace+probe_vfs_getname.sh when 'perf trace' is not built.
      
      perf trace:
      
        Arnaldo Carvalho de Melo:
      
        - Add initial BPF map dumper, initially just for the current, minimal
          needs of the augmented_raw_syscalls BPF example used to collect
          pointer args payloads that uses BPF maps for pid and syscall filtering,
          but will in time have features similar to 'perf stat' --interval-print,
          --interval-clear, ways to signal from a BPF event that a specific
          map (or range of that map) should be printed, optionally as a
          histogram, etc.
      
      General:
      
        Jiri Olsa:
      
        - Add CPU and NUMA topologies classes for further reuse, fixing some
          issues in the process.
      
        - Fixup some warnings and debug levels.
      
        - Make rm_rf() remove single file, not just directories.
      
      Documentation:
      
        Jonas Rabenstein:
      
        - Fix HEADER_CMDLINE description in perf.data documentation.
      
        - Fix documentation of the Flags section in perf.data.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      0a157124
    • I
      Merge branch 'linus' into perf/core, to pick up fixes · 9ed8f1a6
      Ingo Molnar 提交于
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      9ed8f1a6
  4. 26 2月, 2019 13 次提交
  5. 25 2月, 2019 11 次提交