Re: [PATCH/RFT] Re: [PATCH v5 1/8] perf trace: Fix iteration of syscall ids in syscalltbl->entries

From: Namhyung Kim
Date: Wed Oct 09 2024 - 01:57:33 EST


Hello,

On Tue, Oct 08, 2024 at 11:09:31AM +0200, Jiri Slaby wrote:
> On 27. 09. 24, 7:09, Jiri Slaby wrote:
> > On 02. 09. 24, 20:54, Arnaldo Carvalho de Melo wrote:
> > > On Mon, Sep 02, 2024 at 07:25:17AM +0200, Jiri Slaby wrote:
> > > > On 31. 08. 24, 1:30, Arnaldo Carvalho de Melo wrote:
> > > > >   From 174899051e54ecdab06c07652a3d04ad000ab301 Mon Sep 17
> > > > > 00:00:00 2001
> > > > > From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > > > > Date: Fri, 30 Aug 2024 19:53:47 -0300
> > > > > Subject: [PATCH 1/1] perf tools: Build x86 32-bit syscall table from
> > > > >    arch/x86/entry/syscalls/syscall_32.tbl
> > > > >
> > > > > To remove one more use of the audit libs and address a problem reported
> > > > > with a recent change where a function isn't available when using the
> > > > > audit libs method, that should really go away, this being one step in
> > > > > that direction.
> > > > >
> > > > > The script used to generate the 64-bit syscall table was already
> > > > > parametrized to generate for both 64-bit and 32-bit, so just use it and
> > > > > wire the generated table to the syscalltbl.c routines.
> > > > >
> > > > > Reported-by: Jiri Slaby <jirislaby@xxxxxxxxxx>
> > > > > Suggested-by: Ian Rogers <irogers@xxxxxxxxxx>
> > > > > Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> > > > > Cc: Howard Chu <howardchu95@xxxxxxxxx>
> > > > > Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> > > > > Cc: Kan Liang <kan.liang@xxxxxxxxxxxxxxx>
> > > > > Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> > > > > Link: https://lore.kernel.org/lkml/6fe63fa3-6c63-4b75-ac09-884d26f6fb95@xxxxxxxxxx
> > > > > Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > > >
> > > > Tested-by: Jiri Slaby <jirislaby@xxxxxxxxxx>
> > >
> > > Thanks a lot! Added to the cset.
> >
> > Oh, 32bit arm still affected:
> > /usr/lib/gcc/armv7hl-suse-linux-gnueabi/14/../../../../armv7hl-suse-linux-gnueabi/bin/ld: perf-in.o: in function `trace__init_syscalls_bpf_prog_array_maps':
> > tools/perf/builtin-trace.c:3461:(.text+0x899a0): undefined reference to
> > `syscalltbl__id_at_idx'
>
> Ping -- any input/fix for this?

As a quick fix, we may add a dummy syscall table for other archs like
below. Can you please test this?

Thanks,
Namhyung

---8<---
diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c
index 7c15dec6900d8aaa..b7465a879d8bf416 100644
--- a/tools/perf/util/syscalltbl.c
+++ b/tools/perf/util/syscalltbl.c
@@ -46,6 +46,11 @@ static const char *const *syscalltbl_native = syscalltbl_mips_n64;
#include <asm/syscalls.c>
const int syscalltbl_native_max_id = SYSCALLTBL_LOONGARCH_MAX_ID;
static const char *const *syscalltbl_native = syscalltbl_loongarch;
+#else
+const int syscalltbl_native_max_id = 1;
+static const char *const syscalltbl_native[] = {
+ [0] = "unknown",
+};
#endif

struct syscall {