1. 23 6月, 2020 14 次提交
  2. 18 6月, 2020 2 次提交
    • T
      perf build: Fix error message when asking for -fsanitize=address without required libraries · 6a1515c9
      Tiezhu Yang 提交于
      When build perf with ASan or UBSan, if libasan or libubsan can not find,
      the feature-glibc is 0 and there exists the following error log which is
      wrong, because we can find gnu/libc-version.h in /usr/include,
      glibc-devel is also installed.
      
        [yangtiezhu@linux perf]$ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address'
          BUILD:   Doing 'make -j4' parallel build
          HOSTCC   fixdep.o
          HOSTLD   fixdep-in.o
          LINK     fixdep
        <stdin>:1:0: warning: -fsanitize=address and -fsanitize=kernel-address are not supported for this target
        <stdin>:1:0: warning: -fsanitize=address not supported for this target
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                      libaudit: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
        ...                        libaio: [ OFF ]
        ...                       libzstd: [ OFF ]
        ...        disassembler-four-args: [ OFF ]
      
        Makefile.config:393: *** No gnu/libc-version.h found, please install glibc-dev[el].  Stop.
        Makefile.perf:224: recipe for target 'sub-make' failed
        make[1]: *** [sub-make] Error 2
        Makefile:69: recipe for target 'all' failed
        make: *** [all] Error 2
        [yangtiezhu@linux perf]$ ls /usr/include/gnu/libc-version.h
        /usr/include/gnu/libc-version.h
      
      After install libasan and libubsan, the feature-glibc is 1 and the build
      process is success, so the cause is related with libasan or libubsan, we
      should check them and print an error log to reflect the reality.
      
      Committer testing:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ OFF ]
        ...            dwarf_getlocations: [ OFF ]
        ...                         glibc: [ OFF ]
        ...                          gtk2: [ OFF ]
        ...                        libbfd: [ OFF ]
        ...                        libcap: [ OFF ]
        ...                        libelf: [ OFF ]
        ...                       libnuma: [ OFF ]
        ...        numa_num_possible_cpus: [ OFF ]
        ...                       libperl: [ OFF ]
        ...                     libpython: [ OFF ]
        ...                     libcrypto: [ OFF ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ OFF ]
        ...                          zlib: [ OFF ]
        ...                          lzma: [ OFF ]
        ...                     get_cpuid: [ OFF ]
        ...                           bpf: [ OFF ]
        ...                        libaio: [ OFF ]
        ...                       libzstd: [ OFF ]
        ...        disassembler-four-args: [ OFF ]
      
        Makefile.config:401: *** No libasan found, please install libasan.  Stop.
        make[1]: *** [Makefile.perf:231: sub-make] Error 2
        make: *** [Makefile:70: all] Error 2
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $
        $
        $ sudo dnf install libasan
        <SNIP>
        Installed:
          libasan-9.3.1-2.fc31.x86_64
        $
        $
        $ make DEBUG=1 EXTRA_CFLAGS='-fno-omit-frame-pointer -fsanitize=address' O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
         <SNIP>
          CC       /tmp/build/perf/util/pmu-flex.o
          FLEX     /tmp/build/perf/util/expr-flex.c
          CC       /tmp/build/perf/util/expr-bison.o
          CC       /tmp/build/perf/util/expr.o
          CC       /tmp/build/perf/util/expr-flex.o
          CC       /tmp/build/perf/util/parse-events-flex.o
          CC       /tmp/build/perf/util/parse-events.o
          LD       /tmp/build/perf/util/intel-pt-decoder/perf-in.o
          LD       /tmp/build/perf/util/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        <SNIP>
          INSTALL  python-scripts
          INSTALL  perf_completion-script
          INSTALL  perf-tip
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $ ldd ~/bin/perf | grep asan
        	libasan.so.5 => /lib64/libasan.so.5 (0x00007f0904164000)
        $
      
      And if we rebuild without -fsanitize-address:
      
        $ rm -rf /tmp/build/perf ; mkdir -p /tmp/build/perf
        $ make O=/tmp/build/perf -C tools/perf/ install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          HOSTCC   /tmp/build/perf/fixdep.o
          HOSTLD   /tmp/build/perf/fixdep-in.o
          LINK     /tmp/build/perf/fixdep
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...            dwarf_getlocations: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libcap: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...        numa_num_possible_cpus: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                     libcrypto: [ on  ]
        ...                     libunwind: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...                          lzma: [ on  ]
        ...                     get_cpuid: [ on  ]
        ...                           bpf: [ on  ]
        ...                        libaio: [ on  ]
        ...                       libzstd: [ on  ]
        ...        disassembler-four-args: [ on  ]
      
          GEN      /tmp/build/perf/common-cmds.h
          CC       /tmp/build/perf/exec-cmd.o
        <SNIP>
          INSTALL  perf_completion-script
          INSTALL  perf-tip
        make: Leaving directory '/home/acme/git/perf/tools/perf'
        $ ldd ~/bin/perf | grep asan
        $
      Signed-off-by: NTiezhu Yang <yangtiezhu@loongson.cn>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: tiezhu yang <yangtiezhu@loongson.cn>
      Cc: xuefeng li <lixuefeng@loongson.cn>
      Link: http://lore.kernel.org/lkml/1592445961-28044-1-git-send-email-yangtiezhu@loongson.cnSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6a1515c9
    • M
      perf script: Initialize zstd_data · b13b04d9
      Milian Wolff 提交于
      Fixes segmentation fault when trying to interpret zstd-compressed data
      with perf script:
      
      ```
        $ perf record -z ls
        ...
        [ perf record: Captured and wrote 0,010 MB perf.data, compressed (original 0,001 MB, ratio is 2,190) ]
        $ memcheck perf script
        ...
        ==67911== Invalid read of size 4
        ==67911==    at 0x5568188: ZSTD_decompressStream (in /usr/lib/libzstd.so.1.4.5)
        ==67911==    by 0x6E726B: zstd_decompress_stream (zstd.c:100)
        ==67911==    by 0x65729C: perf_session__process_compressed_event (session.c:72)
        ==67911==    by 0x6598E8: perf_session__process_user_event (session.c:1583)
        ==67911==    by 0x65BA59: reader__process_events (session.c:2177)
        ==67911==    by 0x65BA59: __perf_session__process_events (session.c:2234)
        ==67911==    by 0x65BA59: perf_session__process_events (session.c:2267)
        ==67911==    by 0x5A7397: __cmd_script (builtin-script.c:2447)
        ==67911==    by 0x5A7397: cmd_script (builtin-script.c:3840)
        ==67911==    by 0x5FE9D2: run_builtin (perf.c:312)
        ==67911==    by 0x711627: handle_internal_command (perf.c:364)
        ==67911==    by 0x711627: run_argv (perf.c:408)
        ==67911==    by 0x711627: main (perf.c:538)
        ==67911==  Address 0x71d8 is not stack'd, malloc'd or (recently) free'd
      ```
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Acked-by: NAlexey Budankov <alexey.budankov@linux.intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LPU-Reference: 20200612230333.72140-1-milian.wolff@kdab.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b13b04d9
  3. 10 6月, 2020 1 次提交
  4. 09 6月, 2020 8 次提交
    • I
      perf parse-events: Fix an old style declaration · ffaecd7d
      Ian Rogers 提交于
      Fixes: a26e4716 (perf tools: Move ALLOC_LIST into a function)
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200609053610.206588-2-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ffaecd7d
    • I
      perf parse-events: Fix an incompatible pointer · c2412fae
      Ian Rogers 提交于
      Arrays are pointer types and don't need their address taking.
      
      Fixes: 8255718f (perf pmu: Expand PMU events by prefix match)
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200609053610.206588-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c2412fae
    • S
      perf bpf: Fix bpf prologue generation · d38c692f
      Sumanth Korikkar 提交于
      Issue:
      
      bpf_probe_read() is no longer available for architecture which has
      overlapping address space. Hence bpf prologue generation fails
      
      Fix:
      
      Use bpf_probe_read_kernel for kernel member access. For user attribute
      access in kprobes, use bpf_probe_read_user.
      
      Other:
      
      @user attribute was introduced in commit 1e032f7c ("perf-probe: Add
      user memory access attribute support")
      
      Test:
      
      1. ulimit -l 128 ; ./perf record -e tests/bpf_sched_setscheduler.c
      2. cat tests/bpf_sched_setscheduler.c
      
      static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) =
              (void *) 6;
      static int (*bpf_probe_read_user)(void *dst, __u32 size,
                                        const void *unsafe_ptr) = (void *) 112;
      static int (*bpf_probe_read_kernel)(void *dst, __u32 size,
              const void *unsafe_ptr) = (void *) 113;
      
      SEC("func=do_sched_setscheduler  pid policy param->sched_priority@user")
      int bpf_func__setscheduler(void *ctx, int err, pid_t pid, int policy,
                                 int param)
      {
              char fmt[] = "prio: %ld";
              bpf_trace_printk(fmt, sizeof(fmt), param);
              return 1;
      }
      
      char _license[] SEC("license") = "GPL";
      int _version SEC("version") = LINUX_VERSION_CODE;
      
      3. ./perf script
         sched 305669 [000] 1614458.838675: perf_bpf_probe:func: (2904e508)
         pid=261614 policy=2 sched_priority=1
      
      4. cat /sys/kernel/debug/tracing/trace
         <...>-309956 [006] .... 1616098.093957: 0: prio: 1
      
      Committer testing:
      
      I had to add some missing headers in the bpf_sched_setscheduler.c test
      proggie, then instead of using record+script I used 'perf trace' to
      drive everything in one go:
      
        # cat bpf_sched_setscheduler.c
        #include <linux/types.h>
        #include <bpf.h>
      
        static void (*bpf_trace_printk)(const char *fmt, int fmt_size, ...) = (void *) 6;
        static int (*bpf_probe_read_user)(void *dst, __u32 size, const void *unsafe_ptr) = (void *) 112;
        static int (*bpf_probe_read_kernel)(void *dst, __u32 size, const void *unsafe_ptr) = (void *) 113;
      
        SEC("func=do_sched_setscheduler  pid policy param->sched_priority@user")
        int bpf_func__setscheduler(void *ctx, int err, pid_t pid, int policy, int param)
        {
                char fmt[] = "prio: %ld";
                bpf_trace_printk(fmt, sizeof(fmt), param);
                return 1;
        }
      
        char _license[] SEC("license") = "GPL";
        int _version SEC("version") = LINUX_VERSION_CODE;
        #
        #
        # perf trace -e bpf_sched_setscheduler.c chrt -f 42 sleep 1
           0.000 chrt/80125 perf_bpf_probe:func(__probe_ip: -1676607808, policy: 1, sched_priority: 42)
        #
      
      And even with backtraces :-)
      
        # perf trace -e bpf_sched_setscheduler.c/max-stack=8/ chrt -f 42 sleep 1
             0.000 chrt/79805 perf_bpf_probe:func(__probe_ip: -1676607808, policy: 1, sched_priority: 42)
                                               do_sched_setscheduler ([kernel.kallsyms])
                                               __x64_sys_sched_setscheduler ([kernel.kallsyms])
                                               do_syscall_64 ([kernel.kallsyms])
                                               entry_SYSCALL_64 ([kernel.kallsyms])
                                               __GI___sched_setscheduler (/usr/lib64/libc-2.30.so)
        #
      Signed-off-by: NSumanth Korikkar <sumanthk@linux.ibm.com>
      Reviewed-by: NThomas Richter <tmricht@linux.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: bpf@vger.kernel.org
      LPU-Reference: 20200609081019.60234-3-sumanthk@linux.ibm.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d38c692f
    • S
      perf probe: Fix user attribute access in kprobes · 9256c303
      Sumanth Korikkar 提交于
      Issue:
      
        # perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
      
      did not work before.
      
      Fix:
      
      Make:
      
        # perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
      
      output equivalent to ftrace:
      
        # echo 'p:probe/do_sched_setscheduler _text+517384 pid=%r2:s32 policy=%r3:s32 sched_priority=+u0(%r4):s32' > /sys/kernel/debug/tracing/kprobe_events
      
      Other:
      
      1. Right now, __match_glob() does not handle [u]<offset>. For now, use
        *u]<offset>.
      
      2. @user attribute was introduced in commit 1e032f7c ("perf-probe:
         Add user memory access attribute support")
      
      Test:
      1. perf probe -a 'do_sched_setscheduler  pid policy
         param->sched_priority@user'
      
      2 ./perf script
         sched 305669 [000] 1614458.838675: perf_bpf_probe:func: (2904e508)
         pid=261614 policy=2 sched_priority=1
      
      3. cat /sys/kernel/debug/tracing/trace
         <...>-309956 [006] .... 1616098.093957: 0: prio: 1
      
      Committer testing:
      
      Before:
      
        # perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
        param(type:sched_param) has no member sched_priority@user.
          Error: Failed to add events.
        # pahole sched_param
        struct sched_param {
        	int                        sched_priority;       /*     0     4 */
      
        	/* size: 4, cachelines: 1, members: 1 */
        	/* last cacheline: 4 bytes */
        };
        #
      
      After:
      
        # perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
        Added new event:
          probe:do_sched_setscheduler (on do_sched_setscheduler with pid policy sched_priority=param->sched_priority)
      
        You can now use it in all perf tools, such as:
      
        	perf record -e probe:do_sched_setscheduler -aR sleep 1
      
        # cat /sys/kernel/debug/tracing/kprobe_events
        p:probe/do_sched_setscheduler _text+1113792 pid=%di:s32 policy=%si:s32 sched_priority=+u0(%dx):s32
        #
      
      Fixes: 1e032f7c ("perf-probe: Add user memory access attribute support")
      Signed-off-by: NSumanth Korikkar <sumanthk@linux.ibm.com>
      Reviewed-by: NThomas Richter <tmricht@linux.ibm.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Ilya Leoshkevich <iii@linux.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: bpf@vger.kernel.org
      LPU-Reference: 20200609081019.60234-2-sumanthk@linux.ibm.com
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9256c303
    • H
      perf stat: Fix NULL pointer dereference · c0c652fc
      Hongbo Yao 提交于
      If config->aggr_map is NULL and config->aggr_get_id is not NULL,
      the function print_aggr() will still calling arrg_update_shadow(),
      which can result in accessing the invalid pointer.
      
      Fixes: 088519f3 ("perf stat: Move the display functions to stat-display.c")
      Signed-off-by: NHongbo Yao <yaohongbo@huawei.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wei Li <liwei391@huawei.com>
      Link: https://lore.kernel.org/lkml/20200608163625.GC3073@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c0c652fc
    • G
      perf report: Fix NULL pointer dereference in hists__fprintf_nr_sample_events() · 11b6e548
      Gaurav Singh 提交于
      The 'evname' variable can be NULL, as it is checked a few lines back,
      check it before using.
      
      Fixes: 9e207ddf ("perf report: Show call graph from reference events")
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/Signed-off-by: NGaurav Singh <gaurav1086@gmail.com>
      11b6e548
    • A
      perf beauty: Add support to STATX_MNT_ID in the 'statx' syscall 'mask' argument · 5d33cbfe
      Arnaldo Carvalho de Melo 提交于
      Introduced in:
      
        fa2fcf4f ("statx: add mount ID")
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Miklos Szeredi <mszeredi@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5d33cbfe
    • A
      tools headers API: Update faccessat2 affected files · 6c3c184f
      Arnaldo Carvalho de Melo 提交于
      Update the copies of files affected by:
      
        c8ffd8bc ("vfs: add faccessat2 syscall")
      
      To address this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fcntl.h' differs from latest version at 'include/uapi/linux/fcntl.h'
        diff -u tools/include/uapi/linux/fcntl.h include/uapi/linux/fcntl.h
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
      
      Which results in 'perf trace' gaining support for the 'faccessat2'
      syscall, now one can use:
      
        # perf trace -e faccessat2
      
      And have system wide tracing of this syscall. And this also will include
      it;
      
        # perf trace -e faccess*
      
      Together with the other variants.
      
      How it affects building/usage (on an x86_64 system):
      
        $ cp /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c /tmp/syscalls_64.c.before
        $
        [root@five ~]# perf trace -e faccessat2
        event syntax error: 'faccessat2'
                             \___ 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
        [root@five ~]#
        $ cp arch/x86/entry/syscalls/syscall_64.tbl tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        $ git diff
        diff --git a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        index 37b844f839bc..78847b32e137 100644
        --- a/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        +++ b/tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        @@ -359,6 +359,7 @@
         435    common  clone3                  sys_clone3
         437    common  openat2                 sys_openat2
         438    common  pidfd_getfd             sys_pidfd_getfd
        +439    common  faccessat2              sys_faccessat2
      
         #
         # x32-specific system call numbers start at 512 to avoid cache impact
        $
      
        $ make -C tools/perf O=/tmp/build/perf/ install-bin
        <SNIP>
        CC       /tmp/build/perf/util/syscalltbl.o
        LD       /tmp/build/perf/util/perf-in.o
        LD       /tmp/build/perf/perf-in.o
        LINK     /tmp/build/perf/perf
        <SNIP>
        [root@five ~]# perf trace -e faccessat2
        ^C[root@five ~]#
      
      Cc: Miklos Szeredi <mszeredi@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6c3c184f
  5. 02 6月, 2020 3 次提交
    • T
      perf tools: Remove some duplicated includes · 3e9b26dc
      Tiezhu Yang 提交于
      There exists some duplicated includes in tools/perf, remove them.
      Signed-off-by: NTiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: xuefeng li <lixuefeng@loongson.cn>
      Link: http://lore.kernel.org/lkml/1591071304-19338-2-git-send-email-yangtiezhu@loongson.cnSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3e9b26dc
    • A
      perf symbols: Fix kernel maps for kcore and eBPF · 0affd0e5
      Adrian Hunter 提交于
      Adjust 'map->pgoff' also when moving a map's start address.
      
      Example with v5.4.34 based kernel:
      
        Before:
      
          $ sudo tools/perf/perf record -a --kcore -e intel_pt//k sleep 1
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 1.958 MB perf.data ]
          $ sudo tools/perf/perf script --itrace=e >/dev/null
          Warning:
          961 instruction trace errors
      
        After:
      
          $ sudo tools/perf/perf script --itrace=e >/dev/null
          $
      
      Committer testing:
      
        # uname -a
        Linux seventh 5.6.10-100.fc30.x86_64 #1 SMP Mon May 4 15:36:44 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
        #
      
      Before:
      
        # perf record -a --kcore -e intel_pt//k sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.923 MB perf.data ]
        # perf script --itrace=e >/dev/null
        Warning:
        295 instruction trace errors
        #
      
      After:
      
        # perf record -a --kcore -e intel_pt//k sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.919 MB perf.data ]
        # perf script --itrace=e >/dev/null
        #
      
      Fixes: fb5a88d4 ("perf tools: Preserve eBPF maps when loading kcore")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20200602112505.1406-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0affd0e5
    • J
      perf stat: Ensure group is defined on top of the same cpu mask · a9a17902
      Jiri Olsa 提交于
      Jin Yao reported the issue (and posted first versions of this change)
      with groups being defined over events with different cpu mask.
      
      This causes assert aborts in get_group_fd, like:
      
        # perf stat -M "C2_Pkg_Residency" -a -- sleep 1
        perf: util/evsel.c:1464: get_group_fd: Assertion `!(fd == -1)' failed.
        Aborted
      
      All the events in the group have to be defined over the same cpus so the
      group_fd can be found for every leader/member pair.
      
      Adding check to ensure this condition is met and removing the group
      (with warning) if we detect mixed cpus, like:
      
        $ sudo perf stat -e '{power/energy-cores/,cycles},{instructions,power/energy-cores/}'
        WARNING: event cpu maps do not match, disabling group:
          anon group { power/energy-cores/, cycles }
          anon group { instructions, power/energy-cores/ }
      
      Ian asked also for cpu maps details, it's displayed in verbose mode:
      
        $ sudo perf stat -e '{cycles,power/energy-cores/}' -v
        WARNING: group events cpu maps do not match, disabling group:
          anon group { power/energy-cores/, cycles }
             power/energy-cores/: 0
             cycles: 0-7
          anon group { instructions, power/energy-cores/ }
             instructions: 0-7
             power/energy-cores/: 0
      
      Committer testing:
      
        [root@seventh ~]# perf stat -e '{power/energy-cores/,cycles},{instructions,power/energy-cores/}'
        WARNING: grouped events cpus do not match, disabling group:
          anon group { power/energy-cores/, cycles }
          anon group { instructions, power/energy-cores/ }
        ^C
         Performance counter stats for 'system wide':
      
                     12.62 Joules power/energy-cores/
               106,920,637        cycles
                80,228,899        instructions              #    0.75  insn per cycle
                     12.62 Joules power/energy-cores/
      
              14.514476987 seconds time elapsed
      
        [root@seventh ~]#
      
      But if we put compatible events in each group it works:
      
        [root@seventh ~]# perf stat -e '{power/energy-cores/,power/energy-ram/},{instructions,cycles}' -a sleep 2
      
         Performance counter stats for 'system wide':
      
                      1.95 Joules power/energy-cores/
                      0.92 Joules power/energy-ram/
                29,305,715        instructions              #    1.03  insn per cycle
                28,423,338        cycles
      
               2.001438142 seconds time elapsed
      
        [root@seventh ~]#
      
      This needs improvement tho:
      
        [root@seventh ~]# perf stat -e '{power/energy-cores/,power/energy-ram/},{instructions,cycles}' sleep 2
        Error:
        The sys_perf_event_open() syscall returned with 22 (Invalid argument) for event (power/energy-cores/).
        /bin/dmesg | grep -i perf may provide additional information.
      
        [root@seventh ~]#
      
      We need to emit a better message, one stating that the power/ events
      can't be used for a specific workload, instead it is per-cpu or system
      wide.
      
      Fixes: 6a4bb04c ("perf tools: Enable grouping logic for parsed events")
      Co-developed-by: NJin Yao <yao.jin@linux.intel.com>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NIan Rogers <irogers@google.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: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael Petlan <mpetlan@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200602101736.GE1112120@kravaSigned-off-by: NJin Yao <yao.jin@linux.intel.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a9a17902
  6. 01 6月, 2020 6 次提交
    • I
      perf libdw: Fix off-by 1 relative directory includes · 5cf0e8eb
      Ian Rogers 提交于
      This is currently working due to extra include paths in the build.
      
      Before:
      
        $ cd tools/perf/arch/arm64/util
        $ ls -la ../../util/unwind-libdw.h
        ls: cannot access '../../util/unwind-libdw.h': No such file or directory
      
      After:
      
        $ ls -la ../../../util/unwind-libdw.h
        -rw-r----- 1 irogers irogers 553 Apr 17 14:31 ../../../util/unwind-libdw.h
      Signed-off-by: NIan Rogers <irogers@google.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200529225232.207532-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5cf0e8eb
    • T
      perf arm-spe: Support synthetic events · a54ca194
      Tan Xiaojun 提交于
      After the commit ffd3d18c ("perf tools: Add ARM Statistical
      Profiling Extensions (SPE) support") has been merged, it supports to
      output raw data with option "--dump-raw-trace".  However, it misses for
      support synthetic events so cannot output any statistical info.
      
      This patch is to improve the "perf report" support for ARM SPE for four
      types synthetic events:
      
        First level cache synthetic events, including L1 data cache accessing
        and missing events;
        Last level cache synthetic events, including last level cache
        accessing and missing events;
        TLB synthetic events, including TLB accessing and missing events;
        Remote access events, which is used to account load/store operations
        caused to another socket.
      
      Example usage:
      
        $ perf record -c 1024 -e arm_spe_0/branch_filter=1,ts_enable=1,pct_enable=1,pa_enable=1,load_filter=1,jitter=1,store_filter=1,min_latency=0/ dd if=/dev/zero of=/dev/null count=10000
        $ perf report --stdio
      
        # Samples: 59  of event 'l1d-miss'
        # Event count (approx.): 59
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ..................................
        #
            23.73%    23.73%  dd       [kernel.kallsyms]  [k] perf_iterate_ctx.constprop.135
            20.34%    20.34%  dd       [kernel.kallsyms]  [k] filemap_map_pages
             5.08%     5.08%  dd       [kernel.kallsyms]  [k] perf_event_mmap
             5.08%     5.08%  dd       [kernel.kallsyms]  [k] unlock_page_memcg
             5.08%     5.08%  dd       [kernel.kallsyms]  [k] unmap_page_range
             3.39%     3.39%  dd       [kernel.kallsyms]  [k] PageHuge
             3.39%     3.39%  dd       [kernel.kallsyms]  [k] release_pages
             3.39%     3.39%  dd       ld-2.28.so         [.] 0x0000000000008b5c
             1.69%     1.69%  dd       [kernel.kallsyms]  [k] __alloc_fd
             [...]
      
        # Samples: 3K of event 'l1d-access'
        # Event count (approx.): 3980
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ......................................
        #
            26.98%    26.98%  dd       [kernel.kallsyms]  [k] ret_to_user
            10.53%    10.53%  dd       [kernel.kallsyms]  [k] fsnotify
             7.51%     7.51%  dd       [kernel.kallsyms]  [k] new_sync_read
             4.57%     4.57%  dd       [kernel.kallsyms]  [k] vfs_read
             4.35%     4.35%  dd       [kernel.kallsyms]  [k] vfs_write
             3.69%     3.69%  dd       [kernel.kallsyms]  [k] __fget_light
             3.69%     3.69%  dd       [kernel.kallsyms]  [k] rw_verify_area
             3.44%     3.44%  dd       [kernel.kallsyms]  [k] security_file_permission
             2.76%     2.76%  dd       [kernel.kallsyms]  [k] __fsnotify_parent
             2.44%     2.44%  dd       [kernel.kallsyms]  [k] ksys_write
             2.24%     2.24%  dd       [kernel.kallsyms]  [k] iov_iter_zero
             2.19%     2.19%  dd       [kernel.kallsyms]  [k] read_iter_zero
             1.81%     1.81%  dd       dd                 [.] 0x0000000000002960
             1.78%     1.78%  dd       dd                 [.] 0x0000000000002980
             [...]
      
        # Samples: 35  of event 'llc-miss'
        # Event count (approx.): 35
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ...........................
        #
            34.29%    34.29%  dd       [kernel.kallsyms]  [k] filemap_map_pages
             8.57%     8.57%  dd       [kernel.kallsyms]  [k] unlock_page_memcg
             8.57%     8.57%  dd       [kernel.kallsyms]  [k] unmap_page_range
             5.71%     5.71%  dd       [kernel.kallsyms]  [k] PageHuge
             5.71%     5.71%  dd       [kernel.kallsyms]  [k] release_pages
             5.71%     5.71%  dd       ld-2.28.so         [.] 0x0000000000008b5c
             2.86%     2.86%  dd       [kernel.kallsyms]  [k] __queue_work
             2.86%     2.86%  dd       [kernel.kallsyms]  [k] __radix_tree_lookup
             2.86%     2.86%  dd       [kernel.kallsyms]  [k] copy_page
             [...]
      
        # Samples: 2  of event 'llc-access'
        # Event count (approx.): 2
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  .............
        #
            50.00%    50.00%  dd       [kernel.kallsyms]  [k] copy_page
            50.00%    50.00%  dd       libc-2.28.so       [.] _dl_addr
      
        # Samples: 48  of event 'tlb-miss'
        # Event count (approx.): 48
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ..................................
        #
            20.83%    20.83%  dd       [kernel.kallsyms]  [k] perf_iterate_ctx.constprop.135
            12.50%    12.50%  dd       [kernel.kallsyms]  [k] __arch_clear_user
            10.42%    10.42%  dd       [kernel.kallsyms]  [k] clear_page
             4.17%     4.17%  dd       [kernel.kallsyms]  [k] copy_page
             4.17%     4.17%  dd       [kernel.kallsyms]  [k] filemap_map_pages
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] __alloc_fd
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] __mod_memcg_state.part.70
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] __queue_work
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] __rcu_read_unlock
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] d_path
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] destroy_inode
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] do_dentry_open
             [...]
      
        # Samples: 9K of event 'tlb-access'
        # Event count (approx.): 9573
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ......................................
        #
            25.79%    25.79%  dd       [kernel.kallsyms]  [k] __arch_clear_user
            11.22%    11.22%  dd       [kernel.kallsyms]  [k] ret_to_user
             8.56%     8.56%  dd       [kernel.kallsyms]  [k] fsnotify
             4.06%     4.06%  dd       [kernel.kallsyms]  [k] new_sync_read
             3.67%     3.67%  dd       [kernel.kallsyms]  [k] el0_svc_common.constprop.2
             3.04%     3.04%  dd       [kernel.kallsyms]  [k] __fsnotify_parent
             2.90%     2.90%  dd       [kernel.kallsyms]  [k] vfs_write
             2.82%     2.82%  dd       [kernel.kallsyms]  [k] vfs_read
             2.52%     2.52%  dd       libc-2.28.so       [.] write
             2.26%     2.26%  dd       [kernel.kallsyms]  [k] security_file_permission
             2.08%     2.08%  dd       [kernel.kallsyms]  [k] ksys_write
             1.96%     1.96%  dd       [kernel.kallsyms]  [k] rw_verify_area
             1.95%     1.95%  dd       [kernel.kallsyms]  [k] read_iter_zero
             [...]
      
        # Samples: 9  of event 'branch-miss'
        # Event count (approx.): 9
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  .........................
        #
            22.22%    22.22%  dd       libc-2.28.so       [.] _dl_addr
            11.11%    11.11%  dd       [kernel.kallsyms]  [k] __arch_clear_user
            11.11%    11.11%  dd       [kernel.kallsyms]  [k] __arch_copy_from_user
            11.11%    11.11%  dd       [kernel.kallsyms]  [k] __dentry_kill
            11.11%    11.11%  dd       [kernel.kallsyms]  [k] __efistub_memcpy
            11.11%    11.11%  dd       ld-2.28.so         [.] 0x0000000000012b7c
            11.11%    11.11%  dd       libc-2.28.so       [.] 0x000000000002a980
            11.11%    11.11%  dd       libc-2.28.so       [.] 0x0000000000083340
      
        # Samples: 29  of event 'remote-access'
        # Event count (approx.): 29
        #
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ...........................
        #
            41.38%    41.38%  dd       [kernel.kallsyms]  [k] filemap_map_pages
            10.34%    10.34%  dd       [kernel.kallsyms]  [k] unlock_page_memcg
            10.34%    10.34%  dd       [kernel.kallsyms]  [k] unmap_page_range
             6.90%     6.90%  dd       [kernel.kallsyms]  [k] release_pages
             3.45%     3.45%  dd       [kernel.kallsyms]  [k] PageHuge
             3.45%     3.45%  dd       [kernel.kallsyms]  [k] __queue_work
             3.45%     3.45%  dd       [kernel.kallsyms]  [k] page_add_file_rmap
             3.45%     3.45%  dd       [kernel.kallsyms]  [k] page_counter_try_charge
             3.45%     3.45%  dd       [kernel.kallsyms]  [k] page_remove_rmap
             3.45%     3.45%  dd       [kernel.kallsyms]  [k] xas_start
             3.45%     3.45%  dd       ld-2.28.so         [.] 0x0000000000002a1c
             3.45%     3.45%  dd       ld-2.28.so         [.] 0x0000000000008b5c
             3.45%     3.45%  dd       ld-2.28.so         [.] 0x00000000000093cc
      Signed-off-by: NTan Xiaojun <tanxiaojun@huawei.com>
      Tested-by: NJames Clark <james.clark@arm.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Al Grant <al.grant@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20200530122442.490-4-leo.yan@linaro.orgSigned-off-by: NJames Clark <james.clark@arm.com>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a54ca194
    • T
      perf auxtrace: Add four itrace options · 9f74d770
      Tan Xiaojun 提交于
      This patch is to add four options to synthesize events which are
      described as below:
      
       'f': synthesize first level cache events
       'm': synthesize last level cache events
       't': synthesize TLB events
       'a': synthesize remote access events
      
      This four options will be used by ARM SPE as their first consumer.
      Signed-off-by: NTan Xiaojun <tanxiaojun@huawei.com>
      Tested-by: NJames Clark <james.clark@arm.com>
      Acked-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Al Grant <al.grant@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20200530122442.490-3-leo.yan@linaro.orgSigned-off-by: NJames Clark <james.clark@arm.com>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9f74d770
    • T
      perf tools: Move arm-spe-pkt-decoder.h/c to the new dir · 4db25f66
      Tan Xiaojun 提交于
      Create a new arm-spe-decoder directory for subsequent extensions and
      move arm-spe-pkt-decoder.h/c to this directory. No code changes.
      Signed-off-by: NTan Xiaojun <tanxiaojun@huawei.com>
      Tested-by: NJames Clark <james.clark@arm.com>
      Tested-by: NQi Liu <liuqi115@hisilicon.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Al Grant <al.grant@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will@kernel.org>
      Cc: linux-arm-kernel@lists.infradead.org
      Link: http://lore.kernel.org/lkml/20200530122442.490-2-leo.yan@linaro.orgSigned-off-by: NJames Clark <james.clark@arm.com>
      Signed-off-by: NLeo Yan <leo.yan@linaro.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4db25f66
    • I
      perf test: Initialize memory in dwarf-unwind · 0fb0d615
      Ian Rogers 提交于
      Avoid a false positive caused by assembly code in arch/x86.
      
      In tests, zero the perf_event to avoid uninitialized memory uses.
      
      Warnings were caught using clang with -fsanitize=memory.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: clang-built-linux@googlegroups.com
      Link: http://lore.kernel.org/lkml/20200530082015.39162-4-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0fb0d615
    • I
      perf tests: Don't tail call optimize in unwind test · 8617e2e3
      Ian Rogers 提交于
      The tail call optimization can unexpectedly make the stack smaller and
      cause the test to fail.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: clang-built-linux@googlegroups.com
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200530082015.39162-3-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8617e2e3
  7. 30 5月, 2020 6 次提交
    • A
      perf build: Add a LIBPFM4=1 build test entry · 9300acc6
      Arnaldo Carvalho de Melo 提交于
      So that when one runs:
      
        $ make -C tools/perf build-test
      
      We make sure that recent changes don't break that opt-in build.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Igor Lubashev <ilubashe@akamai.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Jiwei Sun <jiwei.sun@windriver.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: yuzhoujian <yuzhoujian@didichuxing.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9300acc6
    • S
      perf tools: Add optional support for libpfm4 · 70943490
      Stephane Eranian 提交于
      This patch links perf with the libpfm4 library if it is available and
      LIBPFM4 is passed to the build. The libpfm4 library contains hardware
      event tables for all processors supported by perf_events. It is a helper
      library that helps convert from a symbolic event name to the event
      encoding required by the underlying kernel interface. This library is
      open-source and available from: http://perfmon2.sf.net.
      
      With this patch, it is possible to specify full hardware events by name.
      Hardware filters are also supported. Events must be specified via the
      --pfm-events and not -e option. Both options are active at the same time
      and it is possible to mix and match:
      
        $ perf stat --pfm-events inst_retired:any_p:c=1:i -e cycles ....
      
      One needs to explicitely ask for its inclusion by using the LIBPFM4 make
      command line option, ie its opt-in rather than opt-out of feature
      detection and build support.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Reviewed-by: NIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrii Nakryiko <andriin@fb.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Igor Lubashev <ilubashe@akamai.com>
      Cc: Jin Yao <yao.jin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Jiwei Sun <jiwei.sun@windriver.com>
      Cc: John Garry <john.garry@huawei.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Yonghong Song <yhs@fb.com>
      Cc: bpf@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Cc: yuzhoujian <yuzhoujian@didichuxing.com>
      Link: http://lore.kernel.org/lkml/20200505182943.218248-2-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      70943490
    • E
      perf tools: Correct license on jsmn JSON parser · 82352ae2
      Ed Maste 提交于
      This header is part of the jsmn JSON parser, introduced in 867a979a.
      Correct the SPDX tag to indicate that it is under the MIT license.
      Signed-off-by: NEd Maste <emaste@freebsd.org>
      Acked-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Link: http://lore.kernel.org/lkml/20200528170858.48457-1-emaste@freefall.freebsd.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      82352ae2
    • N
      perf jit: Fix inaccurate DWARF line table · 1e4bd2ae
      Nick Gasson 提交于
      Fix an issue where addresses in the DWARF line table are offset by -0x40
      (GEN_ELF_TEXT_OFFSET). This can be seen with `objdump -S` on the ELF
      files after perf inject.
      
      Committer notes:
      
      Ian added this in his Acked-by reply:
      
       ---
      Without too much knowledge this looks good to me. The original code came
      from oprofile's jit support:
      
        https://sourceforge.net/p/oprofile/oprofile/ci/master/tree/opjitconv/debug_line.c#l325
       ---
      Signed-off-by: NNick Gasson <nick.gasson@arm.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200528051916.6722-1-nick.gasson@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1e4bd2ae
    • N
      perf jvmti: Remove redundant jitdump line table entries · 7d7e503c
      Nick Gasson 提交于
      For each PC/BCI pair in the JVMTI compiler inlining record table, the
      jitdump plugin emits debug line table entries for every source line in
      the method preceding that BCI. Instead only emit one source line per
      PC/BCI pair. Reported by Ian Rogers. This reduces the .dump size for
      SPECjbb from ~230MB to ~40MB.
      Signed-off-by: NNick Gasson <nick.gasson@arm.com>
      Acked-by: NIan Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20200528054049.13662-1-nick.gasson@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7d7e503c
    • A
      perf build: Add NO_SDT=1 to the default set of build tests · 60da3a12
      Arnaldo Carvalho de Melo 提交于
      We forgot to add it, so one would have to explicitely ask for it to be
      run, fix that by adding it to the set of tests that are performed by
      default when one does:
      
        $ make -C tools/perf build-test
      
      It was being exercised only in the make_minimal test, this patch makes
      it be tested in isolation, i.e. disabling only this feature.
      
      Fixes: e26e63be ("perf build: Add sdt feature detection")
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      60da3a12