[PATCH v5 0/3] perf jevents: Check the JSON keys a table may carry

From: TAKANO Mitsuhiro

Date: Wed Nov 11 2026 - 08:26:43 EST


jevents.py takes the fields it wants out of each JSON object by name and
ignores the rest, so a key spelled differently is dropped without a word
and the object is built without whatever that field held. Two of those
are in the tree: "PublicDescrition" in 16 entries of an Arm table, where
the lost long description repeated the brief one and so nothing a user
saw changed, and "BriefDescript6ion" in one entry each of three AMD
tables, where the event is generated with no text at all.

Patch 2 makes the model argument optional when the tables are generated by
hand, and patch 1 names the metric that has a name and no MetricExpr
instead of failing on the file. Patch 3 says which keys a table may carry
and checks the tree against that, instead of reporting the keys a run of
jevents.py did not read.

v5 rewrites patch 3 rather than revising it. The review asked for
something strict and simple instead of a near-miss heuristic, so the
similarity cut-off, the tracking of which keys were read and the wrapped
objects are gone: the schema is a list of 51 names, 47 of which this
file reads, and a key outside it is reported with the object that
carries it. A JSON Schema would say the same thing, but perf's build
would then require jsonschema, which it does not use today and which is
not in every builder's python; the list holds the same names either way,
and a vendor that adds a field adds one line here.

Patches 1 and 2 are unchanged. The check is still something a maintainer
runs - make check-jevents, with JEVENTS_CHECK_ARCH to look at one
architecture - rather than a step of the build, so the generated tables are
byte identical. An architecture that is not there, or named as a path, is
an error rather than a silent pass, an object where a list belongs is
reported, the name of a metricgroup is not treated as a key, and a small
perf test runs those cases.

The two misspellings the check reports in the tree today were posted
separately in November.

Link: https://lore.kernel.org/linux-perf-users/20261108183846.3804875-1-takano32@xxxxxxxxx/
Link: https://lore.kernel.org/linux-perf-users/20261108184600.3810059-1-takano32@xxxxxxxxx/

TAKANO Mitsuhiro (3):
perf jevents: Name the metric when a MetricExpr is missing
perf jevents: Make the model argument optional
perf jevents: Check the JSON keys a table may carry

tools/perf/Makefile | 13 +-
tools/perf/Makefile.perf | 1 +
tools/perf/pmu-events/jevents.py | 228 ++++++++++++++++++++----
tools/perf/tests/shell/jevents_check.sh | 62 +++++++
4 files changed, 272 insertions(+), 32 deletions(-)
create mode 100755 tools/perf/tests/shell/jevents_check.sh


base-commit: 7475ea8b58616b33c04afb976cf0fbaad9dd63fb
--
2.53.0