Skip to content
  1. Apr 18, 2023
    • Arnaldo Carvalho de Melo's avatar
      f94c21df
    • Arnaldo Carvalho de Melo's avatar
      perf namespaces: Use the need_setns() accessors instead of accessing ->need_setns directly · 4d623903
      Arnaldo Carvalho de Melo authored
      
      
      This uses pre-existing accessors and reduces the use of
      RC_CHK_ACCESS(nsi).
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4d623903
    • Ian Rogers's avatar
      perf namespaces: Add reference count checking · c35ce1d9
      Ian Rogers authored
      
      
      Add reference count checking controlled by REFCNT_CHECKING ifdef. The
      reference count checking interposes an allocated pointer between the
      reference counted struct on a get and frees the pointer on a put.
      Accesses after a put cause faults and use after free, missed puts are
      caughts as leaks and double puts are double frees.
      
      This checking helped resolve a memory leak and use after free:
      https://lore.kernel.org/linux-perf-users/CAP-5=fWZH20L4kv-BwVtGLwR=Em3AOOT+Q4QGivvQuYn5AsPRg@mail.gmail.com/
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Link: https://lore.kernel.org/lkml/20230407230405.2931830-4-irogers@google.com
      [ Extracted from a larger patch ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c35ce1d9
    • Arnaldo Carvalho de Melo's avatar
      perf dso: Add dso__filename_with_chroot() to reduce number of accesses to dso->nsinfo members · 7031edac
      Arnaldo Carvalho de Melo authored
      
      
      We'll need to reference count dso->nsinfo, so reduce the number of
      direct accesses by having a shorter form of obtaining a filename with
      a chroot (namespace one).
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Link: https://lore.kernel.org/lkml/ZD26ZlqSbgSyH5lX@kernel.org
      [ Used nsinfo__pid(dso->nsinfo), as it was already present ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7031edac
    • Ian Rogers's avatar
      perf cpumap: Add reference count checking · da885a0e
      Ian Rogers authored
      
      
      Enabled when REFCNT_CHECKING is defined. The change adds a memory
      allocated pointer that is interposed between the reference counted cpu
      map at a get and freed by a put. The pointer replaces the original
      perf_cpu_map struct, so use of the perf_cpu_map via APIs remains
      unchanged. Any use of the cpu map without the API requires two versions,
      handled via the RC_CHK_ACCESS macro.
      
      This change is intended to catch:
      
       - use after put: using a cpumap after you have put it will cause a
         segv.
       - unbalanced puts: two puts for a get will result in a double free
         that can be captured and reported by tools like address sanitizer,
         including with the associated stack traces of allocation and frees.
       - missing puts: if a put is missing then the get turns into a memory
         leak that can be reported by leak sanitizer, including the stack
         trace at the point the get occurs.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.com>
      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: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>,
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: https://lore.kernel.org/lkml/20230407230405.2931830-3-irogers@google.com
      [ Extracted from a larger patch ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      da885a0e
    • Ian Rogers's avatar
      perf cpumap: Use perf_cpu_map__cpu(map, cpu) instead of accessing map->map[cpu] directly · 491b13c4
      Ian Rogers authored
      
      
      So that we can validate the 'map' instance wrt refcount checking.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Link: https://lore.kernel.org/lkml/20230407230405.2931830-3-irogers@google.com
      [ Extracted from a larger patch ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      491b13c4
    • Arnaldo Carvalho de Melo's avatar
      perf cpumap: Remove initializations done in perf_cpu_map__alloc() · d57fd492
      Arnaldo Carvalho de Melo authored
      When extracting this patch from Ian's original patch I forgot to remove
      the setting of ->nr and ->refcnt, no need to do those initializations
      again as those are done in perf_cpu_map__alloc() already, duh.
      
      Cc: Ian Rogers <irogers@google.com>
      Fixes: 1f94479e
      
       ("libperf: Make perf_cpu_map__alloc() available as an internal function for tools/perf to use")
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d57fd492
    • Ian Rogers's avatar
      libperf: Add reference count checking macros · a9b867f6
      Ian Rogers authored
      
      
      The macros serve as a way to debug use of a reference counted struct.
      
      The macros add a memory allocated pointer that is interposed between
      the reference counted original struct at a get and freed by a put.
      
      The pointer replaces the original struct, so use of the struct name
      via APIs remains unchanged.
      
      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: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Darren Hart <dvhart@infradead.org>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Hao Luo <haoluo@google.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: Leo Yan <leo.yan@linaro.org>
      Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miaoqian Lin <linmq006@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Shunsuke Nakamura <nakamura.shun@fujitsu.com>
      Cc: Song Liu <song@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Yury Norov <yury.norov@gmail.com>
      Link: http://lore.kernel.org/lkml/20230407230405.2931830-2-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a9b867f6
    • Arnaldo Carvalho de Melo's avatar
      libperf: Add perf_cpu_map__refcnt() interanl accessor to use in the maps test · 4121234a
      Arnaldo Carvalho de Melo authored
      
      
      To remove one more direct access to 'struct perf_cpu_map' so that we can
      intercept accesses to its instantiations and refcount check it to catch
      use after free, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Link: https://lore.kernel.org/lkml/ZD1qdYjG+DL6KOfP@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4121234a
  2. Apr 15, 2023
    • Arnaldo Carvalho de Melo's avatar
      perf test: Simplify for_each_test() to avoid tripping on -Werror=array-bounds · 17354d15
      Arnaldo Carvalho de Melo authored
      
      
      When cross building on debian to the mips 32-bit arch we get these
      warnings:
      
        In function '__cmd_test',
            inlined from 'cmd_test' at tests/builtin-test.c:561:9:
        tests/builtin-test.c:260:66: error: array subscript 1 is outside array bounds of 'struct test_suite *[1]' [-Werror=array-bounds]
          260 |                 for (k = 0, t = tests[j][k]; tests[j][k]; k++, t = tests[j][k])
              |                                                                  ^
        tests/builtin-test.c:369:9: note: in expansion of macro 'for_each_test'
          369 |         for_each_test(j, k, t) {
              |         ^~~~~~~~~~~~~
        tests/builtin-test.c: In function 'cmd_test':
        tests/builtin-test.c:36:27: note: at offset 4 into object 'arch_tests' of size 4
           36 | struct test_suite *__weak arch_tests[] = {
              |                           ^~~~~~~~~~
        cc1: all warnings being treated as errors
      
      Switch to using a while(!sentinel) for the second level of the 'tests'
      array to avoid that compiler complaint.
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      17354d15
  3. Apr 14, 2023
    • Markus Elfring's avatar
      perf map: Delete two variable initialisations before null pointer checks in sort__sym_from_cmp() · c160118a
      Markus Elfring authored
      Addresses of two data structure members were determined before
      corresponding null pointer checks in the implementation of the function
      “sort__sym_from_cmp”.
      
      Thus avoid the risk for undefined behaviour by removing extra
      initialisations for the local variables “from_l” and “from_r” (also
      because they were already reassigned with the same value behind this
      pointer check).
      
      This issue was detected by using the Coccinelle software.
      
      Fixes: 1b9e97a2
      
       ("perf tools: Fix report -F symbol_from for data without branch info")
      Signed-off-by: default avatar <elfring@users.sourceforge.net>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/cocci/54a21fea-64e3-de67-82ef-d61b90ffad05@web.de/
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c160118a
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for tigerlake · ee31f6fe
      Ian Rogers authored
      
      
      Move events from 'uncore-other' topic classification to interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-22-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ee31f6fe
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for snowridgex · 2bb848f8
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-21-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      2bb848f8
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for skylakex · 748d5cf7
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect, io and memory.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-20-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      748d5cf7
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for skylake · 9a8b3036
      Ian Rogers authored
      
      
      Move events from 'uncore-other' topic classification to cache and
      interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-19-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a8b3036
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for sandybridge · f58468a8
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache and
      interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-18-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f58468a8
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for knightslanding · 6c3566c5
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache, io and
      memory.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-17-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6c3566c5
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for jaketown · 05c74de4
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-16-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      05c74de4
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for ivytown · 14b4c544
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-15-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      14b4c544
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for ivybridge · c2f38d3b
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache and
      interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-14-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c2f38d3b
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for icelakex · f42a7d02
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-13-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f42a7d02
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for icelake · bc4a245a
      Ian Rogers authored
      
      
      Move events from 'uncore-other' topic classification to interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-12-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bc4a245a
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for haswellx · 579c0472
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-11-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      579c0472
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for haswell · 6910f7ba
      Ian Rogers authored
      
      
      Move events from 'uncore-other' topic classification to cache and
      interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-10-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6910f7ba
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for cascadelakex · b3eb533c
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect, io and memory.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-9-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3eb533c
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for broadwellx · c9f485c6
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-8-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c9f485c6
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for broadwellde · 55b7bcef
      Ian Rogers authored
      
      
      Remove 'uncore-other' topic classification, move to cache,
      interconnect and io.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-7-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      55b7bcef
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for broadwell · 14182557
      Ian Rogers authored
      
      
      Reduce the number of 'uncore-other' topic classifications, move to
      cache and interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-6-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      14182557
    • Ian Rogers's avatar
      perf vendor events intel: Fix uncore topics for alderlake · 759e8150
      Ian Rogers authored
      
      
      Move events from 'uncore-other' topic classification to interconnect.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-5-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      759e8150
    • Ian Rogers's avatar
      perf vendor events intel: Add sierraforest · 98806c08
      Ian Rogers authored
      
      
      Add v1.00 from:
      https://github.com/intel/perfmon/pull/69
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-4-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      98806c08
    • Ian Rogers's avatar
      perf vendor events intel: Add grandridge · dbe9d887
      Ian Rogers authored
      
      
      Add v1.00 from:
      https://github.com/intel/perfmon/pull/69
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: https://lore.kernel.org/r/20230413132949.3487664-3-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dbe9d887
    • Ian Rogers's avatar
      perf vendor events intel: Update sapphirerapids to v1.12 · 54f5de6f
      Ian Rogers authored
      
      
      Summary from https://github.com/intel/perfmon/pull/68
       - Numerous uncore event additions and changes.
       - Description updates for core events XQ.FULL_CYCLES and MISC2_RETIRED.LFENCE.
       - Update ARITH.IDIV_ACTIVE counter mask.
      
      This change also gets rid of uncore-other as a topic, derived from the
      file name, breaking it apart in to more specific topics.
      
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Edward Baker <edward.baker@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
      Link: http://lore.kernel.org/lkml/20230413132949.3487664-2-irogers@google.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54f5de6f
  4. Apr 13, 2023
  5. Apr 12, 2023
    • Arnaldo Carvalho de Melo's avatar
      perf map: Add map__refcnt() accessor to use in the maps test · 4e8db2d7
      Arnaldo Carvalho de Melo authored
      
      
      To remove one more direct access to 'struct map' so that we can intecept
      accesses to its instantiations and refcount check it to catch use after
      free, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Cc: Dmitriy Vyukov <dvyukov@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Riccardo Mancini <rickyman7@gmail.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Stephen Brennan <stephen.s.brennan@oracle.com>
      Link: https://lore.kernel.org/lkml/ZDbRIJknafLnDwtO@kernel.org
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4e8db2d7
    • Alexander Pantyukhin's avatar
      perf scripts python intel-pt-events: Delete unused 'event_attr variable · 984abd34
      Alexander Pantyukhin authored
      
      
      The 'event_attr' is never used later, the var is ok be deleted.
      
      Additional code simplification is to substitute string slice comparison
      with "substring" function. This case no need to know the length specific
      words.
      
      Signed-off-by: default avatarAlexander Pantyukhin <apantykhin@gmail.com>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20230114130533.2877-1-apantykhin@gmail.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      984abd34
    • Hangliang Lai's avatar
      perf top: Expand the range of multithreaded phase · eab50517
      Hangliang Lai authored
      
      
      In __cmd_top(), perf_set_multithreaded() is used to enable
      pthread_rwlock, thus down_read() and down_write () are not nops,
      handling concurrency problems
      
      Then 'perf top' uses perf_set_singlethreaded(), switching to the single
      threaded phase, assuming that no thread concurrency will happen later.
      
      However, a use after free problem could occur in the single threaded
      phase, the concurrent procedure is this:
      
      display_thread                              process_thread
      --------------                              --------------
      thread__comm_len
        -> thread__comm_str
          -> __thread__comm_str(thread)
                                                  thread__delete
                                                   -> comm__free
                                                    -> comm_str__put
                                                     -> zfree(&cs->str)
          -> thread->comm_len = strlen(comm);
      
      Since in single thread phase, perf_singlethreaded is true, down_read()
      and down_write() do nothing to avoid concurrency problems.
      
      This patch moves the perf_set_singlethreaded() call to the function tail
      to expand the multithreaded phase range, making display_thread() and
      process_thread() concurrency safe.
      
      Reviewed-by: default avatarYunfeng Ye <yeyunfeng@huawei.com>
      Signed-off-by: default avatarHangliang Lai <laihangliang1@huawei.com>
      Co-developed-by: default avatarWenyu Liu <liuwenyu7@huawei.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Christian Brauner <brauner@kernel.org>
      Cc: Feilong Lin <linfeilong@huawei.com>
      Cc: Hewenliang <hewenliang4@huawei.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Link: https://lore.kernel.org/r/20230411013224.2079-1-laihangliang1@huawei.com
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      eab50517