1. 30 8月, 2019 4 次提交
  2. 29 8月, 2019 3 次提交
  3. 27 8月, 2019 3 次提交
  4. 20 8月, 2019 1 次提交
    • A
      perf report: Dump LBR callstack data by -D jointly with thread stack · d2720c3d
      Alexey Budankov 提交于
      Make perf report -D command print captured LBR callstack chain when it is
      collected together with raw thread stack data:
      
        2752673087247083 0x5d10 [0x548]: PERF_RECORD_SAMPLE(IP, 0x4002): 5841/5841: 0x40121f period: 1543862 addr: 0
        ... FP chain: nr:0
        ... branch callstack: nr:3
        .....  0: 00000000004011d0
        .....  1: 00007f393c388411
        .....  2: 0000000000401098
        ... user regs: mask 0xff0fff ABI 64-bit
        .... AX    0x34e7
        .... BX    0x7fff5f6dd3c0
        .... CX    0xffffffff
        .... DX    0x34e6
        .... SI    0x7f393c5268d0
        .... DI    0x0
        .... BP    0x401260
        .... SP    0x7fff5f6dd3c0
        .... IP    0x40121f
        .... FLAGS 0x29f
        .... CS    0x33
        .... SS    0x2b
        .... R8    0x7f393c526800
        .... R9    0x7f393c525da0
        .... R10   0xfffffffffffff70a
        .... R11   0x246
        .... R12   0x401070
        .... R13   0x7fff5f6ddcb0
        .... R14   0x0
        .... R15   0x0
        ... ustack: size 1024, offset 0x130
         . data_src: 0x5080021
         ... thread: stack_test:5841
         ...... dso: /root/abudanko/stacks/stack_test
      
      Committer testing:
      
        # perf record -g --call-graph dwarf,1024 -j stack,u ls > /dev/null
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.042 MB perf.data (10 samples) ]
        #
      
      Before:
      
        # perf report -D |& grep PERF_RECORD_SAMPLE -A28 | tail -29
        67538909824483 0xa7a0 [0x560]: PERF_RECORD_SAMPLE(IP, 0x4002): 9721/9721: 0x7f441b2b1e20 period: 1376095 addr: 0
        ... FP chain: nr:0
        ... user regs: mask 0xff0fff ABI 64-bit
        .... AX    0x7f441b2b1000
        .... BX    0x7f441b55b970
        .... CX    0x7fff6e2db218
        .... DX    0x7fff6e2db218
        .... SI    0x7fff6e2db208
        .... DI    0x1
        .... BP    0x1
        .... SP    0x7fff6e2db178
        .... IP    0x7f441b2b1e20
        .... FLAGS 0x20a
        .... CS    0x33
        .... SS    0x2b
        .... R8    0x1
        .... R9    0x7f441b371c18
        .... R10   0x7f441b5a5f10
        .... R11   0x202
        .... R12   0x7fff6e2db208
        .... R13   0x7fff6e2db218
        .... R14   0x7f441b5a7150
        .... R15   0x0
        ... ustack: size 1024, offset 0x148
         . data_src: 0x5080021
         ... thread: ls:9721
         ...... dso: /usr/lib64/libpthread-2.29.so
      
        0xad00 [0x60]: event: 10
        #
      
      After:
      
        # perf report -D |& grep PERF_RECORD_SAMPLE -A31 | tail -32
        67538909824483 0xa7a0 [0x560]: PERF_RECORD_SAMPLE(IP, 0x4002): 9721/9721: 0x7f441b2b1e20 period: 1376095 addr: 0
        ... FP chain: nr:0
        ... branch callstack: nr:4
        .....  0: 00007f441b2b1e20
        .....  1: 00007f441b58af1a
        .....  2: 00007f441b58b0e1
        .....  3: 00007f441b57c145
        ... user regs: mask 0xff0fff ABI 64-bit
        .... AX    0x7f441b2b1000
        .... BX    0x7f441b55b970
        .... CX    0x7fff6e2db218
        .... DX    0x7fff6e2db218
        .... SI    0x7fff6e2db208
        .... DI    0x1
        .... BP    0x1
        .... SP    0x7fff6e2db178
        .... IP    0x7f441b2b1e20
        .... FLAGS 0x20a
        .... CS    0x33
        .... SS    0x2b
        .... R8    0x1
        .... R9    0x7f441b371c18
        .... R10   0x7f441b5a5f10
        .... R11   0x202
        .... R12   0x7fff6e2db208
        .... R13   0x7fff6e2db218
        .... R14   0x7f441b5a7150
        .... R15   0x0
        ... ustack: size 1024, offset 0x148
         . data_src: 0x5080021
         ... thread: ls:9721
         ...... dso: /usr/lib64/libpthread-2.29.so
        #
      Signed-off-by: NAlexey Budankov <alexey.budankov@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@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/aa82e5dd-def2-0ca8-a064-db9e2e8ad076@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d2720c3d
  5. 13 8月, 2019 1 次提交
  6. 30 7月, 2019 6 次提交
  7. 23 7月, 2019 1 次提交
  8. 09 7月, 2019 3 次提交
  9. 28 5月, 2019 1 次提交
  10. 16 5月, 2019 2 次提交
    • A
      perf report: Implement perf.data record decompression · cb62c6f1
      Alexey Budankov 提交于
      zstd_init(, comp_level = 0) initializes decompression part of API only
      hat now consists of zstd_decompress_stream() function.
      
      The perf.data PERF_RECORD_COMPRESSED records are decompressed using
      zstd_decompress_stream() function into a linked list of mmaped memory
      regions of mmap_comp_len size (struct decomp).
      
      After decompression of one COMPRESSED record its content is iterated and
      fetched for usual processing. The mmaped memory regions with
      decompressed events are kept in the linked list till the tool process
      termination.
      
      When dumping raw records (e.g., perf report -D --header) file offsets of
      events from compressed records are printed as zero.
      
      Committer notes:
      
      Since now we have support for processing PERF_RECORD_COMPRESSED, we see
      none, in raw form, like we saw in the previous patch commiter notes,
      they were decompressed into the usual PERF_RECORD_{FORK,MMAP,COMM,etc}
      records, we only see the stats for those PERF_RECORD_COMPRESSED events,
      and since I used the file generated in the commiter notes for the
      previous patch, there they are, 2 compressed records:
      
        $ perf report --header-only | grep cmdline
        # cmdline : /home/acme/bin/perf record -z2 sleep 1
        $ perf report -D | grep COMPRESS
              COMPRESSED events:          2
              COMPRESSED events:          0
        $ perf report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        #
        # Total Lost Samples: 0
        #
        # Samples: 15  of event 'cycles:u'
        # Event count (approx.): 962227
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ...........................
        #
            46.99%  sleep    libc-2.28.so      [.] _dl_addr
            29.24%  sleep    [unknown]         [k] 0xffffffffaea00a67
            16.45%  sleep    libc-2.28.so      [.] __GI__IO_un_link.part.1
             5.92%  sleep    ld-2.28.so        [.] _dl_setup_hash
             1.40%  sleep    libc-2.28.so      [.] __nanosleep
             0.00%  sleep    [unknown]         [k] 0xffffffffaea00163
      
        #
        # (Tip: To see callchains in a more compact form: perf report -g folded)
        #
        $
      Signed-off-by: NAlexey Budankov <alexey.budankov@linux.intel.com>
      Reviewed-by: NJiri Olsa <jolsa@kernel.org>
      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: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/304b0a59-942c-3fe1-da02-aa749f87108b@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cb62c6f1
    • A
      perf report: Add stub processing of compressed events for -D · 61a7773c
      Alexey Budankov 提交于
      Committer note:
      
      Split from a larger patch, this only dumps PERF_RECORD_COMPRESSED as
      unhandled, so that when we introduce the record part in the next patch,
      we don't see unhandled events when using 'perf record -D'.
      
      Changed it so that we dump the event if the handler is just a stub, i.e.
      for the case where we don't have ZSTD linked but we're processing a
      perf.data file generated by a tool with that linked.
      
      Also when failing to decompress we can't just dump the uncompressed
      event and return 0, we have to propagate the error.
      Signed-off-by: NAlexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/304b0a59-942c-3fe1-da02-aa749f87108b@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      61a7773c
  11. 03 5月, 2019 1 次提交
    • T
      perf report: Report OOM in status line in the GTK UI · 167e418f
      Thomas Richter 提交于
      An -ENOMEM error is not reported in the GTK GUI.  Instead this error
      message pops up on the screen:
      
      [root@m35lp76 perf]# ./perf  report -i perf.data.error68-1
      
      	Processing events... [974K/3M]
      	Error:failed to process sample
      
      	0xf4198 [0x8]: failed to process type: 68
      
      However when I use the same perf.data file with --stdio it works:
      
      [root@m35lp76 perf]# ./perf  report -i perf.data.error68-1 --stdio \
      		| head -12
      
        # Total Lost Samples: 0
        #
        # Samples: 76K of event 'cycles'
        # Event count (approx.): 99056160000
        #
        # Overhead  Command          Shared Object      Symbol
        # ........  ...............  .................  .........
        #
           8.81%  find             [kernel.kallsyms]  [k] ftrace_likely_update
           8.74%  swapper          [kernel.kallsyms]  [k] ftrace_likely_update
           8.34%  sshd             [kernel.kallsyms]  [k] ftrace_likely_update
           2.19%  kworker/u512:1-  [kernel.kallsyms]  [k] ftrace_likely_update
      
      The sample precentage is a bit low.....
      
      The GUI always fails in the FINISHED_ROUND event (68) and does not
      indicate the reason why.
      
      When happened is the following. Perf report calls a lot of functions and
      down deep when a FINISHED_ROUND event is processed, these functions are
      called:
      
        perf_session__process_event()
        + perf_session__process_user_event()
          + process_finished_round()
            + ordered_events__flush()
              + __ordered_events__flush()
      	  + do_flush()
      	    + ordered_events__deliver_event()
      	      + perf_session__deliver_event()
      	        + machine__deliver_event()
      	          + perf_evlist__deliver_event()
      	            + process_sample_event()
      	              + hist_entry_iter_add() --> only called in GUI case!!!
      	                + hist_iter__report__callback()
      	                  + symbol__inc_addr_sample()
      
      	                    Now this functions runs out of memory and
      			    returns -ENOMEM. This is reported all the way up
      			    until function
      
      perf_session__process_event() returns to its caller, where -ENOMEM is
      changed to -EINVAL and processing stops:
      
       if ((skip = perf_session__process_event(session, event, head)) < 0) {
            pr_err("%#" PRIx64 " [%#x]: failed to process type: %d\n",
      	     head, event->header.size, event->header.type);
            err = -EINVAL;
            goto out_err;
       }
      
      This occurred in the FINISHED_ROUND event when it has to process some
      10000 entries and ran out of memory.
      
      This patch indicates the root cause and displays it in the status line
      of ther perf report GUI.
      
      Output before (on GUI status line):
      
        0xf4198 [0x8]: failed to process type: 68
      
      Output after:
      
        0xf4198 [0x8]: failed to process type: 68 [not enough memory]
      
      Committer notes:
      
      the 'skip' variable needs to be initialized to -EINVAL, so that when the
      size is less than sizeof(struct perf_event_attr) we avoid this valid
      compiler warning:
      
        util/session.c: In function ‘perf_session__process_events’:
        util/session.c:1936:7: error: ‘skip’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
           err = skip;
           ~~~~^~~~~~
        util/session.c:1874:6: note: ‘skip’ was declared here
          s64 skip;
              ^~~~
        cc1: all warnings being treated as errors
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: NHendrik Brueckner <brueckner@linux.ibm.com>
      Reviewed-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Link: http://lkml.kernel.org/r/20190423105303.61683-1-tmricht@linux.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      167e418f
  12. 20 3月, 2019 1 次提交
    • S
      perf bpf: Save bpf_prog_info in a rbtree in perf_env · e4378f0c
      Song Liu 提交于
      bpf_prog_info contains information necessary to annotate bpf programs.
      
      This patch saves bpf_prog_info for bpf programs loaded in the system.
      
      Some big picture of the next few patches:
      
      To fully annotate BPF programs with source code mapping, 4 different
      informations are needed:
      
          1) PERF_RECORD_KSYMBOL
          2) PERF_RECORD_BPF_EVENT
          3) bpf_prog_info
          4) btf
      
      Before this set, 1) and 2) in the list are already saved to perf.data
      file. For BPF programs that are already loaded before perf run, 1) and 2)
      are synthesized by perf_event__synthesize_bpf_events(). For short living
      BPF programs, 1) and 2) are generated by kernel.
      
      This set handles 3) and 4) from the list. Again, it is necessary to handle
      existing BPF program and short living program separately.
      
      This patch handles 3) for exising BPF programs while synthesizing 1) and
      2) in perf_event__synthesize_bpf_events(). These data are stored in
      perf_env. The next patch saves these data from perf_env to perf.data as
      headers.
      
      Similarly, the two patches after the next saves 4) of existing BPF
      programs to perf_env and perf.data.
      
      Another patch later will handle 3) and 4) for short living BPF programs
      by monitoring 1) and 2) in a dedicate thread.
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Reviewed-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stanislav Fomichev <sdf@google.com>
      Cc: kernel-team@fb.com
      Link: http://lkml.kernel.org/r/20190312053051.2690567-7-songliubraving@fb.com
      [ set env->bpf_progs.infos_cnt to zero in perf_env__purge_bpf() as noted by jolsa ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e4378f0c
  13. 11 3月, 2019 2 次提交
  14. 07 3月, 2019 1 次提交
    • J
      perf session: Fix double free in perf_data__close · befa09b6
      Jiri Olsa 提交于
      We can't call perf_data__close and subsequently perf_session__delete,
      because it will call perf_data__close again and cause double free for
      data->file.path.
      
        $ perf report -i .
        incompatible file format (rerun with -v to learn more)
        free(): double free detected in tcache 2
        Aborted (core dumped)
      
      In fact we don't need to call perf_data__close at all, because at the
      time the got out_close is reached, session->data is already initialized,
      so the perf_data__close call will be triggered from
      perf_session__delete.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de>
      Cc: Nageswara R Sastry <nasastry@in.ibm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
      Fixes: 2d4f2799 ("perf data: Add global path holder")
      Link: http://lkml.kernel.org/r/20190305152536.21035-8-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      befa09b6
  15. 21 2月, 2019 1 次提交
  16. 06 2月, 2019 3 次提交
  17. 22 1月, 2019 6 次提交
    • S
      perf tools: Handle PERF_RECORD_BPF_EVENT · 45178a92
      Song Liu 提交于
      This patch adds basic handling of PERF_RECORD_BPF_EVENT.  Tracking of
      PERF_RECORD_BPF_EVENT is OFF by default. Option --bpf-event is added to
      turn it on.
      
      Committer notes:
      
      Add dummy machine__process_bpf_event() variant that returns zero for
      systems without HAVE_LIBBPF_SUPPORT, such as Alpine Linux, unbreaking
      the build in such systems.
      
      Remove the needless include <machine.h> from bpf->event.h, provide just
      forward declarations for the structs and unions in the parameters, to
      reduce compilation time and needless rebuilds when machine.h gets
      changed.
      
      Committer testing:
      
      When running with:
      
       # perf record --bpf-event
      
      On an older kernel where PERF_RECORD_BPF_EVENT and PERF_RECORD_KSYMBOL
      is not present, we fallback to removing those two bits from
      perf_event_attr, making the tool to continue to work on older kernels:
      
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|PERIOD
          read_format                      ID
          disabled                         1
          inherit                          1
          mmap                             1
          comm                             1
          freq                             1
          enable_on_exec                   1
          task                             1
          precise_ip                       3
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
          ksymbol                          1
          bpf_event                        1
        ------------------------------------------------------------
        sys_perf_event_open: pid 5779  cpu 0  group_fd -1  flags 0x8
        sys_perf_event_open failed, error -22
        switching off bpf_event
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|PERIOD
          read_format                      ID
          disabled                         1
          inherit                          1
          mmap                             1
          comm                             1
          freq                             1
          enable_on_exec                   1
          task                             1
          precise_ip                       3
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
          ksymbol                          1
        ------------------------------------------------------------
        sys_perf_event_open: pid 5779  cpu 0  group_fd -1  flags 0x8
        sys_perf_event_open failed, error -22
        switching off ksymbol
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|PERIOD
          read_format                      ID
          disabled                         1
          inherit                          1
          mmap                             1
          comm                             1
          freq                             1
          enable_on_exec                   1
          task                             1
          precise_ip                       3
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
        ------------------------------------------------------------
      
      And then proceeds to work without those two features.
      
      As passing --bpf-event is an explicit action performed by the user, perhaps we
      should emit a warning telling that the kernel has no such feature, but this can
      be done on top of this patch.
      
      Now with a kernel that supports these events, start the 'record --bpf-event -a'
      and then run 'perf trace sleep 10000' that will use the BPF
      augmented_raw_syscalls.o prebuilt (for another kernel version even) and thus
      should generate PERF_RECORD_BPF_EVENT events:
      
        [root@quaco ~]# perf record -e dummy -a --bpf-event
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.713 MB perf.data ]
      
        [root@quaco ~]# bpftool prog
        13: cgroup_skb  tag 7be49e3934a125ba  gpl
        	loaded_at 2019-01-19T09:09:43-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 13,14
        14: cgroup_skb  tag 2a142ef67aaad174  gpl
        	loaded_at 2019-01-19T09:09:43-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 13,14
        15: cgroup_skb  tag 7be49e3934a125ba  gpl
        	loaded_at 2019-01-19T09:09:43-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 15,16
        16: cgroup_skb  tag 2a142ef67aaad174  gpl
        	loaded_at 2019-01-19T09:09:43-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 15,16
        17: cgroup_skb  tag 7be49e3934a125ba  gpl
        	loaded_at 2019-01-19T09:09:44-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 17,18
        18: cgroup_skb  tag 2a142ef67aaad174  gpl
        	loaded_at 2019-01-19T09:09:44-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 17,18
        21: cgroup_skb  tag 7be49e3934a125ba  gpl
        	loaded_at 2019-01-19T09:09:45-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 21,22
        22: cgroup_skb  tag 2a142ef67aaad174  gpl
        	loaded_at 2019-01-19T09:09:45-0300  uid 0
        	xlated 296B  jited 229B  memlock 4096B  map_ids 21,22
        31: tracepoint  name sys_enter  tag 12504ba9402f952f  gpl
        	loaded_at 2019-01-19T09:19:56-0300  uid 0
        	xlated 512B  jited 374B  memlock 4096B  map_ids 30,29,28
        32: tracepoint  name sys_exit  tag c1bd85c092d6e4aa  gpl
        	loaded_at 2019-01-19T09:19:56-0300  uid 0
        	xlated 256B  jited 191B  memlock 4096B  map_ids 30,29
        # perf report -D | grep PERF_RECORD_BPF_EVENT | nl
           1	0 55834574849 0x4fc8 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 13
           2	0 60129542145 0x5118 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 14
           3	0 64424509441 0x5268 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 15
           4	0 68719476737 0x53b8 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 16
           5	0 73014444033 0x5508 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 17
           6	0 77309411329 0x5658 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 18
           7	0 90194313217 0x57a8 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 21
           8	0 94489280513 0x58f8 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 22
           9	7 620922484360 0xb6390 [0x30]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 29
          10	7 620922486018 0xb6410 [0x30]: PERF_RECORD_BPF_EVENT bpf event with type 2, flags 0, id 29
          11	7 620922579199 0xb6490 [0x30]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 30
          12	7 620922580240 0xb6510 [0x30]: PERF_RECORD_BPF_EVENT bpf event with type 2, flags 0, id 30
          13	7 620922765207 0xb6598 [0x30]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 31
          14	7 620922874543 0xb6620 [0x30]: PERF_RECORD_BPF_EVENT bpf event with type 1, flags 0, id 32
        #
      
      There, the 31 and 32 tracepoint BPF programs put in place by 'perf trace'.
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Reviewed-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-team@fb.com
      Cc: netdev@vger.kernel.org
      Link: http://lkml.kernel.org/r/20190117161521.1341602-7-songliubraving@fb.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      45178a92
    • S
      perf tools: Handle PERF_RECORD_KSYMBOL · 9aa0bfa3
      Song Liu 提交于
      This patch handles PERF_RECORD_KSYMBOL in perf record/report.
      Specifically, map and symbol are created for ksymbol register, and
      removed for ksymbol unregister.
      
      This patch also sets perf_event_attr.ksymbol properly. The flag is ON by
      default.
      
      Committer notes:
      
      Use proper inttypes.h for u64, fixing the build in some environments
      like in the android NDK r15c targetting ARM 32-bit.
      
      I.e. fixing this build error:
      
        util/event.c: In function 'perf_event__fprintf_ksymbol':
        util/event.c:1489:10: error: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'u64' [-Werror=format=]
                  event->ksymbol_event.flags, event->ksymbol_event.name);
                  ^
        cc1: all warnings being treated as errors
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Reviewed-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-team@fb.com
      Cc: netdev@vger.kernel.org
      Link: http://lkml.kernel.org/r/20190117161521.1341602-6-songliubraving@fb.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9aa0bfa3
    • T
      perf report: Display arch specific diagnostic counter sets, starting with s390 · 93115d32
      Thomas Richter 提交于
      On s390 the event bc000 (also named CF_DIAG) extracts the CPU
      Measurement Facility diagnostic counter sets and displays them as
      counter number and counter value pairs sorted by counter set number.
      
      Output:
       [root@s35lp76 perf]# ./perf report -D --stdio
      
       [00000000] Counterset:0 Counters:6
         Counter:000 Value:0x000000000085ec36 Counter:001 Value:0x0000000000796c94
         Counter:002 Value:0x0000000000005ada Counter:003 Value:0x0000000000092460
         Counter:004 Value:0x0000000000006073 Counter:005 Value:0x00000000001a9a73
       [0x000038] Counterset:1 Counters:2
         Counter:000 Value:0x000000000007c59f Counter:001 Value:0x000000000002fad6
       [0x000050] Counterset:2 Counters:16
         Counter:000 Value:000000000000000000 Counter:001 Value:000000000000000000
         Counter:002 Value:000000000000000000 Counter:003 Value:000000000000000000
         Counter:004 Value:000000000000000000 Counter:005 Value:000000000000000000
         Counter:006 Value:000000000000000000 Counter:007 Value:000000000000000000
         Counter:008 Value:000000000000000000 Counter:009 Value:000000000000000000
         Counter:010 Value:000000000000000000 Counter:011 Value:000000000000000000
         Counter:012 Value:000000000000000000 Counter:013 Value:000000000000000000
         Counter:014 Value:000000000000000000 Counter:015 Value:000000000000000000
       [0x0000d8] Counterset:3 Counters:128
         Counter:000 Value:0x000000000000020f Counter:001 Value:0x00000000000001d8
         Counter:002 Value:0x000000000000d7fa Counter:003 Value:0x000000000000008b
         ...
      
      The number in brackets is the offset into the raw data field of the
      sample.
      
      New functions trace_event_sample_raw__init() and s390_sample_raw() are
      introduced in the code path to enable interpretation on non s390
      platforms. This event bc000 attached raw data is generated only on s390
      platform. Correct display on other platforms requires correct endianness
      handling.
      
      Committer notes:
      
      Added a init function that sets up a evlist function pointer to avoid
      repeated tests on evlist->env and calls to perf_env__name() that
      involves normalizing, etc, for each PERF_RECORD_SAMPLE.
      
      Removed needless __maybe_unused from the trace_event_raw()
      prototype in session.h, move it to be an static function in evlist.
      
      The 'offset' variable is a size_t, not an u64, fix it to avoid this on
      some arches:
      
          CC       /tmp/build/perf/util/s390-sample-raw.o
        util/s390-sample-raw.c: In function 's390_cpumcfdg_testctr':
        util/s390-sample-raw.c:77:4: error: format '%llx' expects argument of type 'long long unsigned int', but argument 4 has type 'size_t' [-Werror=format=]
            pr_err("Invalid counter set entry at %#"  PRIx64 "\n",
            ^
        cc1: all warnings being treated as errors
      Signed-off-by: NThomas Richter <tmricht@linux.ibm.com>
      Reviewed-by: NHendrik Brueckner <brueckner@linux.ibm.com>
      Link: https://lkml.kernel.org/r/9c856ac0-ef23-72b5-901d-a1f815508976@linux.ibm.com
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Link: https://lkml.kernel.org/n/tip-s3jhif06et9ug78qhclw41z1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      93115d32
    • J
      perf session: Add reader__process_events function · 3c7b67b2
      Jiri Olsa 提交于
      The reader object is defined by file's fd, data offset and data size.
      
      Now we can simply define a reader object for an arbitrary file data
      portion and pass it to reader__process_events().
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190110101301.6196-7-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3c7b67b2
    • J
      perf session: Add 'data_offset' member to reader object · 71002bd2
      Jiri Olsa 提交于
      Add 'data_offset' member to reader object.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190110101301.6196-6-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      71002bd2
    • J
      perf session: Add 'data_size' member to reader object · f66f0950
      Jiri Olsa 提交于
      Add a  'data_size' member to the reader object. Keep the 'data_size'
      variable instead of replacing it with rd.data_size as it will be used in
      the following patch.
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20190110101301.6196-5-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f66f0950