1. 08 1月, 2022 1 次提交
  2. 15 12月, 2021 1 次提交
  3. 08 12月, 2021 1 次提交
  4. 07 12月, 2021 1 次提交
  5. 12 11月, 2021 2 次提交
    • A
      perf trace: Beautify the 'level' argument of setsockopt · 0826b7fd
      Arnaldo Carvalho de Melo 提交于
        # perf trace -e setsockopt
           0.000 ( 0.019 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 50, optval: 0x7ffee2c0c134, optlen: 4) = 0
           0.022 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 11, optval: 0x7ffee2c0c114, optlen: 4) = 0
           0.027 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 8, optval: 0x7ffee2c0c134, optlen: 4) = 0
           0.032 ( 0.002 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 10, optval: 0x7ffee2c0c134, optlen: 4) = 0
           0.036 ( 0.002 ms): systemd-resolv/1121 setsockopt(fd: 22, level: IP, optname: 25, optval: 0x7ffee2c0c114, optlen: 4) = 0
           0.043 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: 1, optname: 62, optval: 0x7ffee2c0c0fc, optlen: 4) = 0
           0.055 ( 0.003 ms): systemd-resolv/1121 setsockopt(fd: 22, level: 1, optname: 25)
        ^C#
      
      So the simple straight STRARRAY method is not enough as SOL_SOCKET is
      '1' in most architectures but some use 0xffff (alpha, mips, parisc and
      sparc), so a followup patch will create a specialized scnprintf to cover
      that.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0826b7fd
    • A
      perf trace: Beautify the 'level' argument of getsockopt · f1c1e45e
      Arnaldo Carvalho de Melo 提交于
        # perf trace -e getsockopt
             0.000 ( 0.006 ms): systemd-resolv/1121 getsockopt(fd: 21, level: 1, optname: 17, optval: 0x7ffee2c0c6cc, optlen: 0x7ffee2c0c6c8) = 0
             0.301 ( 0.003 ms): systemd-resolv/1121 getsockopt(fd: 22, level: IP, optname: 14, optval: 0x7ffee2c0c1a0, optlen: 0x7ffee2c0c1a4) = -1 ENOTCONN (Transport endpoint is not connected)
             2.215 ( 0.005 ms): systemd-resolv/1121 getsockopt(fd: 21, level: 1, optname: 17, optval: 0x7ffee2c0c6cc, optlen: 0x7ffee2c0c6c8) = 0
             2.422 ( 0.005 ms): systemd-resolv/1121 getsockopt(fd: 22, level: IP, optname: 14, optval: 0x7ffee2c0c1a0, optlen: 0x7ffee2c0c1a4) = -1 ENOTCONN (Transport endpoint is not connected)
          1001.308 ( 0.006 ms): systemd-resolv/1121 getsockopt(fd: 21, level: 1, optname: 17, optval: 0x7ffee2c0c6cc, optlen: 0x7ffee2c0c6c8) = 0
          1001.586 ( 0.003 ms): systemd-resolv/1121 getsockopt(fd: 22, level: IP, optname: 14, optval: 0x7ffee2c0c1a0, optlen: 0x7ffee2c0c1a4) = -1 ENOTCONN (Transport endpoint is not connected)
          1001.647 ( 0.002 ms): systemd-resolv/1121 getsockopt(fd: 23, level: IP, optname: 14, optval: 0x7ffee2c0c1a0, optlen: 0x7ffee2c0c1a4) = -1 ENOTCONN (Transport endpoint is not connected)
          1003.868 ( 0.010 ms): systemd-resolv/1121 getsockopt(fd: 21, level: 1, optname: 17, optval: 0x7ffee2c0c6cc, optlen: 0x7ffee2c0c6c8) = 0
          1004.036 ( 0.006 ms): systemd-resolv/1121 getsockopt(fd: 22, level: IP, optname: 14, optval: 0x7ffee2c0c1a0, optlen: 0x7ffee2c0c1a4) = -1 ENOTCONN (Transport endpoint is not connected)
          1004.087 ( 0.002 ms): systemd-resolv/1121 getsockopt(fd: 23, level: IP, optname: 14, optval: 0x7ffee2c0c1a0, optlen: 0x7ffee2c0c1a4) = -1 ENOTCONN (Transport endpoint is not connected)
        ^C#
      
      So the simple straight STRARRAY method is not enough as SOL_SOCKET is
      '1' in most architectures but some use 0xffff (alpha, mips, parisc and
      sparc), so a followup patch will create a specialized scnprintf to cover
      that.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f1c1e45e
  6. 08 11月, 2021 2 次提交
  7. 17 9月, 2021 1 次提交
  8. 02 8月, 2021 2 次提交
  9. 16 7月, 2021 4 次提交
  10. 07 3月, 2021 1 次提交
  11. 01 12月, 2020 4 次提交
  12. 30 11月, 2020 4 次提交
  13. 03 11月, 2020 1 次提交
  14. 14 10月, 2020 1 次提交
    • J
      perf trace: Fix off by ones in memset() after realloc() in arches using libaudit · f3013f7e
      Jiri Slaby 提交于
      'perf trace ls' started crashing after commit d21cb73a on
      !HAVE_SYSCALL_TABLE_SUPPORT configs (armv7l here) like this:
      
        0  strlen () at ../sysdeps/arm/armv6t2/strlen.S:126
        1  0xb6800780 in __vfprintf_internal (s=0xbeff9908, s@entry=0xbeff9900, format=0xa27160 "]: %s()", ap=..., mode_flags=<optimized out>) at vfprintf-internal.c:1688
        ...
        5  0x0056ecdc in fprintf (__fmt=0xa27160 "]: %s()", __stream=<optimized out>) at /usr/include/bits/stdio2.h:100
        6  trace__sys_exit (trace=trace@entry=0xbeffc710, evsel=evsel@entry=0xd968d0, event=<optimized out>, sample=sample@entry=0xbeffc3e8) at builtin-trace.c:2475
        7  0x00566d40 in trace__handle_event (sample=0xbeffc3e8, event=<optimized out>, trace=0xbeffc710) at builtin-trace.c:3122
        ...
        15 main (argc=2, argv=0xbefff6e8) at perf.c:538
      
      It is because memset in trace__read_syscall_info zeroes wrong memory:
      
      1) when initializing for the first time, it does not reset the last id.
      
      2) in other cases, it resets the last id of previous buffer.
      
      ad 1) it causes the crash above as sc->name used in the fprintf above
            contains garbage.
      
      ad 2) it sets nonexistent from true back to false for id 11 here. Not
            sure, what the consequences are.
      
      So fix it by introducing a special case for the initial initialization
      and do the right +1 in both cases.
      
      Fixes: d21cb73a ("perf trace: Grow the syscall table as needed when using libaudit")
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20201001093419.15761-1-jslaby@suse.czSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f3013f7e
  15. 04 8月, 2020 1 次提交
  16. 23 6月, 2020 2 次提交
  17. 30 5月, 2020 1 次提交
    • A
      perf trace: Grow the syscall table as needed when using libaudit · d21cb73a
      Arnaldo Carvalho de Melo 提交于
      The audit-libs API doesn't provide a way to figure out what is the
      syscall with the greatest number/id, take that into account when using
      that method to go on growing the syscall table as we the syscalls go on
      appearing on the radar.
      
      With this the libaudit based method is back working, i.e. when building
      with:
      
        $ make NO_SYSCALL_TABLE=1 O=/tmp/build/perf -C tools/perf install-bin
        <SNIP>
        Auto-detecting system features:
        <SNIP>
        ...                      libaudit: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        <SNIP>
        $ ldd ~/bin/perf | grep audit
      	libaudit.so.1 => /lib64/libaudit.so.1 (0x00007faef22df000)
        $
      
      perf trace is back working, which makes it functional in arches other
      than x86_64, powerpc, arm64 and s390, that provides these generators:
      
        $ find tools/perf/arch/ -name "*syscalltbl*"
        tools/perf/arch/x86/entry/syscalls/syscalltbl.sh
        tools/perf/arch/arm64/entry/syscalls/mksyscalltbl
        tools/perf/arch/s390/entry/syscalls/mksyscalltbl
        tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl
        $
      
      Example output forcing the libaudit method on x86_64:
      
        # perf trace -e file,nanosleep sleep 0.001
                 ? (         ): sleep/859090  ... [continued]: execve())                                   = 0
             0.045 ( 0.005 ms): sleep/859090 access(filename: 0x8733e850, mode: R)                         = -1 ENOENT (No such file or directory)
             0.055 ( 0.005 ms): sleep/859090 openat(dfd: CWD, filename: 0x8733ba29, flags: RDONLY|CLOEXEC) = 3
             0.079 ( 0.005 ms): sleep/859090 openat(dfd: CWD, filename: 0x87345d20, flags: RDONLY|CLOEXEC) = 3
             0.085 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483f58, count: 832)                  = 832
             0.090 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483b50, count: 784)                  = 784
             0.094 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483b20, count: 32)                   = 32
             0.098 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483ad0, count: 68)                   = 68
             0.109 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483a50, count: 784)                  = 784
             0.113 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483730, count: 32)                   = 32
             0.117 ( 0.002 ms): sleep/859090 read(fd: 3, buf: 0x7ffd9d483710, count: 68)                   = 68
             0.320 ( 0.008 ms): sleep/859090 openat(dfd: CWD, filename: 0x872c3660, flags: RDONLY|CLOEXEC) = 3
             0.372 ( 1.057 ms): sleep/859090 nanosleep(rqtp: 0x7ffd9d484ac0)                               = 0
        #
      
      There are still some limitations when using the libaudit method, that
      will be fixed at some point, i.e., this works with the mksyscalltbl
      method but not with libaudit's:
      
        # perf trace -e file,*sleep sleep 0.001
        event syntax error: '*sleep'
                             \___ parser error
        Run 'perf list' for a list of valid events
      
         Usage: perf trace [<options>] [<command>]
            or: perf trace [<options>] -- <command> [<options>]
            or: perf trace record [<options>] [<command>]
            or: perf trace record [<options>] -- <command> [<options>]
      
            -e, --event <event>   event/syscall selector. use 'perf list' to list available events
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d21cb73a
  18. 28 5月, 2020 2 次提交
  19. 06 5月, 2020 7 次提交
  20. 12 2月, 2020 1 次提交
    • A
      perf trace: Resolve prctl's 'option' arg strings to numbers · d7a07b29
      Arnaldo Carvalho de Melo 提交于
        # perf trace -e syscalls:sys_enter_prctl --filter="option==SET_NAME"
           0.000 Socket Thread/3860 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7fc50b9733e8)
           0.053 SSL Cert #78/3860 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7fc50b9733e8)
      ^C  #
      
      If one uses '-v' with 'perf trace', we can see the filter it puts in
      place:
      
        New filter for syscalls:sys_enter_prctl: (option==0xf) && (common_pid != 3859 && common_pid != 2757)
      
      We still need to allow using plain '-e prctl' and have this turn into
      creating a 'syscalls:sys_enter_prctl' event so that the filter can be
      applied only to it as right now '-e prctl' ends up using the
      'raw_syscalls:sys_enter/sys_exit'.
      
      The end goal is to have something like:
      
        # perf trace -e prctl/option==SET_NAME/
      
      And have that use tracepoint filters or eBPF ones.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mike Christie <mchristi@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d7a07b29