Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jens Remus" <jremus@linux.ibm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 5/5] perf python: Honor perf script --max-stack
Date: Fri, 04 Dec 2026 17:35:04 +0000	[thread overview]
Message-ID: <sashiko-outbox-250325@kernel.org> (raw)
In-Reply-To: <20261204162426.4171717-12-jremus@linux.ibm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf python: pyrf_session__new() ignores itrace callchain_sz for
  max_stack
--

commit a32cdfe5ec1c8800c1fb34b26309874d968719a6
Author: Jens Remus <jremus@linux.ibm.com>

perf python: Honor perf script --max-stack

This commit adds a max_stack keyword argument to perf.session and
forwards perf script's effective maximum stack depth via the
PERF_MAX_STACK environment variable.

> diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
> index fe468a0f0aa43..7ddc127e3ef68 100644
> --- a/tools/perf/util/python.c
> +++ b/tools/perf/util/python.c

[ ... ]

> @@ -5152,6 +5197,16 @@ static PyObject *pyrf_session__new(PyTypeObject *type, PyObject *args, PyObject
>  	psession->demangle_kernel = demangle_kernel_arg >= 0 ? demangle_kernel_arg :
>  		pyrf_getenv_bool("PERF_SYMBOL_DEMANGLE_KERNEL", psession->demangle_kernel);
>  
> +	if (max_stack_arg >= 0)
> +		psession->max_stack = max_stack_arg;
> +	else {
> +		long val = pyrf_getenv_long("PERF_MAX_STACK", 0, INT_MAX, psession->max_stack);
> +
> +		if (val == -1 && PyErr_Occurred())
> +			goto err_out;
> +		psession->max_stack = val;
> +	}

[Severity: Low]
Should psession->max_stack also be raised to
psession->itrace_opts.callchain_sz when itrace callchain synthesis is
enabled?

Both cmd_script() and cmd_report() raise max_stack to
itrace_synth_opts.callchain_sz when callchain or add_callchain is set
and callchain_sz is larger.

When a script like export-to-sqlite.py passes itrace directly to
perf.session() (for example --itrace=g256) without max_stack,
psession->max_stack stays at 127 and synthesized callchains are
silently truncated above that depth.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204162426.4171717-7-jremus@linux.ibm.com?part=5

  reply	other threads:[~2026-12-04 17:35 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
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 [this message]
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-250325@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox