[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAP-5=fWhiLJ97smNySGk+TmmQ=ELOdztqdb7h3hrxT+18wG_HA@mail.gmail.com>
Date: Fri, 8 Nov 2024 15:08:07 -0800
From: Ian Rogers <irogers@...gle.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, Kan Liang <kan.liang@...ux.intel.com>,
John Garry <john.g.garry@...cle.com>, Will Deacon <will@...nel.org>,
James Clark <james.clark@...aro.org>, Mike Leach <mike.leach@...aro.org>,
Leo Yan <leo.yan@...ux.dev>, Guo Ren <guoren@...nel.org>,
Paul Walmsley <paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>, Nick Terrell <terrelln@...com>,
"Masami Hiramatsu (Google)" <mhiramat@...nel.org>, Changbin Du <changbin.du@...wei.com>,
Guilherme Amadio <amadio@...too.org>, Yang Jihong <yangjihong@...edance.com>,
Aditya Gupta <adityag@...ux.ibm.com>, Athira Rajeev <atrajeev@...ux.vnet.ibm.com>,
Masahiro Yamada <masahiroy@...nel.org>, Bibo Mao <maobibo@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>, Kajol Jain <kjain@...ux.ibm.com>,
Atish Patra <atishp@...osinc.com>, Shenlin Liang <liangshenlin@...incomputing.com>,
Anup Patel <anup@...infault.org>, Oliver Upton <oliver.upton@...ux.dev>,
"Steinar H. Gunderson" <sesse@...gle.com>, "Dr. David Alan Gilbert" <linux@...blig.org>,
Chen Pei <cp0613@...ux.alibaba.com>, Dima Kogan <dima@...retsauce.net>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>, "David S. Miller" <davem@...emloft.net>,
Alexander Lobakin <aleksander.lobakin@...el.com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-csky@...r.kernel.org, linux-riscv@...ts.infradead.org
Subject: Re: [PATCH v3 10/20] perf dwarf-regs: Move csky dwarf-regs out of arch
On Fri, Nov 8, 2024 at 12:03 PM Namhyung Kim <namhyung@...nel.org> wrote:
>
> On Wed, Oct 16, 2024 at 05:25:10PM -0700, Ian Rogers wrote:
> > Move arch/csky/util/dwarf-regs.c to util/dwarf-regs-csky.c and compile
> > in unconditionally. To avoid get_arch_regstr being duplicated, rename
> > to get_csky_regstr and add to get_dwarf_regstr switch.
> >
> > Update #ifdefs to allow ABI V1 and V2 tables at the same
> > time. Determine the table from the ELF flags.
> >
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> > ---
> > tools/perf/arch/csky/util/Build | 1 -
> > tools/perf/util/Build | 1 +
> > .../dwarf-regs.c => util/dwarf-regs-csky.c} | 19 ++++++++++---------
> > tools/perf/util/dwarf-regs.c | 11 +++++++----
> > tools/perf/util/include/dwarf-regs.h | 2 ++
> > 5 files changed, 20 insertions(+), 14 deletions(-)
> > rename tools/perf/{arch/csky/util/dwarf-regs.c => util/dwarf-regs-csky.c} (74%)
> >
> > diff --git a/tools/perf/arch/csky/util/Build b/tools/perf/arch/csky/util/Build
> > index 1325310cab6a..5e6ea82c4202 100644
> > --- a/tools/perf/arch/csky/util/Build
> > +++ b/tools/perf/arch/csky/util/Build
> > @@ -1,4 +1,3 @@
> > perf-util-y += perf_regs.o
> >
> > -perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
> > perf-util-$(CONFIG_LIBDW_DWARF_UNWIND) += unwind-libdw.o
> > diff --git a/tools/perf/util/Build b/tools/perf/util/Build
> > index 4c615611b9d7..99ae4e2802b8 100644
> > --- a/tools/perf/util/Build
> > +++ b/tools/perf/util/Build
> > @@ -203,6 +203,7 @@ endif
> > perf-util-$(CONFIG_LIBDW) += probe-finder.o
> > perf-util-$(CONFIG_LIBDW) += dwarf-aux.o
> > perf-util-$(CONFIG_LIBDW) += dwarf-regs.o
> > +perf-util-$(CONFIG_LIBDW) += dwarf-regs-csky.o
> > perf-util-$(CONFIG_LIBDW) += dwarf-regs-x86.o
> > perf-util-$(CONFIG_LIBDW) += debuginfo.o
> > perf-util-$(CONFIG_LIBDW) += annotate-data.o
> > diff --git a/tools/perf/arch/csky/util/dwarf-regs.c b/tools/perf/util/dwarf-regs-csky.c
> > similarity index 74%
> > rename from tools/perf/arch/csky/util/dwarf-regs.c
> > rename to tools/perf/util/dwarf-regs-csky.c
> > index ca86ecaeacbb..d38ef1f07f3e 100644
> > --- a/tools/perf/arch/csky/util/dwarf-regs.c
> > +++ b/tools/perf/util/dwarf-regs-csky.c
> > @@ -5,9 +5,8 @@
> > #include <stddef.h>
> > #include <dwarf-regs.h>
> >
> > -#if defined(__CSKYABIV2__)
> > -#define CSKY_MAX_REGS 73
> > -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = {
> > +#define CSKY_ABIV2_MAX_REGS 73
> > +const char *csky_dwarf_regs_table_abiv2[CSKY_ABIV2_MAX_REGS] = {
> > /* r0 ~ r8 */
> > "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1", "%regs2", "%regs3",
> > /* r9 ~ r15 */
> > @@ -26,9 +25,9 @@ const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = {
> > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> > "%epc",
> > };
> > -#else
> > -#define CSKY_MAX_REGS 57
> > -const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = {
> > +
> > +#define CSKY_ABIV1_MAX_REGS 57
Definition of CSKY_ABIV1_MAX_REGS.
> > +const char *csky_dwarf_regs_table_abiv1[CSKY_ABIV1_MAX_REGS] = {
> > /* r0 ~ r8 */
> > "%sp", "%regs9", "%a0", "%a1", "%a2", "%a3", "%regs0", "%regs1",
> > /* r9 ~ r15 */
> > @@ -41,9 +40,11 @@ const char *csky_dwarf_regs_table[CSKY_MAX_REGS] = {
> > NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
> > "%epc",
> > };
> > -#endif
> >
> > -const char *get_arch_regstr(unsigned int n)
> > +const char *get_csky_regstr(unsigned int n, unsigned int flags)
> > {
> > - return (n < CSKY_MAX_REGS) ? csky_dwarf_regs_table[n] : NULL;
> > + if (flags & EF_CSKY_ABIV2)
>
> Hmm.. you need it here as well.
These constants are part of the dwarf-regs-csky.c file and not elf.h.
> > + return (n < CSKY_ABIV2_MAX_REGS) ? csky_dwarf_regs_table_abiv2[n] : NULL;
> > +
> > + return (n < CSKY_ABIV1_MAX_REGS) ? csky_dwarf_regs_table_abiv1[n] : NULL;
> > }
> > diff --git a/tools/perf/util/dwarf-regs.c b/tools/perf/util/dwarf-regs.c
> > index fd21f9e90e40..9a76f83af62c 100644
> > --- a/tools/perf/util/dwarf-regs.c
> > +++ b/tools/perf/util/dwarf-regs.c
> > @@ -29,17 +29,18 @@
> > #define __get_dwarf_regstr(tbl, n) (((n) < ARRAY_SIZE(tbl)) ? (tbl)[(n)] : NULL)
> >
> > /* Return architecture dependent register string (for kprobe-tracer) */
> > -const char *get_dwarf_regstr(unsigned int n, unsigned int machine,
> > - unsigned int flags __maybe_unused)
> > +const char *get_dwarf_regstr(unsigned int n, unsigned int machine, unsigned int flags)
> > {
> > -#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM
> > +#if EM_HOST == EM_X86_64 || EM_HOST == EM_386 || EM_HOST == EM_AARCH64 || EM_HOST == EM_ARM \
> > + || EM_HOST == EM_CSKY
>
> And here too. It seems you also need a rebase.
>
> At this point, I'm giving up. Can you please refresh the series with
> a fix?
Sure I'll rebase and add ifndef+defines to dwarf-regs.h, I see we have
these currently for EM_AARCH64 and EM_LOONGARCH there.
Thanks,
Ian
Powered by blists - more mailing lists