Re: [PATCH v4 11/14] perf pmu-events: Parallelize JSON and metric pre-computation in jevents.py

From: Namhyung Kim

Date: Mon May 18 2026 - 02:13:46 EST


On Sun, May 17, 2026 at 07:33:32PM -0700, Ian Rogers wrote:
> On Sun, May 17, 2026 at 5:52 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > On Fri, May 15, 2026 at 04:05:40PM -0700, Ian Rogers wrote:
> > > On Fri, May 15, 2026 at 12:41 PM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > > >
> > > > On Fri, May 15, 2026 at 10:38:48AM -0700, Ian Rogers wrote:
> > > > > Currently, jevents.py parses hundreds of JSON event and metric files
> > > > > sequentially across all CPU architectures during Kbuild startup, taking
> > > > > ~3.3 seconds of pure single-core execution time.
> > > >
> > > > I'm curious about this. Does it really need to parse all architectures?
> > > > Oh... is it for perf stat record/report?
> > >
> > > So it is controlled by JEVENTS_ARCH and JEVENTS_MODEL:
> > > https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/Build?h=perf-tools-next#n24
> > > The default for JEVENTS_ARCH is SRCARCH (e.g. x86) while JEVENTS_MODEL
> > > defaults to "all". We have a build test for JEVENTS_ARCH is "all":
> > > https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/make?h=perf-tools-next#n74
> > > So saying "all CPU architectures" is a bit over the top, but not
> > > wholly inaccurate.
> >
> > Ok, so it's all x86 models. I think it's ok to have "all" for build
> > tests.
> >
> > >
> > > Fwiw, I created a script to convert CPUIDs into models:
> > > https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/pmu-events/models.py?h=perf-tools-next
> > > which maybe could be used to reduce the perf binary size by building
> > > only the native CPU's JSON. It is a useful script for debugging :-)
> >
> > Sounds like it should be used by default to pick the current model.
>
> Having a build of perf tied to a particular model like Skylake,
> doesn't seem very good for distributions. I think the default should
> try to match what we hope the distributions will do, so an x86 binary
> should run on all x86 models.

Oh right, distros will need it.

Thanks,
Namhyung