1. 14 Mar, 2023 16 commits
    • Namhyung Kim's avatar
      perf lock contention: Track and show mmap_lock with address · 3ace2435
      Namhyung Kim authored
      Sometimes there are severe contentions on the mmap_lock and we want
      see it in the -l/--lock-addr output.  However it cannot symbolize
      the mmap_lock because it's allocated dynamically without symbols.
      
      Stephane and Hao gave me an idea separately to display mmap_lock by
      following the current->mm pointer.  I added a flag to mark mmap_lock
      after comparing the lock address so that it can show them differently.
      With this change it can show mmap_lock like below:
      
        $ sudo ./perf lock con -abl -- sleep 10
         contended   total wait     max wait     avg wait            address   symbol
         ...
             16344    312.30 ms      2.22 ms     19.11 us   ffff8cc702595640
             17686    310.08 ms      1.49 ms     17.53 us   ffff8cc7025952c0
                 3     84.14 ms     45.79 ms     28.05 ms   ffff8cc78114c478   mmap_lock
              3557     76.80 ms     68.75 us     21.59 us   ffff8cc77ca3af58
                 1     68.27 ms     68.27 ms     68.27 ms   ffff8cda745dfd70
                 9     54.53 ms      7.96 ms      6.06 ms   ffff8cc7642a48b8   mmap_lock
             14629     44.01 ms     60.00 us      3.01 us   ffff8cc7625f9ca0
              3481     42.63 ms    140.71 us     12.24 us   ffffffff937906ac   vmap_area_lock
             16194     38.73 ms     42.15 us      2.39 us   ffff8cd397cbc560
                11     38.44 ms     10.39 ms      3.49 ms   ffff8ccd6d12fbb8   mmap_lock
                 1      5.43 ms      5.43 ms      5.43 ms   ffff8cd70018f0d8
              1674      5.38 ms    422.93 us      3.21 us   ffffffff92e06080   tasklist_lock
               581      4.51 ms    130.68 us      7.75 us   ffff8cc9b1259058
                 5      3.52 ms      1.27 ms    703.23 us   ffff8cc754510070
               112      3.47 ms     56.47 us     31.02 us   ffff8ccee38b3120
               381      3.31 ms     73.44 us      8.69 us   ffffffff93790690   purge_vmap_area_lock
               255      3.19 ms     36.35 us     12.49 us   ffff8d053ce30c80
      
      Note that mmap_lock was renamed some time ago and it needs to support
      old kernels with a different name 'mmap_sem'.
      Suggested-by: default avatarHao Luo <haoluo@google.com>
      Suggested-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Juri Lelli <juri.lelli@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Waiman Long <longman@redhat.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230313204825.2665483-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3ace2435
    • Ian Rogers's avatar
      perf build: Error if no libelf and NO_LIBELF isn't set · 8d98ca5c
      Ian Rogers authored
      Building without libelf support is going disable a lot of
      functionality. Require that the NO_LIBELF=1 build option is passed if
      this is intentional.
      
      Committer notes:
      
      Add NO_LIBELF=1 to the 'make_static' target in tools/perf/tests/make so
      that 'make -C tools/perf build-test' works.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8d98ca5c
    • Ian Rogers's avatar
      perf build: Remove redundant NO_NEWT build option · f1925bd5
      Ian Rogers authored
      The option controlled nothing and no code depends, conditional or
      otherwise, on libnewt.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1925bd5
    • Ian Rogers's avatar
      perf build: If libtraceevent isn't present error the build · 6898e60f
      Ian Rogers authored
      If libtraceevent isn't present, the build will warn and continue. This
      disables a number of features and so isn't desirable. This change
      makes the build error for this case. The build can still be made to
      happen by adding NO_LIBTRACEEVENT=1.
      
      Committer notes:
      
      Add NO_LIBTRACEEVENT=1 to the 'make_static' target in
      tools/perf/tests/make so that 'make -C tools/perf build-test' works.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6898e60f
    • Ian Rogers's avatar
      perf build: Switch libpfm4 to opt-out rather than opt-in · d7c4f89a
      Ian Rogers authored
      If libpfm4 passes the feature test, it would be nice to have it
      enabled rather than also requiring the LIBPFM4=1 build flag.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d7c4f89a
    • Ian Rogers's avatar
      perf symbol: Add abi::__cxa_demangle C++ demangling support · 3b4e4efe
      Ian Rogers authored
      Refactor C++ demangling out of symbol-elf into its own files similar
      to other languages. Add abi::__cxa_demangle support. As the other
      demanglers are not shippable with distributions, this brings back C++
      demangling in a common case. It isn't perfect as the support for
      optionally demangling arguments and modifiers isn't present.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3b4e4efe
    • Ian Rogers's avatar
      tools build: Add feature test for abi::__cxa_demangle · 4c72e2b3
      Ian Rogers authored
      cxxabi.h is part of libsdtc++ and LLVM's libcxx, providing
      abi::__cxa_demangle a portable C++ demangler. Add a feature test to
      detect that the function is available.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4c72e2b3
    • Ian Rogers's avatar
      perf build: Make binutil libraries opt in · dd317df0
      Ian Rogers authored
      binutils is GPLv3 so distributions cannot ship perf linked against
      libbfd and libiberty as the licenses are incompatible. Rather than
      defaulting the build to opting in to libbfd and libiberty support and
      opting out via NO_LIBBFD=1 and NO_DEMANGLE=1, make building against
      the libraries optional and enabled with BUILD_NONDISTRO=1.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dd317df0
    • Ian Rogers's avatar
      perf build: Error if jevents won't work and NO_JEVENTS=1 isn't set · 175f9315
      Ian Rogers authored
      Rather than disabling jevents if a sufficient python isn't present
      error in the build. This avoids the build progressing but the binary
      being degraded. The build can still succeed by specifying NO_JEVENTS=1
      to the build and this is conveyed in the error message.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      175f9315
    • Ian Rogers's avatar
      perf util: Remove weak sched_getcpu · 0cd3142f
      Ian Rogers authored
      sched_getcpu may not be present and so a feature test and definition
      exist to workaround this in the build. The feature test is used to
      define HAVE_SCHED_GETCPU_SUPPORT and so this is sufficient to know
      whether the local sched_getcpu is needed and a weak symbol can be
      avoided.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0cd3142f
    • Ian Rogers's avatar
      perf build: Remove unused HAVE_GLIBC_SUPPORT · 7bafa03f
      Ian Rogers authored
      HAVE_GLIBC_SUPPORT is only used in `perf version --build-options` but
      doesn't control any behavior. Remove from the build to simplify it.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7bafa03f
    • Ian Rogers's avatar
      perf build: Make BUILD_BPF_SKEL default, rename to NO_BPF_SKEL · a980755b
      Ian Rogers authored
      BPF skeleton support is now key to a number of perf features. Rather
      than making it so that BPF support must be enabled for the build, make
      this the default and error if the build lacks a clang and libbpf that
      are sufficient. To avoid the error and build without BPF skeletons the
      NO_BPF_SKEL=1 flag can be used. Add a build-options flag to 'perf
      version' to enable detection of the BPF skeleton support and use this
      in the offcpu shell test.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a980755b
    • Ian Rogers's avatar
      perf build: Support python/perf.so testing · 7a9b223c
      Ian Rogers authored
      Add a build target to echo the python/perf.so's name from
      Makefile.perf. Use it in tests/make so the correct target is built and
      tested for.
      
      Fixes: caec5470 ("perf build: Fix python/perf.so library's name")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin Liška <mliska@suse.cz>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Pavithra Gurushankar <gpavithrasha@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Quentin Monnet <quentin@isovalent.com>
      Cc: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tiezhu Yang <yangtiezhu@loongson.cn>
      Cc: Tom Rix <trix@redhat.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: llvm@lists.linux.dev
      Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7a9b223c
    • Ian Rogers's avatar
      perf bpf: Remove pre libbpf 1.0 conditional logic · 6bebc06d
      Ian Rogers authored
      Tests are no longer applicable as libbpf 1.0 can be assumed.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked/Tested-by: Jiri Olsa <jolsa@kernel.org>
      Acked/Tested-by: Jiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Christy Lee <christylee@fb.com>
      Cc: Ingo Molnar <mingo@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: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230116010115.490713-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6bebc06d
    • Ian Rogers's avatar
      perf build: Remove libbpf pre-1.0 feature tests · 76a97cf2
      Ian Rogers authored
      The feature tests were necessary for libbpf pre-1.0, but as the libbpf
      implies at least 1.0 we can remove these now.
      
      Committer notes:
      
      Modified tools/perf/Makefile.config to better reflect the reason for
      failure when the libbpf present is < 1.0 and LIBBPF_DYNAMIC=1 was asked
      for.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Christy Lee <christylee@fb.com>
      Cc: Ingo Molnar <mingo@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: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230116010115.490713-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      76a97cf2
    • Ian Rogers's avatar
      tools build: Pass libbpf feature only if libbpf 1.0+ · 56d52294
      Ian Rogers authored
      libbpf 1.0 represented a cleanup and stabilization of APIs. Simplify
      development by only passing the feature test if libbpf 1.0 is installed.
      
      Committer notes:
      
      Change 'make -C tools/perf build-test' so that the LIBBPF_DYNAMIC=1 test
      runs only if libbpf is >= 1.0.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andres Freund <andres@anarazel.de>
      Cc: Andrii Nakryiko <andrii@kernel.org>
      Cc: Christy Lee <christylee@fb.com>
      Cc: Ingo Molnar <mingo@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: Roberto Sassu <roberto.sassu@huawei.com>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230116010115.490713-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      56d52294
  2. 13 Mar, 2023 20 commits
    • Ian Rogers's avatar
      perf lock contention: Fix compiler builtin detection · 17535a33
      Ian Rogers authored
      __has_builtin was passed the macro rather than the actual builtin
      feature. The builtin test isn't sufficient and a clang version test
      also needs to be performed.
      
      Fixes: 1bece135 ("perf lock contention: Support old rw_semaphore type")
      Reviewed-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Martin KaFai Lau <martin.lau@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: bpf@vger.kernel.org
      Link: https://lore.kernel.org/r/20230308003020.3653271-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      17535a33
    • James Clark's avatar
      perf cs-etm: Avoid printing warning in cs_etm_is_ete() check · e5af1397
      James Clark authored
      When checking for the presence of ETE, a register is read that may not
      be present on older kernels or if ETE isn't available. cs_etm_get_ro()
      will print a warning if it doesn't exist, so check for the existence
      first before accessing it.
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Al Grant <al.grant@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      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: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230308094843.287093-1-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e5af1397
    • James Clark's avatar
      perf cs-etm: Reduce verbosity of ts_source warning · 5f968d28
      James Clark authored
      This is printed as a warning but it is normal behavior that users
      shouldn't be expected to do anything about. Reduce the warning level to
      debug3 so it's only seen in verbose mode to avoid confusion.
      
      Reviewed-by: Leo Yan <leo.yan@linaro.org
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Al Grant <al.grant@arm.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      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: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: coresight@lists.linaro.org
      Cc: linux-arm-kernel@lists.infradead.org
      Link: https://lore.kernel.org/r/20230308094843.287093-1-james.clark@arm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5f968d28
    • Thomas Richter's avatar
      perf list: Add PMU pai_ext event description for IBM z16 · d30baf2c
      Thomas Richter authored
      Add the event description for the IBM z16 pai_ext PMU released with
      commit c432fefe ("s390/pai: Add support for PAI Extension 1 NNPA
      counters")
      
      The document SA22-7832-13 "z/Architecture Principles of Operation",
      published May, 2022, contains the description of the
      Processor Activity Instrumentation Facility and the NNPA counter
      set., See Pages 5-113 to 5-116 and chapter 26 for details.
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230308125326.2195613-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d30baf2c
    • Thomas Richter's avatar
      perf vendor events s390: Add cache metrics for z16 · f8a6cea4
      Thomas Richter authored
      Add metrics for s390 z16
      
      - Percentage sourced from Level 2 cache
      - Percentage sourced from Level 3 on same chip cache
      - Percentage sourced from Level 4 Local cache on same book
      - Percentage sourced from Level 4 Remote cache on different book
      - Percentage sourced from memory
      
      For details about the formulas see this documentation:
      https://www.ibm.com/support/pages/system/files/inline-files/CPU%20MF%20Formulas%20including%20z16%20-%20May%202022_1.pdf
      
      Output after:
      
        # ./perf stat -M l4rp -- dd if=/dev/zero of=/dev/null bs=10M count=10K
        .... dd output deleted
      
        Performance counter stats for 'dd if=/dev/zero of=/dev/null bs=10M count=10K':
      
                        0      IDCW_OFF_DRAWER_CHIP_HIT         #     0.00 l4rp
                  431,866      L1I_DIR_WRITES
                    2,395      IDCW_OFF_DRAWER_IV
                        0      ICW_OFF_DRAWER
                        0      IDCW_OFF_DRAWER_DRAWER_HIT
                    1,437      DCW_OFF_DRAWER
              425,960,793      L1D_DIR_WRITES
      
             12.165030699 seconds time elapsed
      
              0.001037000 seconds user
             12.162140000 seconds sys
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-By: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230313080201.2440201-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f8a6cea4
    • Thomas Richter's avatar
      perf vendor events s390: Add common metrics · 74395567
      Thomas Richter authored
      Add 3 metrics for s390 machines:
      
      - Cycles per instruction: Amount of CPU cycles used per instructions,
        named cpi.
      - Problem state ratio: Ratio of instructions executed in problem state
        compared to total number of instructions, named prbstate.
      - Level one instruction and data cache misses per 100 instructions,
        named l1mp.
      
      For details about the formulas see this documentation:
      https://www.ibm.com/support/pages/system/files/inline-files/CPU%20MF%20Formulas%20including%20z16%20-%20May%202022_1.pdf
      
      Output after:
      
        # ./perf stat -M cpi -- dd if=/dev/zero of=/dev/null bs=1M count=10K
        10240+0 records in
        10240+0 records out
        10737418240 bytes (11 GB, 10 GiB) copied, 1.30151 s, 8.2 GB/s
      
        Performance counter stats for 'dd if=/dev/zero of=/dev/null .....':
      
          6,779,778,802      CPU_CYCLES              #     1.96 cpi
          3,461,975,090      INSTRUCTIONS
      
          1.306873021 seconds time elapsed
      
          0.001034000 seconds user
          1.305677000 seconds sys
        #
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Acked-By: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20230313080201.2440201-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      74395567
    • Ian Rogers's avatar
      perf parse-events: Warn when events are regrouped · a4c7d7c5
      Ian Rogers authored
      Use if an event is reordered or the number of groups increases to
      signal that regrouping has happened and warn about it. Disable the
      warning in the case wild card PMU names are used and for metrics.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a4c7d7c5
    • Ian Rogers's avatar
      perf evlist: Remove nr_groups · 9d2dc632
      Ian Rogers authored
      Maintaining the number of groups during event parsing is problematic
      and since changing to sort/regroup events can only be computed by a
      linear pass over the evlist. As the value is generally only used in
      tests, rather than hold it in a variable compute it by passing over
      the evlist when necessary.
      
      This change highlights that libpfm's counting of groups with a single
      entry disagreed with regular event parsing. The libpfm tests are
      updated accordingly.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9d2dc632
    • Ian Rogers's avatar
      perf evsel: Remove use_uncore_alias · e733f87e
      Ian Rogers authored
      This flag used to be used when regrouping uncore events in particular
      due to wildcard matches. This is now handled by sorting evlist and so
      the flag is redundant.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e733f87e
    • Ian Rogers's avatar
      perf parse-events: Sort and group parsed events · 347c2f0a
      Ian Rogers authored
      This change is intended to be a no-op for most current cases, the
      default sort order is the order the events were parsed. Where it
      varies is in how groups are handled. Previously an uncore and core
      event that are grouped would most often cause the group to be removed:
      
      ```
      $ perf stat -e '{instructions,uncore_imc_free_running_0/data_total/}' -a sleep 1
      WARNING: grouped events cpus do not match, disabling group:
        anon group { instructions, uncore_imc_free_running_0/data_total/ }
      ...
      ```
      
      However, when wildcards are used the events should be re-sorted and
      re-grouped in parse_events__set_leader, but this currently fails for
      simple examples:
      
      ```
      $ perf stat -e '{uncore_imc_free_running/data_read/,uncore_imc_free_running/data_write/}' -a sleep 1
      
       Performance counter stats for 'system wide':
      
           <not counted> MiB  uncore_imc_free_running/data_read/
           <not counted> MiB  uncore_imc_free_running/data_write/
      
             1.000996992 seconds time elapsed
      ```
      
      A futher failure mode, fixed in this patch, is to force topdown events
      into a group.
      
      This change moves sorting the evsels in the evlist after parsing. It
      requires parsing to set up groups. First the evsels are sorted
      respecting the existing groupings and parse order, but also reordering
      to ensure evsels of the same PMU and group appear together. So that
      software and aux events respect groups, their pmu_name is taken from
      the group leader. The sorting is done with list_sort removing a memory
      allocation.
      
      After sorting a pass is done to correct the group leaders and for
      topdown events ensuring they have a group leader.
      
      This fixes the problems seen before:
      
      ```
      $ perf stat -e '{uncore_imc_free_running/data_read/,uncore_imc_free_running/data_write/}' -a sleep 1
      
       Performance counter stats for 'system wide':
      
                  727.42 MiB  uncore_imc_free_running/data_read/
                   81.84 MiB  uncore_imc_free_running/data_write/
      
             1.000948615 seconds time elapsed
      ```
      
      As well as making groups not fail for cases like:
      
      ```
      $ perf stat -e '{imc_free_running_0/data_total/,imc_free_running_1/data_total/}' -a sleep 1
      
       Performance counter stats for 'system wide':
      
                  256.47 MiB  imc_free_running_0/data_total/
                  256.48 MiB  imc_free_running_1/data_total/
      
             1.001165442 seconds time elapsed
      ```
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      347c2f0a
    • Ian Rogers's avatar
      perf parse-events: Pass ownership of the group name · 4bb311b2
      Ian Rogers authored
      Pass ownership of the group name rather than copying and freeing the
      original. This saves a memory allocation and copy.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4bb311b2
    • Ian Rogers's avatar
      perf evsel: Add function to compute group PMU name · 7abf0bcc
      Ian Rogers authored
      The computed name respects software events and aux event groups, such
      that the pmu_name is changed to be that of the aux event leader or
      group leader for software events. This is done as a later change will
      split events that are in different PMUs into different groups.
      
      Committer notes:
      
      Added a stub for this new function so that 'perf test python' passes.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7abf0bcc
    • Ian Rogers's avatar
      perf evsel: Allow const evsel for certain accesses · c6d616fe
      Ian Rogers authored
      List sorting, added later to evlist, passes const elements requiring
      helper functions to also be const. Make the argument to
      evsel__find_pmu, evsel__is_aux_event and evsel__leader const.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c6d616fe
    • Ian Rogers's avatar
      perf stat: Modify the group test · ce5b8590
      Ian Rogers authored
      Currently nr_members is 0 for an event with no group, however, they
      are always a leader of their own group. A later change will make that
      count 1 because the event is its own leader. Make the find_stat logic
      consistent with this, an improvement suggested by Namhyung Kim.
      Suggested-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ce5b8590
    • Ian Rogers's avatar
      perf pmu: Earlier PMU auxtrace initialization · 3c7b84d4
      Ian Rogers authored
      This allows event parsing to use the evsel__is_aux_event function,
      which is important when determining event grouping.
      Suggested-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3c7b84d4
    • Ian Rogers's avatar
      perf stat: Don't remove all grouped events when CPU maps disagree · bc6c6cdc
      Ian Rogers authored
      If the events in an evlist's CPU map differ then the entire group is
      removed. For example:
      
      ```
      $ perf stat -e '{imc_free_running/data_read/,imc_free_running/data_write/,cs}' -a sleep 1
      WARNING: grouped events cpus do not match, disabling group:
        anon group { imc_free_running/data_read/, imc_free_running/data_write/, cs }
      ```
      
      Change the behavior so that just the events not matching the leader
      are removed. So in the example above, just 'cs' will be removed.
      
      Modify the warning so that it is produced once for each group, rather
      than once for the entire evlist. Shrink the scope and size of the
      warning text buffer.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bc6c6cdc
    • Ian Rogers's avatar
      libperf evlist: Avoid a use of evsel idx · 5dd827e0
      Ian Rogers authored
      Setting the leader iterates the list, so rather than use idx (which
      may be changed through list reordering) just count the elements and
      set afterwards.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Florian Fischer <florian.fischer@muhq.space>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: John Garry <john.g.garry@oracle.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230312021543.3060328-2-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5dd827e0
    • Changbin Du's avatar
      perf ftrace: Reuse target::initial_delay · f9f60efb
      Changbin Du authored
      Replace perf_ftrace::initial_delay with target::initial_delay.
      Specifying a negative initial_delay is meaningless for ftrace in
      practice but allowed here.
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hui Wang <hw.huiwang@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230302031146.2801588-4-changbin.du@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9f60efb
    • Changbin Du's avatar
      perf record: Reuse target::initial_delay · cb4b9e68
      Changbin Du authored
      This just simply replace record_opts::initial_delay with
      target::initial_delay. Nothing else is changed.
      Signed-off-by: default avatarChangbin Du <changbin.du@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Hui Wang <hw.huiwang@huawei.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230302031146.2801588-3-changbin.du@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cb4b9e68
    • Kan Liang's avatar
      perf record: Fix "read LOST count failed" msg with sample read · 07d85ba9
      Kan Liang authored
      Hundreds of "read LOST count failed" error messages may be displayed,
      when the below command is launched.
      
      perf record -e '{cpu/mem-loads-aux/,cpu/event=0xcd,umask=0x1/}:S' -a
      
      According to the commit 89e3106f ("libperf: Handle read format
      in perf_evsel__read()"), the PERF_FORMAT_GROUP is only available for
      the leader. However, the record__read_lost_samples() goes through every
      entry of an evlist, which includes both leader and member. The member
      event errors out and triggers the error message. Since there may be
      hundreds of CPUs on a server, the message will be printed hundreds of
      times, which is very annoying.
      
      The message itself is correct, but the pr_err is a overkill. Other error
      messages in the record__read_lost_samples() are all pr_debug. To make
      the output format consistent, change the pr_err("read LOST count
      failed\n"); to pr_debug("read LOST count failed\n");.
      User can still get the message via -v option.
      
      Fixes: e3a23261 ("perf record: Read and inject LOST_SAMPLES events")
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20230301150413.27011-1-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      07d85ba9
  3. 10 Mar, 2023 4 commits
    • Arnaldo Carvalho de Melo's avatar
      Merge remote-tracking branch 'acme/perf-tools' into perf-tools-next · b8fa3e38
      Arnaldo Carvalho de Melo authored
      To pick up perf-tools fixes just merged upstream.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b8fa3e38
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 55a21105
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - RISC-V architecture-specific ELF attributes have been disabled in the
         kernel builds
      
       - A fix for a locking failure while during errata patching that
         manifests on SiFive-based systems
      
       - A fix for a KASAN failure during stack unwinding
      
       - A fix for some lockdep failures during text patching
      
      * tag 'riscv-for-linus-6.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Don't check text_mutex during stop_machine
        riscv: Use READ_ONCE_NOCHECK in imprecise unwinding stack mode
        RISC-V: fix taking the text_mutex twice during sifive errata patching
        RISC-V: Stop emitting attributes
      55a21105
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2023-03-10' of git://anongit.freedesktop.org/drm/drm · b0d14d2a
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Weekly fixes.
      
        msm and amdgpu are the vast majority of these, otherwise some
        straggler misc from last week for nouveau and cirrus and a mailmap
        update for a drm developer.
      
        mailmap:
         - add an entry
      
        nouveau:
         - fix system shutdown regression
         - build warning fix
      
        cirrus:
         - NULL ptr deref fix
      
        msm:
         - fix invalid ptr free in syncobj cleanup
         - sync GMU removal in teardown
         - a5xx preemption fixes
         - fix runpm imbalance
         - DPU hw fixes
         - stack corruption fix
         - clear DSPP reservation
      
        amdgpu:
         - Misc display fixes
         - UMC 8.10 fixes
         - Driver unload fixes
         - NBIO 7.3.0 fix
         - Error checking fixes for soc15, nv, soc21 read register interface
         - Fix video cap query for VCN 4.0.4
      
        amdkfd:
         - Fix return check in doorbell handling"
      
      * tag 'drm-fixes-2023-03-10' of git://anongit.freedesktop.org/drm/drm: (42 commits)
        drm/amdgpu/soc21: Add video cap query support for VCN_4_0_4
        drm/amdgpu: fix error checking in amdgpu_read_mm_registers for nv
        drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc21
        drm/amdgpu: fix error checking in amdgpu_read_mm_registers for soc15
        drm/amdgpu: Fix the warning info when removing amdgpu device
        drm/amdgpu: fix return value check in kfd
        drm/amd: Fix initialization mistake for NBIO 7.3.0
        drm/amdgpu: Fix call trace warning and hang when removing amdgpu device
        mailmap: add mailmap entries for Faith.
        drm/msm: DEVFREQ_GOV_SIMPLE_ONDEMAND is no longer needed
        drm/amd/display: Update clock table to include highest clock setting
        drm/amd/pm: Enable ecc_info table support for smu v13_0_10
        drm/amdgpu: Support umc node harvest config on umc v8_10
        drm/connector: print max_requested_bpc in state debugfs
        drm/display: Don't block HDR_OUTPUT_METADATA on unknown EOTF
        drm/msm/dpu: clear DSPP reservations in rm release
        drm/msm/disp/dpu: fix sc7280_pp base offset
        drm/msm/dpu: fix stack smashing in dpu_hw_ctl_setup_blendstage
        drm/msm/dpu: don't use DPU_CLK_CTRL_CURSORn for DMA SSPP clocks
        drm/msm/dpu: fix clocks settings for msm8998 SSPP blocks
        ...
      b0d14d2a
    • Linus Torvalds's avatar
      Merge tag 'erofs-for-6.3-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs · 388a8101
      Linus Torvalds authored
      Pull erofs fixes from Gao Xiang:
       "The most important one reverts an improper fix which can cause an
        unexpected warning more often on specific images, and another one
        fixes LZMA decompression on 32-bit platforms. The others are minor
        fixes and cleanups.
      
         - Fix LZMA decompression failure on HIGHMEM platforms
      
         - Revert an inproper fix since it is actually an implementation issue
           of vmalloc()
      
         - Avoid a wrong DBG_BUGON since it could be triggered with -EINTR
      
         - Minor cleanups"
      
      * tag 'erofs-for-6.3-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs:
        erofs: use wrapper i_blocksize() in erofs_file_read_iter()
        erofs: get rid of a useless DBG_BUGON
        erofs: Revert "erofs: fix kvcalloc() misuse with __GFP_NOFAIL"
        erofs: fix wrong kunmap when using LZMA on HIGHMEM platforms
        erofs: mark z_erofs_lzma_init/erofs_pcpubuf_init w/ __init
      388a8101