public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v1 00/11] perf annotate arch clean up
@ 2026-01-22  7:31 Ian Rogers
  2026-01-22  7:31 ` [PATCH v1 01/11] perf maps: Fix reference count leak in maps__find_ams Ian Rogers
                   ` (11 more replies)
  0 siblings, 12 replies; 17+ messages in thread
From: Ian Rogers @ 2026-01-22  7:31 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, James Clark, John Garry, Will Deacon, Leo Yan,
	Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Nathan Chancellor, Nick Desaulniers,
	Bill Wendling, Justin Stitt, Zecheng Li, Tianyou Li,
	Thomas Falcon, Julia Lawall, Suchit Karunakaran, Athira Rajeev,
	Aditya Bodkhe, Howard Chu, Krzysztof Łopatowski,
	Dr. David Alan Gilbert, Shimin Guo, Sergei Trofimovich,
	linux-kernel, linux-perf-users, linux-arm-kernel, linux-csky,
	linux-riscv

2 initial memory leak fix patches for perf annotate.

Move the disasm.c #included arch files into a new util/annotate-arch
directory. Make the code compile standalone. Try to better encapsulate
architecture specific code within the files and with a
arch__new_<arch> function that allows additional data to be associated
with the struct arch using the standard container_of trick.

Make the lookup of struct arch use the ELF machine gather from a
thread rather than an evsel. For example, the evsel can't determine
the difference between EM_386 and EM_X86_64 so generally the latter
has currently been used. This means the dwarf registers are off as
register 1 is CX with EM_386 and DX with EM_X86_64. To facilitate this
change map_symbol is refactored to use a struct thread rather than a
struct maps, the maps being obtainable from the thread.

To make in and out arguments clearer, for safety, etc. try to constify
struct arch and its related structs.

Ian Rogers (11):
  perf maps: Fix reference count leak in maps__find_ams
  perf annotate: Fix args leak of map_symbol
  perf disasm: Constify use of struct arch
  perf disasm: Constify use of struct ins_op
  perf disasm: Constify use of struct ins
  perf disasm: Rework the string arch__is to use the ELF machine
  perf disasm: Don't include C files from the arch directory
  perf disasm: Refactor ins__is_call/jump to avoid exposing arch ins_ops
  perf map_symbol: Switch from holding maps to holding thread
  perf disasm: Refactor arch__find and initialization of arch structs
  perf disasm: Minor layout tweaks for struct arch

 tools/perf/arch/arc/annotate/instructions.c   |  11 -
 .../perf/arch/riscv64/annotate/instructions.c |  36 --
 tools/perf/ui/browsers/annotate.c             |   6 +-
 tools/perf/ui/browsers/hists.c                |   3 +-
 tools/perf/util/Build                         |   1 +
 tools/perf/util/addr_location.c               |   4 -
 tools/perf/util/addr_location.h               |   1 -
 tools/perf/util/annotate-arch/Build           |  11 +
 tools/perf/util/annotate-arch/annotate-arc.c  |  18 +
 .../annotate-arch/annotate-arm.c}             |  48 +-
 .../annotate-arch/annotate-arm64.c}           |  59 +--
 .../annotate-arch/annotate-csky.c}            |  29 +-
 .../annotate-arch/annotate-loongarch.c}       |  57 ++-
 .../annotate-arch/annotate-mips.c}            |  29 +-
 .../annotate-arch/annotate-powerpc.c}         | 125 +++++-
 .../util/annotate-arch/annotate-riscv64.c     |  41 ++
 .../annotate-arch/annotate-s390.c}            |  59 ++-
 .../annotate-arch/annotate-sparc.c}           |  26 +-
 .../annotate-arch/annotate-x86.c}             |  89 ++--
 tools/perf/util/annotate-data.c               |  12 +-
 tools/perf/util/annotate-data.h               |   2 +-
 tools/perf/util/annotate.c                    |  88 ++--
 tools/perf/util/annotate.h                    |  10 +-
 tools/perf/util/callchain.c                   |  12 +-
 tools/perf/util/capstone.c                    |  18 +-
 tools/perf/util/db-export.c                   |   1 -
 tools/perf/util/disasm.c                      | 424 +++++++-----------
 tools/perf/util/disasm.h                      |  95 ++--
 tools/perf/util/event.c                       |   2 -
 tools/perf/util/hist.c                        |  18 +-
 tools/perf/util/llvm.c                        |   8 +-
 tools/perf/util/machine.c                     |  13 +-
 tools/perf/util/map_symbol.c                  |   5 +-
 tools/perf/util/map_symbol.h                  |   3 +-
 tools/perf/util/maps.c                        |   1 +
 tools/perf/util/sort.c                        |   2 +-
 tools/perf/util/unwind-libdw.c                |   2 +-
 tools/perf/util/unwind-libunwind-local.c      |   2 +-
 38 files changed, 752 insertions(+), 619 deletions(-)
 delete mode 100644 tools/perf/arch/arc/annotate/instructions.c
 delete mode 100644 tools/perf/arch/riscv64/annotate/instructions.c
 create mode 100644 tools/perf/util/annotate-arch/Build
 create mode 100644 tools/perf/util/annotate-arch/annotate-arc.c
 rename tools/perf/{arch/arm/annotate/instructions.c => util/annotate-arch/annotate-arm.c} (59%)
 rename tools/perf/{arch/arm64/annotate/instructions.c => util/annotate-arch/annotate-arm64.c} (70%)
 rename tools/perf/{arch/csky/annotate/instructions.c => util/annotate-arch/annotate-csky.c} (67%)
 rename tools/perf/{arch/loongarch/annotate/instructions.c => util/annotate-arch/annotate-loongarch.c} (66%)
 rename tools/perf/{arch/mips/annotate/instructions.c => util/annotate-arch/annotate-mips.c} (59%)
 rename tools/perf/{arch/powerpc/annotate/instructions.c => util/annotate-arch/annotate-powerpc.c} (73%)
 create mode 100644 tools/perf/util/annotate-arch/annotate-riscv64.c
 rename tools/perf/{arch/s390/annotate/instructions.c => util/annotate-arch/annotate-s390.c} (70%)
 rename tools/perf/{arch/sparc/annotate/instructions.c => util/annotate-arch/annotate-sparc.c} (85%)
 rename tools/perf/{arch/x86/annotate/instructions.c => util/annotate-arch/annotate-x86.c} (93%)

-- 
2.52.0.457.g6b5491de43-goog



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2026-01-22 16:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22  7:31 [PATCH v1 00/11] perf annotate arch clean up Ian Rogers
2026-01-22  7:31 ` [PATCH v1 01/11] perf maps: Fix reference count leak in maps__find_ams Ian Rogers
2026-01-22  7:31 ` [PATCH v1 02/11] perf annotate: Fix args leak of map_symbol Ian Rogers
2026-01-22 11:46   ` Suchit Karunakaran
2026-01-22 16:05     ` Ian Rogers
2026-01-22  7:31 ` [PATCH v1 03/11] perf disasm: Constify use of struct arch Ian Rogers
2026-01-22  7:31 ` [PATCH v1 04/11] perf disasm: Constify use of struct ins_op Ian Rogers
2026-01-22  7:31 ` [PATCH v1 05/11] perf disasm: Constify use of struct ins Ian Rogers
2026-01-22  7:31 ` [PATCH v1 06/11] perf disasm: Rework the string arch__is to use the ELF machine Ian Rogers
2026-01-22  7:31 ` [PATCH v1 07/11] perf disasm: Don't include C files from the arch directory Ian Rogers
2026-01-22  7:31 ` [PATCH v1 08/11] perf disasm: Refactor ins__is_call/jump to avoid exposing arch ins_ops Ian Rogers
2026-01-22  7:31 ` [PATCH v1 09/11] perf map_symbol: Switch from holding maps to holding thread Ian Rogers
2026-01-22  7:31 ` [PATCH v1 10/11] perf disasm: Refactor arch__find and initialization of arch structs Ian Rogers
2026-01-22  7:31 ` [PATCH v1 11/11] perf disasm: Minor layout tweaks for struct arch Ian Rogers
2026-01-22 10:43 ` [PATCH v1 00/11] perf annotate arch clean up James Clark
2026-01-22 10:47   ` James Clark
2026-01-22 11:56     ` Suchit Karunakaran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox