From: Charlie Jenkins <charlie@rivosinc.com>
To: Ian Rogers <irogers@google.com>
Cc: "Peter Zijlstra" <peterz@infradead.org>,
"Ingo Molnar" <mingo@redhat.com>,
"Arnaldo Carvalho de Melo" <acme@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Mark Rutland" <mark.rutland@arm.com>,
"Alexander Shishkin" <alexander.shishkin@linux.intel.com>,
"Jiri Olsa" <jolsa@kernel.org>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"Kan Liang" <kan.liang@linux.intel.com>,
"John Garry" <john.g.garry@oracle.com>,
"Will Deacon" <will@kernel.org>,
"James Clark" <james.clark@linaro.org>,
"Mike Leach" <mike.leach@linaro.org>,
"Leo Yan" <leo.yan@linux.dev>, "Guo Ren" <guoren@kernel.org>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Bibo Mao" <maobibo@loongson.cn>, "Arnd Bergmann" <arnd@arndb.de>,
"Huacai Chen" <chenhuacai@kernel.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Jiri Slaby" <jirislaby@kernel.org>,
"Björn Töpel" <bjorn@rivosinc.com>,
"Howard Chu" <howardchu95@gmail.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org,
linux-riscv@lists.infradead.org
Subject: Re: [PATCH v1 0/7] perf: Support multiple system call tables in the build
Date: Mon, 3 Feb 2025 12:06:45 -0800 [thread overview]
Message-ID: <Z6Eh1QLuqTbUKLCc@ghost> (raw)
In-Reply-To: <CAP-5=fX1hCNWWmGJPKYxj93S=zM1-eRucqzb4WW5fB_sZBCRLg@mail.gmail.com>
On Mon, Feb 03, 2025 at 11:39:01AM -0800, Ian Rogers wrote:
> On Mon, Feb 3, 2025 at 11:15 AM Charlie Jenkins <charlie@rivosinc.com> wrote:
> >
> > On Mon, Feb 03, 2025 at 11:10:49AM -0800, Ian Rogers wrote:
> > > On Mon, Feb 3, 2025 at 11:02 AM Charlie Jenkins <charlie@rivosinc.com> wrote:
> > > >
> > > > On Fri, Jan 31, 2025 at 11:14:48PM -0800, Ian Rogers wrote:
> > > > > This work builds on the clean up of system call tables and removal of
> > > > > libaudit by Charlie Jenkins <charlie@rivosinc.com>.
> > > > >
> > > > > The system call table in perf trace is used to map system call numbers
> > > > > to names and vice versa. Prior to these changes, a single table
> > > > > matching the perf binary's build was present. The table would be
> > > > > incorrect if tracing say a 32-bit binary from a 64-bit version of
> > > > > perf, the names and numbers wouldn't match.
> > > > >
> > > > > Change the build so that a single system call file is built and the
> > > > > potentially multiple tables are identifiable from the ELF machine type
> > > > > of the process being examined. To determine the ELF machine type, the
> > > > > executable's header is read from /proc/pid/exe with fallbacks to using
> > > > > the perf's binary type when unknown.
> > > > >
> > > > > Remove some runtime types used by the system call tables and make
> > > > > equivalents generated at build time.
> > > >
> > > > Our approaches are very different but I sent out a patch to do this a
> > > > couple of weeks ago [1].
> > > >
> > > > Did you look at that and decide you didn't like the approach?
> > >
> > > Missing link?
> >
> > Whoops here is the link:
> >
> > https://lore.kernel.org/all/20250114-perf_syscall_arch_runtime-v1-1-5b304e408e11@rivosinc.com/
>
> I agree it is similar and progress, I think I prefer my changes :-)
>
> Anything in the arch directories is only going to be built given a
> Makefile SRCARCH:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/arch/Build?h=perf-tools-next#n2
> which means if we want the system call tables for say ARM on x86-64 we
> need to reinvent the build - this isn't a problem today but perhaps
> something to consider if we wanted a cross-architecture perf trace
> record. I'd like to do away entirely with the arch directory for this
> kind of reason. For example, if we run perf on a user space emulator
> (say a testing set up) and it sees AMD data fabric PMUs, logic for
> those PMUs currently lives in the arch directory for x86 and likely
> wasn't even built into the perf tool. We should be able to identify
> PMUs and act accordingly based on their names. In the case of the
> overloaded "cpu" PMU we can identify it with the CPUID. The less code
> in arch and the fewer architecture ifdefs, the better things should
> work cross-architecture, in testing scenarios, etc. We also win by
> getting code coverage without, for example, having to build and test
> on csky or super H.
>
> Your changes are using the string for the architecture name. I think
> that string is something we should get rid of:
> https://lore.kernel.org/lkml/CAP-5=fX2BtFzhGLCSqO1QszqfX=HT8RrTdG_5Ttp5Gw4seSstA@mail.gmail.com/
> but there's no reason we couldn't clean that up on top of your change.
Yes that part is not ideal.
>
> The build with lots of separate Build/Makefiles is something of a pain
> to port/maintain in a bazel version of the build I maintain at Google
> (happy to open source if anyone cares). In these changes you just run
> a big script and get a big header file out the end, which largely
> matches the other perf trace beauty things we build.
Fair enough! I wanted to mimic how the kernel was building the syscall
tables as closely as possible, it's convenient to have cohesion.
What is the usecase for the bazel version?
- Charlie
>
> Thanks,
> Ian
>
> > >
> > > The patches generating a syscall(_32|_64)?.h landed. These changes
> > > take your changes and make it so that we just run the script once
> > > building a header file for all architectures. On x86 we then have the
> > > tables be guarded by ifdefs on i386 and x86-64. Then rather than the
> > > table just matching the host architecture the ELF machine is used for
> > > the executable running.
> > >
> > > Thanks,
> > > Ian
> > >
> > > > - Charlie
> > > >
> > > > >
> > > > > Ian Rogers (7):
> > > > > perf syscalltble: Remove syscall_table.h
> > > > > perf trace: Reorganize syscalls
> > > > > perf syscalltbl: Remove struct syscalltbl
> > > > > perf thread: Add support for reading the e_machine type for a thread
> > > > > perf trace beauty: Add syscalltbl.sh generating all system call tables
> > > > > perf syscalltbl: Use lookup table containing multiple architectures
> > > > > perf build: Remove Makefile.syscalls
> > > > >
> > > > > tools/perf/Makefile.perf | 10 +-
> > > > > tools/perf/arch/alpha/entry/syscalls/Kbuild | 2 -
> > > > > .../alpha/entry/syscalls/Makefile.syscalls | 5 -
> > > > > tools/perf/arch/alpha/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/arc/entry/syscalls/Kbuild | 2 -
> > > > > .../arch/arc/entry/syscalls/Makefile.syscalls | 3 -
> > > > > tools/perf/arch/arc/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/arm/entry/syscalls/Kbuild | 4 -
> > > > > .../arch/arm/entry/syscalls/Makefile.syscalls | 2 -
> > > > > tools/perf/arch/arm/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/arm64/entry/syscalls/Kbuild | 3 -
> > > > > .../arm64/entry/syscalls/Makefile.syscalls | 6 -
> > > > > tools/perf/arch/arm64/include/syscall_table.h | 8 -
> > > > > tools/perf/arch/csky/entry/syscalls/Kbuild | 2 -
> > > > > .../csky/entry/syscalls/Makefile.syscalls | 3 -
> > > > > tools/perf/arch/csky/include/syscall_table.h | 2 -
> > > > > .../perf/arch/loongarch/entry/syscalls/Kbuild | 2 -
> > > > > .../entry/syscalls/Makefile.syscalls | 3 -
> > > > > .../arch/loongarch/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/mips/entry/syscalls/Kbuild | 2 -
> > > > > .../mips/entry/syscalls/Makefile.syscalls | 5 -
> > > > > tools/perf/arch/mips/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/parisc/entry/syscalls/Kbuild | 3 -
> > > > > .../parisc/entry/syscalls/Makefile.syscalls | 6 -
> > > > > .../perf/arch/parisc/include/syscall_table.h | 8 -
> > > > > tools/perf/arch/powerpc/entry/syscalls/Kbuild | 3 -
> > > > > .../powerpc/entry/syscalls/Makefile.syscalls | 6 -
> > > > > .../perf/arch/powerpc/include/syscall_table.h | 8 -
> > > > > tools/perf/arch/riscv/entry/syscalls/Kbuild | 2 -
> > > > > .../riscv/entry/syscalls/Makefile.syscalls | 4 -
> > > > > tools/perf/arch/riscv/include/syscall_table.h | 8 -
> > > > > tools/perf/arch/s390/entry/syscalls/Kbuild | 2 -
> > > > > .../s390/entry/syscalls/Makefile.syscalls | 5 -
> > > > > tools/perf/arch/s390/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/sh/entry/syscalls/Kbuild | 2 -
> > > > > .../arch/sh/entry/syscalls/Makefile.syscalls | 4 -
> > > > > tools/perf/arch/sh/include/syscall_table.h | 2 -
> > > > > tools/perf/arch/sparc/entry/syscalls/Kbuild | 3 -
> > > > > .../sparc/entry/syscalls/Makefile.syscalls | 5 -
> > > > > tools/perf/arch/sparc/include/syscall_table.h | 8 -
> > > > > tools/perf/arch/x86/entry/syscalls/Kbuild | 3 -
> > > > > .../arch/x86/entry/syscalls/Makefile.syscalls | 6 -
> > > > > tools/perf/arch/x86/include/syscall_table.h | 8 -
> > > > > tools/perf/arch/xtensa/entry/syscalls/Kbuild | 2 -
> > > > > .../xtensa/entry/syscalls/Makefile.syscalls | 4 -
> > > > > .../perf/arch/xtensa/include/syscall_table.h | 2 -
> > > > > tools/perf/builtin-trace.c | 275 +++++++++++-------
> > > > > tools/perf/scripts/Makefile.syscalls | 61 ----
> > > > > tools/perf/scripts/syscalltbl.sh | 86 ------
> > > > > tools/perf/trace/beauty/syscalltbl.sh | 274 +++++++++++++++++
> > > > > tools/perf/util/syscalltbl.c | 142 ++++-----
> > > > > tools/perf/util/syscalltbl.h | 22 +-
> > > > > tools/perf/util/thread.c | 50 ++++
> > > > > tools/perf/util/thread.h | 14 +-
> > > > > 54 files changed, 598 insertions(+), 506 deletions(-)
> > > > > delete mode 100644 tools/perf/arch/alpha/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/alpha/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/alpha/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/arc/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/arc/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/arc/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/arm/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/arm/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/arm/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/arm64/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/arm64/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/arm64/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/csky/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/csky/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/csky/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/loongarch/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/loongarch/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/loongarch/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/mips/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/mips/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/mips/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/parisc/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/parisc/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/parisc/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/powerpc/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/powerpc/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/powerpc/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/riscv/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/riscv/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/riscv/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/s390/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/s390/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/s390/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/sh/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/sh/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/sh/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/sparc/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/sparc/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/sparc/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/x86/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/x86/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/x86/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/arch/xtensa/entry/syscalls/Kbuild
> > > > > delete mode 100644 tools/perf/arch/xtensa/entry/syscalls/Makefile.syscalls
> > > > > delete mode 100644 tools/perf/arch/xtensa/include/syscall_table.h
> > > > > delete mode 100644 tools/perf/scripts/Makefile.syscalls
> > > > > delete mode 100755 tools/perf/scripts/syscalltbl.sh
> > > > > create mode 100755 tools/perf/trace/beauty/syscalltbl.sh
> > > > >
> > > > > --
> > > > > 2.48.1.362.g079036d154-goog
> > > > >
next prev parent reply other threads:[~2025-02-03 21:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-01 7:14 [PATCH v1 0/7] perf: Support multiple system call tables in the build Ian Rogers
2025-02-01 7:14 ` [PATCH v1 1/7] perf syscalltble: Remove syscall_table.h Ian Rogers
2025-02-01 7:14 ` [PATCH v1 2/7] perf trace: Reorganize syscalls Ian Rogers
2025-02-05 0:12 ` Howard Chu
2025-02-05 5:00 ` Ian Rogers
2025-02-01 7:14 ` [PATCH v1 3/7] perf syscalltbl: Remove struct syscalltbl Ian Rogers
2025-02-05 0:18 ` Howard Chu
2025-02-05 5:09 ` Ian Rogers
2025-02-01 7:14 ` [PATCH v1 4/7] perf thread: Add support for reading the e_machine type for a thread Ian Rogers
2025-02-01 7:14 ` [PATCH v1 5/7] perf trace beauty: Add syscalltbl.sh generating all system call tables Ian Rogers
2025-02-01 7:14 ` [PATCH v1 6/7] perf syscalltbl: Use lookup table containing multiple architectures Ian Rogers
2025-02-05 0:24 ` Howard Chu
2025-02-05 5:17 ` Ian Rogers
2025-02-01 7:14 ` [PATCH v1 7/7] perf build: Remove Makefile.syscalls Ian Rogers
2025-02-01 8:51 ` [PATCH v1 0/7] perf: Support multiple system call tables in the build Ian Rogers
2025-02-03 18:28 ` Ian Rogers
2025-02-03 19:02 ` Charlie Jenkins
2025-02-03 19:10 ` Ian Rogers
2025-02-03 19:15 ` Charlie Jenkins
2025-02-03 19:39 ` Ian Rogers
2025-02-03 20:06 ` Charlie Jenkins [this message]
2025-02-03 20:54 ` Ian Rogers
2025-02-03 23:02 ` Charlie Jenkins
2025-02-04 1:58 ` Ian Rogers
2025-02-04 19:05 ` Charlie Jenkins
2025-02-04 19:17 ` Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z6Eh1QLuqTbUKLCc@ghost \
--to=charlie@rivosinc.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=bjorn@rivosinc.com \
--cc=catalin.marinas@arm.com \
--cc=chenhuacai@kernel.org \
--cc=guoren@kernel.org \
--cc=howardchu95@gmail.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jirislaby@kernel.org \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@linux.intel.com \
--cc=leo.yan@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=maobibo@loongson.cn \
--cc=mark.rutland@arm.com \
--cc=mike.leach@linaro.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox