diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-25 19:05:18 -0300 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-09-26 05:21:58 -0300 |
| commit | b1d0b4093fe6055c9e534387ccdc28a5278e99ff (patch) | |
| tree | ddd8c79e1167754c86dabc8a989ebc412859ec94 /tools/perf/python/stackcollapse.py | |
| parent | 528b1475f9cffbaffb37f490e86780662471ef3f (diff) | |
| download | linux-next-b1d0b4093fe6055c9e534387ccdc28a5278e99ff.tar.gz linux-next-b1d0b4093fe6055c9e534387ccdc28a5278e99ff.zip | |
perf tools: Bump the minimum Python version to 3.9
perf's build only refused interpreters older than 3.6, the check added
when jevents.py started using f-strings, and jevents.py carried a
removesuffix() shim to stay usable on them.
The kernel itself requires Python 3.9.x since 5e25b972a22be224 ("docs:
changes: update Python minimal version"), so tools in the tree are
expected to work with it, and staying compatible with older
interpreters stopped paying off:
- the PEP 585 generics, list[...], used by the type annotations in
jevents.py and util/setup.py are only subscriptable from Python 3.9
and, being evaluated at import or definition time, they break the
build on RHEL 8's python3.6.8 with:
TypeError: 'type' object is not subscriptable
- ProcessPoolExecutor(initializer=, initargs=) requires Python 3.7, so
generating pmu-events.c fails there as well.
Rather than spreading version guards and typing.List() workarounds for
interpreters that cannot be supported anyway, make 3.9 the floor: ask
for it once in Makefile.config and use the result in both places that
run python while building, jevents generation and the python binding,
as the binding is still built when NO_JEVENTS=1 skips the generation
check, and drop the removesuffix() shim, since str.removesuffix() was
added in 3.9.
RHEL 8 is in feature freeze, so those wanting a new perf and its python
features have to vendor a newer interpreter, just as
Documentation/process/changes.rst already asks for the kernel itself.
Tested with Python 3.9.22: perf builds, generating pmu-events.c and the
python binding, with byte for byte identical output to the build made
with the shim, while Python 3.8.20 and 3.6.15 are rejected with the
"older than 3.9" error, by the jevents check in a regular build and by
the binding check when NO_JEVENTS=1 makes them sail past it, where they
used to die on the TypeError from util/setup.py. With NO_JEVENTS=1 and
NO_LIBPYTHON=1 no interpreter runs while building, so neither check
applies. vermin reports no perf build file as requiring more than 3.9,
the only offender being the runtime script
scripts/python/mem-phys-addr.py, which the build doesn't run.
Suggested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Assisted-by: LLM
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
