1. 10 Jun, 2019 31 commits
  2. 05 Jun, 2019 9 commits
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Associate more argument names with the filename beautifier · dea87bfb
      Arnaldo Carvalho de Melo authored
      For instance, the rename* family uses "oldname", "newname", so check if
      "name" is at the end and treat it as a filename.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-wjy7j4bk06g7atzwoz1mid24@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dea87bfb
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Consume the augmented_raw_syscalls payload · 8195168e
      Arnaldo Carvalho de Melo authored
      To support the SCA_FILENAME beautifier in more than one syscall arg, as
      needed for syscalls such as the rename* family, we need to, after
      processing one such arg, bump the augmented pointers so that the next
      augmented arg don't reuse data for the previous augmented arguments.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-4e4cmzyjxb3wkonfo1x9a27y@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8195168e
    • Jiri Olsa's avatar
      perf jvmti: Address gcc string overflow warning for strncpy() · 279ab04d
      Jiri Olsa authored
      We are getting false positive gcc warning when we compile with gcc9 (9.1.1):
      
           CC       jvmti/libjvmti.o
         In file included from /usr/include/string.h:494,
                          from jvmti/libjvmti.c:5:
         In function ‘strncpy’,
             inlined from ‘copy_class_filename.constprop’ at jvmti/libjvmti.c:166:3:
         /usr/include/bits/string_fortified.h:106:10: error: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
           106 |   return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
               |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         jvmti/libjvmti.c: In function ‘copy_class_filename.constprop’:
         jvmti/libjvmti.c:165:26: note: length computed here
           165 |   size_t file_name_len = strlen(file_name);
               |                          ^~~~~~~~~~~~~~~~~
         cc1: all warnings being treated as errors
      
      As per Arnaldo's suggestion use strlcpy(), which does the same thing and keeps
      gcc silent.
      Suggested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ben Gainey <ben.gainey@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/20190531131321.GB1281@kravaSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      279ab04d
    • Arnaldo Carvalho de Melo's avatar
      perf augmented_raw_syscalls: Move reading filename to the loop · 602bce09
      Arnaldo Carvalho de Melo authored
      Almost there, next step is to copy more than one filename payload.
      
      Probably to read syscall arg structs, etc we'll need just a variation of
      this that will decide what to use, if probe_read_str() or plain
      probe_read for structs, i.e. fixed size.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-uf6u0pld6xe4xuo16f04owlz@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      602bce09
    • Arnaldo Carvalho de Melo's avatar
      perf augmented_raw_syscalls: Change helper to consider just the augmented_filename part · deaf4da4
      Arnaldo Carvalho de Melo authored
      So that we can use it for multiple args, baby steps not to step into the
      verifier toes.
      
      In the process make sure we handle -EFAULT from bpf_prog_read_str(), as
      this really is needed now that we'll handle more than one augmented
      argument, i.e. if there is failure, then we have the argument that fails
      have:
      
        (size = 0, err = -EFAULT, value = [] )
      
      followed by the next, lets say that worked for a second pathname:
      
        (size = 4, err = 0, value = "/tmp" )
      
      So we can skip the first while telling the user about the problem and
      then process the second.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-deyvqi39um6gp6hux6jovos8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      deaf4da4
    • Arnaldo Carvalho de Melo's avatar
      perf augmented_raw_syscalls: Move the probe_read_str to a separate function · 0c95a7ff
      Arnaldo Carvalho de Melo authored
      One more step into copying multiple filenames to support syscalls like
      rename*.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lkml.kernel.org/n/tip-xdqtjexdyp81oomm1rkzeifl@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0c95a7ff
    • Arnaldo Carvalho de Melo's avatar
      perf augmented_raw_syscalls: Tell which args are filenames and how many bytes to copy · 4cae8675
      Arnaldo Carvalho de Melo authored
      Since we know what args are strings from reading the syscall
      descriptions in tracefs and also already mark such args to be beautified
      using the syscall_arg__scnprintf_filename() helper, all we need is to
      fill in this info in the 'syscalls' BPF map we were using to state which
      syscalls the user is interested in, i.e. the syscall filter.
      
      Right now just set that with PATH_MAX and unroll the syscall arg in the
      BPF program, as the verifier isn't liking something clang generates when
      unrolling the loop.
      
      This also makes the augmented_raw_syscalls.c program support all arches,
      since we removed that set of defines with the hard coded syscall
      numbers, all should be automatically set for all arches, with the
      syscall id mapping done correcly.
      
      Doing baby steps here, i.e. just the first string arg for a syscall is
      printed, syscalls with more than one, say, the various rename* syscalls,
      need further work, but lets get first something that the BPF verifier
      accepts before increasing the complexity
      
      To test it, something like:
      
       # perf trace -e string -e /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.c
      
      With:
      
        # cat ~/.perfconfig
        [llvm]
      	dump-obj = true
      	clang-opt = -g
        [trace]
      	#add_events = /home/acme/git/perf/tools/perf/examples/bpf/augmented_raw_syscalls.c
      	show_zeros = yes
      	show_duration = no
      	no_inherit = yes
      	show_timestamp = no
      	show_arg_names = no
      	args_alignment = 40
      	show_prefix = yes
        #
      
      That commented add_events line is needed for developing this
      augmented_raw_syscalls.c BPF program, as if we add it via the
      'add_events' mechanism so as to shorten the 'perf trace' command lines,
      then we end up not setting up the -v option which precludes us having
      access to the bpf verifier log :-\
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: Yonghong Song <yhs@fb.com>
      Link: https://lkml.kernel.org/n/tip-dn863ya0cbsqycxuy0olvbt1@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4cae8675
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Select find text when find bar is activated · 80b3fb64
      Adrian Hunter authored
      The user probably wants to replace the find text, so select the find
      text when the find bar is activated.
      
      That is fairly standard behaviour for search text entry.
      
      Entering text will replace the current text, but using edit keys
      (arrows, home, end etc) cancels the selection and enables editing.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-23-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      80b3fb64
    • Adrian Hunter's avatar
      perf scripts python: exported-sql-viewer.py: Add IPC information to Call Tree · b3b66079
      Adrian Hunter authored
      Enhance the call tree to display IPC information if it is available.
      
      Committer testing:
      
      [acme@quaco adrian.hunter]$ python ~acme/libexec/perf-core/scripts/python/exported-sql-viewer.py ~/c/adrian.hunter/simple-retpoline.db
      
      Reports -> Call Tree, then expand a few trees, then select with the
      mouse and press control+C (copy):
      
      Call Path                   Object        Call Time Time  Time(%) Insn  Insn   Cyc   Cyc   IPC Branch Branch
      ▼ simple-retpolin                                   (ns)          Cnt   Cnt(%) Cnt   Cnt(%)     Count Count(%)
        ▼ 23003:23003
          ▼ _start                ld-2.28.so    112195670 218295 100.0 127746 100.0 207320 100.0 0.62 13046 100.0
             unknown             unknown       112195987   3202   1.5      0   0.0      0   0.0    0     1   0.0
             _dl_start           ld-2.28.so    112199189 188471  86.3 123394  96.6 180007  86.8 0.69 12529  96.0
            ▼ _dl_init            ld-2.28.so    112387660  13406   6.1   3207   2.5  14868   7.2 0.22   327   2.5
               call_init.part.0  ld-2.28.so    112387773    117   0.9     70   2.2    639   4.3 0.11     3   0.9
               call_init.part.0  ld-2.28.so    112387890  13129  97.9   3103  96.8  14100  94.8 0.22   315  96.3
               call_init.part.0  ld-2.28.so    112401020      0   0.0      0   0.0      0   0.0    0     2   0.6
            ▼ _start              simple-retpol 112401066  12899   5.9   1142   0.9  11561   5.6 0.10   184   1.4
               unknown           unknown       112401388    846   6.6      0   0.0      0   0.0    0     1   0.5
              ▼ __libc_start_main libc-2.28.so  112402344  11621  90.1   1129  98.9  10350  89.5 0.11   181  98.4
                 __cxa_atexit    libc-2.28.so  112402360   2302  19.8    101   8.9   1817  17.6 0.06    13   7.2
                 __libc_csu_init simple-retpol 112404673    121   1.0     43   3.8    340   3.3 0.13     8   4.4
                 _setjmp         libc-2.28.so  112404794     74   0.6     46   4.1    206   2.0 0.22     4   2.2
                ▼ main            simple-retpol 112404892     44   0.4     23   2.0    126   1.2 0.18    12   6.6
                  ▼ foo           simple-retpol 112404892     19  43.2     12  52.2     55  43.7 0.22     5  41.7
                      bar         simple-retpol 112404896     12  63.2      3  25.0     34  61.8 0.09     1  20.0
                  ▼ foo           simple-retpol 112404911     25  56.8     11  47.8     71  56.3 0.15     5  41.7
                     bar         simple-retpol 112404924     10  40.0      3  27.3     27  38.0 0.11     1  20.0
                 exit            libc-2.28.so  112404936   9029  77.7    878  77.8   7765  75.0 0.11   139  76.8
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20190520113728.14389-22-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3b66079