linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] perf parse-regs: Refactor architecture functions
@ 2023-06-06  1:45 Leo Yan
  2023-06-06  1:45 ` [PATCH v2 1/6] perf parse-regs: Refactor arch register parsing functions Leo Yan
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Leo Yan @ 2023-06-06  1:45 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, John Garry, Will Deacon, James Clark,
	Mike Leach, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Alexander Shishkin, Jiri Olsa, Namhyung Kim, Ian Rogers,
	Adrian Hunter, Guo Ren, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Huacai Chen, Ming Wang, Eric Lin, Kan Liang, Sandipan Das,
	Ivan Babrou, Fangrui Song, linux-kernel, linux-arm-kernel,
	linux-perf-users, linux-csky, linux-riscv
  Cc: Leo Yan

This patch series is to refactor arch related functions for register
parsing, which follows up the discussion for v1:
https://lore.kernel.org/lkml/20230520025537.1811986-1-leo.yan@linaro.org/

Compared to patch series v1, this patch series introduces new functions
perf_arch_reg_{ip|sp}(), so this can allow the tool to support cross
analysis.

To verify the cross analysis, I used below steps:

- Firstly, I captured perf data on Arm64 machine:

  $ perf record --call-graph fp -- ./test_program

  Or ...

  $ perf record --call-graph dwarf -- ./test_program

  Then, I also archived associated debug data:

  $ perf archive

- Secondly, I copied the perf data file and debug tar file on my x86
  machine:

  $ scp perf.data perf.data.tar.bz2 leoy@IP_ADDRESS:/target/path/

- On x86 machine, I need to build perf for support multi-arch unwinding:

  $ git clone http://git.savannah.gnu.org/r/libunwind.git
  $ cd libunwind
  $ autoreconf -i

  # Build and install libunwind aarch64:
  $ ./configure prefix=/home/leoy/Work/tools/libunwind/install/ \
	--target=aarch64-linux-gnu CC=x86_64-linux-gnu-gcc
  $ make && make install

  # Build and install libunwind x86:
  $ ./configure prefix=/home/leoy/Work/tools/libunwind/install/ \
	--target=x86_64-linux-gnu CC=x86_64-linux-gnu-gcc
  $ make && make install

- Build perf tool for support multi-archs:

  $ cd $LINUX/tools/perf
  $ make VF=1 DEBUG=1 LIBUNWIND_DIR=/home/leoy/Work/tools/libunwind/install

At the end, I verified the x86 perf tool can do cross analysis for aarch64's
perf data file.

Note, I still see x86 perf tool cannot display the complete callgraph
for aarch64, but it should not the issue caused by this series, which
will be addressed by separate patches.

I also built this patch series on my Arm64 and x86 machines, both can
compile perf tool successfully; but I have no chance to build other
archs natively.

Changes from v1:
- For support cross analysis for IP/SP registers, introduced patch 0002
  (James Clark, Ian Rogers).


Leo Yan (6):
  perf parse-regs: Refactor arch register parsing functions
  perf parse-regs: Introduce functions perf_arch_reg_{ip|sp}()
  perf unwind: Use perf_arch_reg_{ip|sp}() to substitute macros
  perf parse-regs: Remove unused macros PERF_REG_{IP|SP}
  perf parse-regs: Remove PERF_REGS_{MAX|MASK} from common code
  perf parse-regs: Move out arch specific header from util/perf_regs.h

 tools/perf/arch/arm/include/perf_regs.h       |   3 -
 tools/perf/arch/arm/util/perf_regs.c          |  11 +
 tools/perf/arch/arm/util/unwind-libdw.c       |   1 +
 tools/perf/arch/arm64/include/perf_regs.h     |   3 -
 tools/perf/arch/arm64/util/machine.c          |   1 +
 tools/perf/arch/arm64/util/perf_regs.c        |   6 +
 tools/perf/arch/arm64/util/unwind-libdw.c     |   1 +
 tools/perf/arch/csky/include/perf_regs.h      |   3 -
 tools/perf/arch/csky/util/perf_regs.c         |  11 +
 tools/perf/arch/csky/util/unwind-libdw.c      |   1 +
 tools/perf/arch/loongarch/include/perf_regs.h |   2 -
 tools/perf/arch/loongarch/util/perf_regs.c    |  11 +
 tools/perf/arch/loongarch/util/unwind-libdw.c |   1 +
 tools/perf/arch/mips/include/perf_regs.h      |   2 -
 tools/perf/arch/mips/util/perf_regs.c         |  11 +
 tools/perf/arch/powerpc/include/perf_regs.h   |   3 -
 tools/perf/arch/powerpc/util/perf_regs.c      |   6 +
 tools/perf/arch/powerpc/util/unwind-libdw.c   |   1 +
 tools/perf/arch/riscv/include/perf_regs.h     |   3 -
 tools/perf/arch/riscv/util/perf_regs.c        |  11 +
 tools/perf/arch/riscv/util/unwind-libdw.c     |   1 +
 tools/perf/arch/s390/include/perf_regs.h      |   3 -
 tools/perf/arch/s390/util/perf_regs.c         |  11 +
 tools/perf/arch/s390/util/unwind-libdw.c      |   1 +
 tools/perf/arch/x86/include/perf_regs.h       |   2 -
 tools/perf/arch/x86/util/perf_regs.c          |   6 +
 tools/perf/arch/x86/util/unwind-libdw.c       |   1 +
 tools/perf/util/Build                         |   1 +
 tools/perf/util/evsel.c                       |   6 +-
 tools/perf/util/libunwind/arm64.c             |   2 -
 tools/perf/util/libunwind/x86_32.c            |   2 -
 tools/perf/util/perf-regs-arch/Build          |   9 +
 .../util/perf-regs-arch/perf_regs_aarch64.c   |  96 +++
 .../perf/util/perf-regs-arch/perf_regs_arm.c  |  60 ++
 .../perf/util/perf-regs-arch/perf_regs_csky.c | 100 +++
 .../util/perf-regs-arch/perf_regs_loongarch.c |  91 +++
 .../perf/util/perf-regs-arch/perf_regs_mips.c |  87 ++
 .../util/perf-regs-arch/perf_regs_powerpc.c   | 145 ++++
 .../util/perf-regs-arch/perf_regs_riscv.c     |  92 +++
 .../perf/util/perf-regs-arch/perf_regs_s390.c |  96 +++
 .../perf/util/perf-regs-arch/perf_regs_x86.c  |  98 +++
 tools/perf/util/perf_regs.c                   | 772 ++----------------
 tools/perf/util/perf_regs.h                   |  49 +-
 tools/perf/util/unwind-libdw.c                |   7 +-
 tools/perf/util/unwind-libunwind-local.c      |   6 +-
 tools/perf/util/unwind.h                      |   8 -
 46 files changed, 1078 insertions(+), 766 deletions(-)
 create mode 100644 tools/perf/util/perf-regs-arch/Build
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_aarch64.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_arm.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_csky.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_loongarch.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_mips.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_powerpc.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_riscv.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_s390.c
 create mode 100644 tools/perf/util/perf-regs-arch/perf_regs_x86.c

-- 
2.34.1


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

end of thread, other threads:[~2023-08-17  9:24 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06  1:45 [PATCH v2 0/6] perf parse-regs: Refactor architecture functions Leo Yan
2023-06-06  1:45 ` [PATCH v2 1/6] perf parse-regs: Refactor arch register parsing functions Leo Yan
2023-06-06  1:45 ` [PATCH v2 2/6] perf parse-regs: Introduce functions perf_arch_reg_{ip|sp}() Leo Yan
2023-06-06  1:45 ` [PATCH v2 3/6] perf unwind: Use perf_arch_reg_{ip|sp}() to substitute macros Leo Yan
2023-06-06  1:45 ` [PATCH v2 4/6] perf parse-regs: Remove unused macros PERF_REG_{IP|SP} Leo Yan
2023-06-06  1:45 ` [PATCH v2 5/6] perf parse-regs: Remove PERF_REGS_{MAX|MASK} from common code Leo Yan
2023-06-06  1:45 ` [PATCH v2 6/6] perf parse-regs: Move out arch specific header from util/perf_regs.h Leo Yan
2023-07-12 22:37 ` [PATCH v2 0/6] perf parse-regs: Refactor architecture functions Ian Rogers
2023-08-15 18:24   ` Arnaldo Carvalho de Melo
2023-08-15 18:45     ` Arnaldo Carvalho de Melo
2023-08-15 18:52       ` Arnaldo Carvalho de Melo
2023-08-15 18:57         ` Arnaldo Carvalho de Melo
2023-08-16  2:07           ` Leo Yan
2023-08-16 11:46             ` Arnaldo Carvalho de Melo
2023-08-16 11:48               ` Arnaldo Carvalho de Melo
2023-08-17  9:23                 ` Leo Yan
2023-08-17  9:12               ` Leo Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).