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

From: Namhyung Kim
Date: Thu Oct 10 2024 - 12:30:55 EST


On Thu, Oct 10, 2024 at 10:22:12AM +0200, Jiri Slaby wrote:
> On 09. 10. 24, 8:58, Howard Chu wrote:
> > If Namhyung's fix alone does not solve the problem please try this:
>
> Hi,
>
> it obviously did not. But this one indeed does.
>
> > --- 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;
>
> This ^^^ should be 0 IMO. Look:
> for (i = 0; i <= syscalltbl_native_max_id; ++i)
> if (syscalltbl_native[i])
> ++nr_entries;

Right.

>
> > +static const char *const syscalltbl_native[] = {
> > + [0] = "unknown",
> > +};
> > #endif
> >
> > struct syscall {
> > @@ -182,6 +187,11 @@ int syscalltbl__id(struct syscalltbl *tbl, const
> > char *name)
> > return audit_name_to_syscall(name, tbl->audit_machine);
> > }
> >
> > +int syscalltbl__id_at_idx(struct syscalltbl *tbl __maybe_unused, int idx)
> > +{
> > + return idx;
> > +}
>
> This looks somewhat familiar :):
> https://lore.kernel.org/all/739001a4-4df1-4dec-a141-926c78c5c07e@xxxxxxxxxx/
>
> I am attaching an updated patch.
>
> thanks,
> --
> js
> suse labs

> From 3d4f06d79c949a8f155c20652b4f685540899ad4 Mon Sep 17 00:00:00 2001
> From: Jiri Slaby <jslaby@xxxxxxx>
> Date: Thu, 10 Oct 2024 09:57:07 +0200
> Subject: [PATCH] perf: fix non-listed archs
>
> Suggested-by: Howard Chu <howardchu95@xxxxxxxxx>
> Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>

Acked-by: Namhyung Kim <namhyung@xxxxxxxxxx>

Arnaldo, can you please pick this up for v6.12?

Thanks,
Namhyung

> ---
> tools/perf/util/syscalltbl.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/tools/perf/util/syscalltbl.c b/tools/perf/util/syscalltbl.c
> index 7c15dec6900d..6c45ded922b6 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 = 0;
> +static const char *const syscalltbl_native[] = {
> + [0] = "unknown",
> +};
> #endif
>
> struct syscall {
> @@ -182,6 +187,11 @@ int syscalltbl__id(struct syscalltbl *tbl, const char *name)
> return audit_name_to_syscall(name, tbl->audit_machine);
> }
>
> +int syscalltbl__id_at_idx(struct syscalltbl *tbl __maybe_unused, int idx)
> +{
> + return idx;
> +}
> +
> int syscalltbl__strglobmatch_next(struct syscalltbl *tbl __maybe_unused,
> const char *syscall_glob __maybe_unused, int *idx __maybe_unused)
> {
> --
> 2.46.1
>