lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNvHx+KxIL6JzEl/@kernel.org>
Date:   Tue, 15 Aug 2023 15:45:27 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Leo Yan <leo.yan@...aro.org>, John Garry <john.g.garry@...cle.com>,
        Will Deacon <will@...nel.org>,
        James Clark <james.clark@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Guo Ren <guoren@...nel.org>,
        Paul Walmsley <paul.walmsley@...ive.com>,
        Palmer Dabbelt <palmer@...belt.com>,
        Albert Ou <aou@...s.berkeley.edu>,
        Huacai Chen <chenhuacai@...nel.org>,
        Ming Wang <wangming01@...ngson.cn>,
        Eric Lin <eric.lin@...ive.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Sandipan Das <sandipan.das@....com>,
        Ivan Babrou <ivan@...udflare.com>,
        Fangrui Song <maskray@...gle.com>,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-perf-users@...r.kernel.org, linux-csky@...r.kernel.org,
        linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v2 0/6] perf parse-regs: Refactor architecture functions

Em Tue, Aug 15, 2023 at 03:24:04PM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Wed, Jul 12, 2023 at 03:37:36PM -0700, Ian Rogers escreveu:
> > On Mon, Jun 5, 2023 at 6:46 PM Leo Yan <leo.yan@...aro.org> wrote:
> > >
> > > 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@...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
> > 
> > Sorry for the slow review. For the series:
> > Acked-by: Ian Rogers <irogers@...gle.com>
> > 
> > Some thoughts:
> > uint64_t __perf_reg_ip_arm(void)
> > uint64_t seems like we're giving a lot of space for future register
> > encodings. I think some of the other functions use this size of value
> > due to returning a bitmap/mask, but here it isn't clear and just feels
> > excessive.
> > 
> > Do we need the "__" prefix on all the functions?
> > 
> > In Makefile.config there are NO_PERF_REGS and CONFIG_PERF_REGS then
> > the define HAVE_PERF_REGS_SUPPORT. Is this still relevant? If we had
> > an architecture with no support, couldn't it still read a perf.data
> > file from a supported architecture? It would be nice to remove at
> > least NO_PERF_REGS and HAVE_PERF_REGS_SUPPORT.
> > 
> > This change is very worthwhile fix and cleanup, it didn't introduce
> > what is pondered above, hence the acked-by.
> 
> Agreed, applied to perf-tools-next, sorry for the delay.

Had to add this to make 'perf test python' to work. Please run 'perf
test' before sending patches.

- Arnaldo

diff --git a/tools/perf/util/python-ext-sources b/tools/perf/util/python-ext-sources
index d4c9b4cd35efa556..26e1c8d973ea0b95 100644
--- a/tools/perf/util/python-ext-sources
+++ b/tools/perf/util/python-ext-sources
@@ -40,3 +40,12 @@ util/rwsem.c
 util/hashmap.c
 util/perf_regs.c
 util/fncache.c
+util/perf-regs-arch/perf_regs_aarch64.c
+util/perf-regs-arch/perf_regs_arm.c
+util/perf-regs-arch/perf_regs_csky.c
+util/perf-regs-arch/perf_regs_loongarch.c
+util/perf-regs-arch/perf_regs_mips.c
+util/perf-regs-arch/perf_regs_powerpc.c
+util/perf-regs-arch/perf_regs_riscv.c
+util/perf-regs-arch/perf_regs_s390.c
+util/perf-regs-arch/perf_regs_x86.c

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ