1. 11 2月, 2021 6 次提交
  2. 10 2月, 2021 2 次提交
  3. 09 2月, 2021 4 次提交
  4. 04 2月, 2021 14 次提交
  5. 16 1月, 2021 11 次提交
    • A
      perf inject: Correct event attribute sizes · 648b054a
      Al Grant 提交于
      When 'perf inject' reads a perf.data file from an older version of perf,
      it writes event attributes into the output with the original size field,
      but lays them out as if they had the size currently used. Readers see a
      corrupt file. Update the size field to match the layout.
      Signed-off-by: NAl Grant <al.grant@foss.arm.com>
      Acked-by: NJiri Olsa <jolsa@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>
      Link: http://lore.kernel.org/lkml/20201124195818.30603-1-al.grant@arm.comSigned-off-by: NDenis Nikitin <denik@chromium.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      648b054a
    • A
      perf intel-pt: Fix 'CPU too large' error · 5501e922
      Adrian Hunter 提交于
      In some cases, the number of cpus (nr_cpus_online) is confused with the
      maximum cpu number (nr_cpus_avail), which results in the error in the
      example below:
      
      Example on system with 8 cpus:
      
       Before:
         # echo 0 > /sys/devices/system/cpu/cpu2/online
         # ./perf record --kcore -e intel_pt// taskset --cpu-list 7 uname
         Linux
         [ perf record: Woken up 1 times to write data ]
         [ perf record: Captured and wrote 0.147 MB perf.data ]
         # ./perf script --itrace=e
         Requested CPU 7 too large. Consider raising MAX_NR_CPUS
         0x25908 [0x8]: failed to process type: 68 [Invalid argument]
      
       After:
         # ./perf script --itrace=e
         #
      
      Fixes: 8c727469 ("perf machine: Replace MAX_NR_CPUS with perf_env::nr_cpus_online")
      Fixes: 7df4e36a ("perf session: Replace MAX_NR_CPUS with perf_env::nr_cpus_online")
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Tested-by: NKan Liang <kan.liang@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: stable@vger.kernel.org
      Link: http://lore.kernel.org/lkml/20210107174159.24897-1-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5501e922
    • N
      perf stat: Take cgroups into account for shadow stats · a1bf2305
      Namhyung Kim 提交于
      As of now it doesn't consider cgroups when collecting shadow stats and
      metrics so counter values from different cgroups will be saved in a same
      slot.  This resulted in incorrect numbers when those cgroups have
      different workloads.
      
      For example, let's look at the scenario below: cgroups A and C runs same
      workload which burns a cpu while cgroup B runs a light workload.
      
        $ perf stat -a -e cycles,instructions --for-each-cgroup A,B,C  sleep 1
      
         Performance counter stats for 'system wide':
      
           3,958,116,522      cycles                A
           6,722,650,929      instructions          A #    2.53  insn per cycle
               1,132,741      cycles                B
                 571,743      instructions          B #    0.00  insn per cycle
           4,007,799,935      cycles                C
           6,793,181,523      instructions          C #    2.56  insn per cycle
      
             1.001050869 seconds time elapsed
      
      When I run 'perf stat' with single workload, it usually shows IPC around
      1.7.  We can verify it (6,722,650,929.0 / 3,958,116,522 = 1.698) for cgroup A.
      
      But in this case, since cgroups are ignored, cycles are averaged so it
      used the lower value for IPC calculation and resulted in around 2.5.
      
        avg cycle: (3958116522 + 1132741 + 4007799935) / 3 = 2655683066
        IPC (A)  :  6722650929 / 2655683066 = 2.531
        IPC (B)  :      571743 / 2655683066 = 0.0002
        IPC (C)  :  6793181523 / 2655683066 = 2.557
      
      We can simply compare cgroup pointers in the evsel and it'll be NULL
      when cgroups are not specified.  With this patch, I can see correct
      numbers like below:
      
        $ perf stat -a -e cycles,instructions --for-each-cgroup A,B,C  sleep 1
      
        Performance counter stats for 'system wide':
      
           4,171,051,687      cycles                A
           7,219,793,922      instructions          A #    1.73  insn per cycle
               1,051,189      cycles                B
                 583,102      instructions          B #    0.55  insn per cycle
           4,171,124,710      cycles                C
           7,192,944,580      instructions          C #    1.72  insn per cycle
      
             1.007909814 seconds time elapsed
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@redhat.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: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210115071139.257042-2-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a1bf2305
    • N
      perf stat: Introduce struct runtime_stat_data · 3ff1e718
      Namhyung Kim 提交于
      To pass more info to the saved_value in the runtime_stat, add a new
      struct runtime_stat_data.  Currently it only has 'ctx' field but later
      patch will add more.
      
      Note that we intentionally pass 0 as ctx to clock-related events for
      compatibility.  It was already there in a few places.  So move the code
      into the saved_value_lookup() explicitly and add a comment.
      Suggested-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@redhat.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: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210115071139.257042-1-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3ff1e718
    • I
      libperf tests: Fail when failing to get a tracepoint id · 66dd86b2
      Ian Rogers 提交于
      Permissions are necessary to get a tracepoint id. Fail the test when the
      read fails.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Acked-by: NJiri Olsa <jolsa@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: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210114180250.3853825-2-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      66dd86b2
    • I
      libperf tests: If a test fails return non-zero · bba2ea17
      Ian Rogers 提交于
      If a test fails return -1 rather than 0. This is consistent with the
      return value in test-cpumap.c
      Signed-off-by: NIan Rogers <irogers@google.com>
      Acked-by: NJiri Olsa <jolsa@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: Stephane Eranian <eranian@google.com>
      Link: http://lore.kernel.org/lkml/20210114180250.3853825-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bba2ea17
    • I
      libperf tests: Avoid uninitialized variable warning · be82fddc
      Ian Rogers 提交于
      The variable 'bf' is read (for a write call) without being initialized
      triggering a memory sanitizer warning. Use 'bf' in the read and switch
      the write to reading from a string.
      Signed-off-by: NIan Rogers <irogers@google.com>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.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/20210114212304.4018119-1-irogers@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      be82fddc
    • N
      perf test: Fix shadow stat test for non-bash shells · a042a82d
      Namhyung Kim 提交于
      It was using some bash-specific features and failed to parse when
      running with a different shell like below:
      
        root@kbl-ppc:~/kbl-ws/perf-dev/lck-9077/acme.tmp/tools/perf# ./perf test 83 -vv
        83: perf stat metrics (shadow stat) test                            :
        --- start ---
        test child forked, pid 3922
        ./tests/shell/stat+shadow_stat.sh: 19: ./tests/shell/stat+shadow_stat.sh: [[: not found
        ./tests/shell/stat+shadow_stat.sh: 24: ./tests/shell/stat+shadow_stat.sh: [[: not found
        ./tests/shell/stat+shadow_stat.sh: 30: ./tests/shell/stat+shadow_stat.sh: [[: not found
        (standard_in) 2: syntax error
        ./tests/shell/stat+shadow_stat.sh: 36: ./tests/shell/stat+shadow_stat.sh: [[: not found
        ./tests/shell/stat+shadow_stat.sh: 19: ./tests/shell/stat+shadow_stat.sh: [[: not found
        ./tests/shell/stat+shadow_stat.sh: 24: ./tests/shell/stat+shadow_stat.sh: [[: not found
        ./tests/shell/stat+shadow_stat.sh: 30: ./tests/shell/stat+shadow_stat.sh: [[: not found
        (standard_in) 2: syntax error
        ./tests/shell/stat+shadow_stat.sh: 36: ./tests/shell/stat+shadow_stat.sh: [[: not found
        ./tests/shell/stat+shadow_stat.sh: 45: ./tests/shell/stat+shadow_stat.sh: declare: not found
        test child finished with -1
        ---- end ----
        perf stat metrics (shadow stat) test: FAILED!
      Reported-by: NJin Yao <yao.jin@linux.intel.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NJiri Olsa <jolsa@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Laight <david.laight@aculab.com>
      Cc: Ian Rogers <irogers@google.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/20210114050609.1258820-1-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a042a82d
    • A
      tools headers: Syncronize linux/build_bug.h with the kernel sources · addbdff2
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        3a176b94 ("Revert "kbuild: avoid static_assert for genksyms"")
      
      And silence this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/linux/build_bug.h' differs from latest version at 'include/linux/build_bug.h'
        diff -u tools/include/linux/build_bug.h include/linux/build_bug.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      addbdff2
    • A
      tools headers UAPI: Sync kvm.h headers with the kernel sources · 38c53947
      Arnaldo Carvalho de Melo 提交于
      To pick the changes in:
      
        647daca2 ("KVM: SVM: Add support for booting APs in an SEV-ES guest")
      
      That don't cause any tooling change, just silences this perf build
      warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
        diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      38c53947
    • A
      perf bpf examples: Fix bpf.h header include directive in 5sec.c example · 301f0203
      Arnaldo Carvalho de Melo 提交于
      It was looking at bpf/bpf.h, which caused this problem:
      
        # perf trace -e tools/perf/examples/bpf/5sec.c
        /home/acme/git/perf/tools/perf/examples/bpf/5sec.c:42:10: fatal error: 'bpf/bpf.h' file not found
        #include <bpf/bpf.h>
                 ^~~~~~~~~~~
        1 error generated.
        ERROR:	unable to compile tools/perf/examples/bpf/5sec.c
        Hint:	Check error message shown above.
        Hint:	You can also pre-compile it into .o using:
             		clang -target bpf -O2 -c tools/perf/examples/bpf/5sec.c
             	with proper -I and -D options.
        event syntax error: 'tools/perf/examples/bpf/5sec.c'
                             \___ Failed to load tools/perf/examples/bpf/5sec.c from source: Error when compiling BPF scriptlet
        #
      
      Change that to plain bpf.h, to make it work again:
      
        # perf trace -e tools/perf/examples/bpf/5sec.c sleep 5s
             0.000 perf_bpf_probe:hrtimer_nanosleep(__probe_ip: -1776891872, rqtp: 5000000000)
        # perf trace -e tools/perf/examples/bpf/5sec.c/max-stack=16/ sleep 5s
             0.000 perf_bpf_probe:hrtimer_nanosleep(__probe_ip: -1776891872, rqtp: 5000000000)
                                               hrtimer_nanosleep ([kernel.kallsyms])
                                               common_nsleep ([kernel.kallsyms])
                                               __x64_sys_clock_nanosleep ([kernel.kallsyms])
                                               do_syscall_64 ([kernel.kallsyms])
                                               entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
                                               __clock_nanosleep_2 (/usr/lib64/libc-2.32.so)
        # perf trace -e tools/perf/examples/bpf/5sec.c sleep 4s
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      301f0203
  6. 15 1月, 2021 1 次提交
  7. 14 1月, 2021 1 次提交
  8. 10 1月, 2021 1 次提交
    • C
      selftests: netfilter: Pass family parameter "-f" to conntrack tool · fab336b4
      Chen Yi 提交于
      Fix nft_conntrack_helper.sh false fail report:
      
      1) Conntrack tool need "-f ipv6" parameter to show out ipv6 traffic items.
      
      2) Sleep 1 second after background nc send packet, to make sure check
      is after this statement executed.
      
      False report:
      FAIL: ns1-lkjUemYw did not show attached helper ip set via ruleset
      PASS: ns1-lkjUemYw connection on port 2121 has ftp helper attached
      ...
      
      After fix:
      PASS: ns1-2hUniwU2 connection on port 2121 has ftp helper attached
      PASS: ns2-2hUniwU2 connection on port 2121 has ftp helper attached
      ...
      
      Fixes: 619ae8e0 ("selftests: netfilter: add test case for conntrack helper assignment")
      Signed-off-by: NChen Yi <yiche@redhat.com>
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      fab336b4