1. 09 Nov, 2023 6 commits
    • Namhyung Kim's avatar
      perf annotate: Split branch stack cycles information out of 'struct annotation_line' · de2c7eb5
      Namhyung Kim authored
      The cycles info is used only when branch stack is provided.  Separate
      them from 'struct annotation_line' into a separate struct and lazy
      allocate them to save some memory.
      
      Committer notes:
      
      Make annotation__compute_ipc() check if the lazy allocation works,
      bailing out if so, its callers already do error checking and
      propagation.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20231103191907.54531-2-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      de2c7eb5
    • Namhyung Kim's avatar
      perf test: Simplify "object code reading" test · 89d5c48c
      Namhyung Kim authored
      It tries cycles (or cpu-clock on s390) event with exclude_kernel bit to
      open.  But other arch on a VM can fail with the hardware event and need
      to fallback to the software event in the same way.
      
      So let's get rid of the cpuid check and use generic fallback mechanism
      using an array of event candidates.  Now event in the odd index excludes
      the kernel so use that for the return value.
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarJames Clark <james.clark@arm.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Link: https://lore.kernel.org/r/20231103195541.67788-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      89d5c48c
    • Ian Rogers's avatar
      perf machine thread: Remove exited threads by default · 9ffa6c75
      Ian Rogers authored
      'struct thread' values hold onto references to mmaps, DSOs, etc. When a
      thread exits it is necessary to clean all of this memory up by removing
      the thread from the machine's threads. Some tools require this doesn't
      happen, such as auxtrace events, 'perf report' if offcpu events exist or
      if a task list is being generated, so add a 'struct symbol_conf' member
      to make the behavior optional. When an exited thread is left in the
      machine's threads, mark it as exited.
      
      This change relates to commit 40826c45 ("perf thread: Remove
      notion of dead threads") . Dead threads were removed as they had a
      reference count of 0 and were difficult to reason about with the
      reference count checker. Here a thread is removed from threads when it
      exits, unless via symbol_conf the exited thread isn't remove and is
      marked as exited. Reference counting behaves as it normally does.
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Li Dong <lidong@vivo.com>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20231102175735.2272696-6-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9ffa6c75
    • Ian Rogers's avatar
      perf record: Lazy load kernel symbols · 1a27fc01
      Ian Rogers authored
      Commit 5b7ba82a ("perf symbols: Load kernel maps before using")
      changed it so that loading a kernel DSO would cause the symbols for the
      DSO to be eagerly loaded.
      
      For 'perf record' this is overhead as the symbols won't be used. Add a
      field to 'struct symbol_conf' to control the behavior and disable it for
      'perf record' and 'perf inject'.
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: Colin Ian King <colin.i.king@gmail.com>
      Cc: Dmitrii Dolgov <9erthalion6@gmail.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Li Dong <lidong@vivo.com>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Ming Wang <wangming01@loongson.cn>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Steinar H. Gunderson <sesse@google.com>
      Cc: Vincent Whitchurch <vincent.whitchurch@axis.com>
      Cc: Wenyu Liu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Link: https://lore.kernel.org/r/20231102175735.2272696-3-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1a27fc01
    • Colin Ian King's avatar
      perf tools: Fix spelling mistake "parametrized" -> "parameterized" · 7ff7b7af
      Colin Ian King authored
      There are spelling mistakes in comments and a pr_debug message. Fix them.
      Reviewed-by: default avatarAthira Jajeev <atrajeev@linux.vnet.ibm.com>
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.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: Peter Zijlstra <peterz@infradead.org>
      Cc: kernel-janitors@vger.kernel.org
      Link: https://lore.kernel.org/r/20231003074911.220216-1-colin.i.king@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7ff7b7af
    • Kan Liang's avatar
      perf tools: Add branch counter knob · 9fbb4b02
      Kan Liang authored
      Add a new branch filter, "counter", for the branch counter option. It is
      used to mark the events which should be logged in the branch. If it is
      applied with the -j option, the counters of all the events should be
      logged in the branch. If the legacy kernel doesn't support the new
      branch sample type, switching off the branch counter filter.
      
      The stored counter values in each branch are displayed right after the
      regular branch stack information via perf report -D.
      
      Usage examples:
      
        # perf record -e "{branch-instructions,branch-misses}:S" -j any,counter
      
      Only the first event, branch-instructions, collect the LBR. Both
      branch-instructions and branch-misses are marked as logged events.  The
      occurrences information of them can be found in the branch stack
      extension space of each branch.
      
        # perf record -e "{cpu/branch-instructions,branch_type=any/,cpu/branch-misses,branch_type=counter/}"
      
      Only the first event, branch-instructions, collect the LBR. Only the
      branch-misses event is marked as a logged event.
      
      Committer notes:
      
      I noticed 'perf test "Sample parsing"' failing, reported to the list and
      Kan provided a patch that checks if the evsel has a leader and that
      evsel->evlist is set, the comment in the source code further explains
      it.
      Reviewed-by: default avatarIan Rogers <irogers@google.com>
      Signed-off-by: default avatarKan Liang <kan.liang@linux.intel.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: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tinghao Zhang <tinghao.zhang@intel.com>
      Link: https://lore.kernel.org/r/20231025201626.3000228-8-kan.liang@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9fbb4b02
  2. 06 Nov, 2023 2 commits
  3. 03 Nov, 2023 2 commits
  4. 31 Oct, 2023 1 commit
  5. 30 Oct, 2023 1 commit
  6. 28 Oct, 2023 13 commits
  7. 26 Oct, 2023 3 commits
  8. 25 Oct, 2023 12 commits
    • Ian Rogers's avatar
      perf vendor events intel: Fix broadwellde tma_info_system_dram_bw_use metric · 3779416e
      Ian Rogers authored
      Broadwell-de has a consumer core and server uncore. The uncore_arb PMU
      isn't present and the broadwellx style cbox PMU should be used
      instead. Fix the tma_info_system_dram_bw_use metric to use the server
      metric rather than client.
      
      The associated converter script fix is in:
      https://github.com/intel/perfmon/pull/111
      
      Fixes: 7d124303 ("perf vendor events intel: Update broadwell variant events/metrics")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Reviewed-by: default avatarKan Liang <kan.liang@linux.intel.com>
      Cc: Caleb Biggers <caleb.biggers@intel.com>
      Cc: Perry Taylor <perry.taylor@intel.com>
      Link: https://lore.kernel.org/r/20230926031034.1201145-1-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      3779416e
    • Ian Rogers's avatar
      perf mem_info: Add and use map_symbol__exit and addr_map_symbol__exit · 56e144fe
      Ian Rogers authored
      Fix leak where mem_info__put wouldn't release the maps/map as used by
      perf mem. Add exit functions and use elsewhere that the maps and map
      are released.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-12-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      56e144fe
    • Ian Rogers's avatar
      perf callchain: Minor layout changes to callchain_list · dec07fe5
      Ian Rogers authored
      Avoid 6 byte hole for padding. Place more frequently used fields
      first in an attempt to use just 1 cacheline in the common case.
      
      Before:
      ```
      struct callchain_list {
              u64                        ip;                   /*     0     8 */
              struct map_symbol          ms;                   /*     8    24 */
              struct {
                      _Bool              unfolded;             /*    32     1 */
                      _Bool              has_children;         /*    33     1 */
              };                                               /*    32     2 */
      
              /* XXX 6 bytes hole, try to pack */
      
              u64                        branch_count;         /*    40     8 */
              u64                        from_count;           /*    48     8 */
              u64                        predicted_count;      /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              u64                        abort_count;          /*    64     8 */
              u64                        cycles_count;         /*    72     8 */
              u64                        iter_count;           /*    80     8 */
              u64                        iter_cycles;          /*    88     8 */
              struct branch_type_stat *  brtype_stat;          /*    96     8 */
              const char  *              srcline;              /*   104     8 */
              struct list_head           list;                 /*   112    16 */
      
              /* size: 128, cachelines: 2, members: 13 */
              /* sum members: 122, holes: 1, sum holes: 6 */
      };
      ```
      
      After:
      ```
      struct callchain_list {
              struct list_head           list;                 /*     0    16 */
              u64                        ip;                   /*    16     8 */
              struct map_symbol          ms;                   /*    24    24 */
              const char  *              srcline;              /*    48     8 */
              u64                        branch_count;         /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              u64                        from_count;           /*    64     8 */
              u64                        cycles_count;         /*    72     8 */
              u64                        iter_count;           /*    80     8 */
              u64                        iter_cycles;          /*    88     8 */
              struct branch_type_stat *  brtype_stat;          /*    96     8 */
              u64                        predicted_count;      /*   104     8 */
              u64                        abort_count;          /*   112     8 */
              struct {
                      _Bool              unfolded;             /*   120     1 */
                      _Bool              has_children;         /*   121     1 */
              };                                               /*   120     2 */
      
              /* size: 128, cachelines: 2, members: 13 */
              /* padding: 6 */
      };
      ```
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-11-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      dec07fe5
    • Ian Rogers's avatar
      perf callchain: Make brtype_stat in callchain_list optional · 6ba29fbb
      Ian Rogers authored
      struct callchain_list is 352bytes in size, 232 of which are
      brtype_stat. brtype_stat is only used for certain callchain_list
      items so make it optional, allocating when necessary. So that
      printing doesn't need to deal with an optional brtype_stat, pass
      an empty/zero version.
      
      Before:
      ```
      struct callchain_list {
              u64                        ip;                   /*     0     8 */
              struct map_symbol          ms;                   /*     8    24 */
              struct {
                      _Bool              unfolded;             /*    32     1 */
                      _Bool              has_children;         /*    33     1 */
              };                                               /*    32     2 */
      
              /* XXX 6 bytes hole, try to pack */
      
              u64                        branch_count;         /*    40     8 */
              u64                        from_count;           /*    48     8 */
              u64                        predicted_count;      /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              u64                        abort_count;          /*    64     8 */
              u64                        cycles_count;         /*    72     8 */
              u64                        iter_count;           /*    80     8 */
              u64                        iter_cycles;          /*    88     8 */
              struct branch_type_stat    brtype_stat;          /*    96   232 */
              /* --- cacheline 5 boundary (320 bytes) was 8 bytes ago --- */
              const char  *              srcline;              /*   328     8 */
              struct list_head           list;                 /*   336    16 */
      
              /* size: 352, cachelines: 6, members: 13 */
              /* sum members: 346, holes: 1, sum holes: 6 */
              /* last cacheline: 32 bytes */
      };
      ```
      
      After:
      ```
      struct callchain_list {
              u64                        ip;                   /*     0     8 */
              struct map_symbol          ms;                   /*     8    24 */
              struct {
                      _Bool              unfolded;             /*    32     1 */
                      _Bool              has_children;         /*    33     1 */
              };                                               /*    32     2 */
      
              /* XXX 6 bytes hole, try to pack */
      
              u64                        branch_count;         /*    40     8 */
              u64                        from_count;           /*    48     8 */
              u64                        predicted_count;      /*    56     8 */
              /* --- cacheline 1 boundary (64 bytes) --- */
              u64                        abort_count;          /*    64     8 */
              u64                        cycles_count;         /*    72     8 */
              u64                        iter_count;           /*    80     8 */
              u64                        iter_cycles;          /*    88     8 */
              struct branch_type_stat *  brtype_stat;          /*    96     8 */
              const char  *              srcline;              /*   104     8 */
              struct list_head           list;                 /*   112    16 */
      
              /* size: 128, cachelines: 2, members: 13 */
              /* sum members: 122, holes: 1, sum holes: 6 */
      };
      ```
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-10-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      6ba29fbb
    • Ian Rogers's avatar
      perf callchain: Make display use of branch_type_stat const · d47d876d
      Ian Rogers authored
      Display code doesn't modify the branch_type_stat so switch uses to
      const. This is done to aid refactoring struct callchain_list where
      current the branch_type_stat is embedded even if not used.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-9-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      d47d876d
    • Ian Rogers's avatar
      perf offcpu: Add missed btf_free · 67a3ebf1
      Ian Rogers authored
      Caught by address/leak sanitizer.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-8-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      67a3ebf1
    • Ian Rogers's avatar
      perf threads: Remove unused dead thread list · 7b2e444b
      Ian Rogers authored
      Commit 40826c45 ("perf thread: Remove notion of dead threads")
      removed dead threads but the list head wasn't removed. Remove it here.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-7-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      7b2e444b
    • Ian Rogers's avatar
      perf hist: Add missing puts to hist__account_cycles · c1149037
      Ian Rogers authored
      Caught using reference count checking on perf top with
      "--call-graph=lbr". After this no memory leaks were detected.
      
      Fixes: 57849998 ("perf report: Add processing for cycle histograms")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-6-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      c1149037
    • Ian Rogers's avatar
      libperf rc_check: Add RC_CHK_EQUAL · 78c32f4c
      Ian Rogers authored
      Comparing pointers with reference count checking is tricky to avoid a
      SEGV. Add a convenience macro to simplify and use.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-5-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      78c32f4c
    • Ian Rogers's avatar
      libperf rc_check: Make implicit enabling work for GCC · 75265320
      Ian Rogers authored
      Make the implicit REFCOUNT_CHECKING robust to when building with GCC.
      
      Fixes: 9be6ab18 ("libperf rc_check: Enable implicitly with sanitizers")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-4-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      75265320
    • Ian Rogers's avatar
      perf machine: Avoid out of bounds LBR memory read · ab8ce150
      Ian Rogers authored
      Running perf top with address sanitizer and "--call-graph=lbr" fails
      due to reading sample 0 when no samples exist. Add a guard to prevent
      this.
      
      Fixes: e2b23483 ("perf machine: Factor out lbr_callchain_add_lbr_ip()")
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-3-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      ab8ce150
    • Ian Rogers's avatar
      perf rwsem: Add debug mode that uses a mutex · 7a8f349e
      Ian Rogers authored
      Mutex error check will capture trying to take the lock recursively and
      other problems that rwlock won't. At the expense of concurrency, adda
      debug mode that uses a mutex in place of a rwsem.
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: K Prateek Nayak <kprateek.nayak@amd.com>
      Cc: Ravi Bangoria <ravi.bangoria@amd.com>
      Cc: Sandipan Das <sandipan.das@amd.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: German Gomez <german.gomez@arm.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Nick Terrell <terrelln@fb.com>
      Cc: Sean Christopherson <seanjc@google.com>
      Cc: Changbin Du <changbin.du@huawei.com>
      Cc: liuwenyu <liuwenyu7@huawei.com>
      Cc: Yang Jihong <yangjihong1@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Song Liu <song@kernel.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Yanteng Si <siyanteng@loongson.cn>
      Cc: Liam Howlett <liam.howlett@oracle.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: https://lore.kernel.org/r/20231024222353.3024098-2-irogers@google.comSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      7a8f349e