From: sashiko-bot@kernel.org
To: "Jens Remus" <jremus@linux.ibm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 3/5] perf python: Honor perf script --show-kernel-path
Date: Fri, 04 Dec 2026 17:13:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-250280@kernel.org> (raw)
In-Reply-To: <20261204162426.4171717-10-jremus@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] perf python: pyrf_callchain_node__get_dso() reads global
show_kernel_path lazily
- [Low] perf python: default show_kernel_path=0 breaks gecko.py kmod
classification
--
commit 8453e475e7deb47d13e09c143ec3ea8957b9e428
Author: Jens Remus <jremus@linux.ibm.com>
perf python: Honor perf script --show-kernel-path
This patch adds a show_kernel_path keyword argument to perf.session,
defaulting to the PERF_SYMBOL_SHOW_KERNEL_PATH environment variable set
by perf script from --show-kernel-path, or true otherwise.
> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index 2ab6b17f638e0..ccf7e3fe89349 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -4538,6 +4538,8 @@ int cmd_script(int argc, const char **argv)
> if (script_itrace_opts)
> setenv("PERF_ITRACE", script_itrace_opts, 1);
> setenv("PERF_SYMBOL_INLINE", symbol_conf.inline_name ? "1" : "0", 1);
> + setenv("PERF_SYMBOL_SHOW_KERNEL_PATH",
> + symbol_conf.show_kernel_path ? "1" : "0", 1);
>
> execvp(__argv[0], (char **)__argv);
> {
[Severity: Low]
Does exporting PERF_SYMBOL_SHOW_KERNEL_PATH=0 by default break kernel
module classification in tools/perf/python/gecko.py?
When perf script gecko runs without --show-kernel-path, gecko.py opens
perf.session without passing show_kernel_path, so
symbol_conf.show_kernel_path becomes false. For kernel modules,
pyrf_callchain_node__get_dso() then returns dso__name(dso) ([modname])
instead of dso__long_name(dso) (the .ko path):
tools/perf/python/gecko.py:Thread._intern_frame():
if (frame_str.find('kallsyms') != -1 or
frame_str.find('/vmlinux') != -1 or
frame_str.endswith('.ko)')):
category = self.kernel_category
Uncompressed kernel module callchain frames now format as
"symbol (in [modname])" rather than ending in ".ko)", so they fall
through to user_category instead of kernel_category in Firefox Profiler
output.
[ ... ]
> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index b5426dfaee01f..18a8468c0eb28 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c
[ ... ]
> @@ -5147,8 +5151,8 @@ static PyObject *pyrf_session__new(PyTypeObject *type, PyObject *args, PyObject
> symbol_conf.kallsyms_name = psession->kallsyms_name;
> symbol_conf.symfs = psession->symfs ?: "";
> symbol_conf.use_callchain = true;
> - symbol_conf.show_kernel_path = true;
> symbol_conf.inline_name = psession->inline_name;
> + symbol_conf.show_kernel_path = psession->show_kernel_path;
>
> /* Reading the header of a pipe may block, let other python threads run. */
> pyrf_session__active = psession;
> @@ -5220,6 +5224,7 @@ static PyObject *pyrf_session__find_thread_events(struct pyrf_session *psession)
> symbol_conf.kallsyms_name = psession->kallsyms_name;
> symbol_conf.symfs = psession->symfs ?: "";
> symbol_conf.inline_name = psession->inline_name;
> + symbol_conf.show_kernel_path = psession->show_kernel_path;
[Severity: Low]
Can overwriting the process-global symbol_conf.show_kernel_path
retroactively alter callchain_node.dso on retained objects from an
earlier session?
Unlike the other symbol_conf fields, symbol_conf.show_kernel_path is read
lazily in pyrf_callchain_node__get_dso() when Python accesses node.dso.
Because pyrf_event__copy() and pyrf_call_return__new() allow resolved
callchains to outlive a callback or process_events(), creating or
processing a second perf.session with a different show_kernel_path value
silently switches the DSO names reported by retained callchain_node
objects from the first session.
Capturing show_kernel_path on struct pyrf_callchain in
pyrf_sample_event__resolve_callchain() and pyrf_call_path__to_callchain()
and propagating it to struct pyrf_callchain_node would keep node.dso
bound to its originating session.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261204162426.4171717-7-jremus@linux.ibm.com?part=3
next prev parent reply other threads:[~2026-12-04 17:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 16:24 [PATCH 0/5] perf python: Honor more perf script options Jens Remus
2026-12-04 16:24 ` [PATCH 1/5] perf python: Support inlined frames in callchains Jens Remus
2026-12-04 16:46 ` sashiko-bot
2026-12-04 16:24 ` [PATCH 2/5] perf python: Export inlined symbol flag in DB export scripts Jens Remus
2026-12-04 16:59 ` sashiko-bot
2026-12-04 16:24 ` [PATCH 3/5] perf python: Honor perf script --show-kernel-path Jens Remus
2026-12-04 17:13 ` sashiko-bot [this message]
2026-12-04 16:24 ` [PATCH 4/5] perf python: Honor perf script --demangle and --demangle-kernel Jens Remus
2026-12-04 16:24 ` [PATCH 5/5] perf python: Honor perf script --max-stack Jens Remus
2026-12-04 17:35 ` sashiko-bot
2026-12-04 17:35 ` [PATCH 0/5] perf python: Honor more perf script options sashiko-bot
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=sashiko-outbox-250280@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jremus@linux.ibm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.