Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Aaron Tomlin" <atomlin@atomlin.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH perf-tools-next v2 4/4] perf ftrace: Support omitting execution duration in function graph tracer
Date: Tue, 06 Oct 2026 23:35:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-162512@kernel.org> (raw)
In-Reply-To: <20261006232756.65620-5-atomlin@atomlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] perf ftrace: --graph-opts duration silently clobbers noduration
--

commit e23672676ea60d48741ccc720b34c8778668c668
Author: Aaron Tomlin <atomlin@atomlin.com>

    perf ftrace: Support omitting execution duration in function graph tracer
    
    The Linux kernel's function graph tracer displays the execution duration
    of completed functions by default via the funcgraph-duration trace
    option. Introduce support for omitting function duration by exposing the
    noduration sub-option under --graph-opts (and conversely duration=[0|1]).

> diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c
> index e11418e619378..88df6b09d9b0d 100644
> --- a/tools/perf/builtin-ftrace.c
> +++ b/tools/perf/builtin-ftrace.c
[ ... ]
> @@ -1754,6 +1772,8 @@ static int parse_graph_tracer_opts(const struct option *opt,
>  		{ .name = "retaddr",		.value_ptr = &ftrace->graph_retaddr },
>  		{ .name = "nosleep-time",	.value_ptr = &ftrace->graph_nosleep_time },
>  		{ .name = "noirqs",		.value_ptr = &ftrace->graph_noirqs },
> +		{ .name = "noduration",		.value_ptr = &ftrace->graph_noduration },
> +		{ .name = "duration",		.value_ptr = &duration },
>  		{ .name = "verbose",		.value_ptr = &ftrace->graph_verbose },
>  		{ .name = "thresh",		.value_ptr = &ftrace->graph_thresh },
>  		{ .name = "depth",		.value_ptr = &ftrace->graph_depth },
> @@ -1769,6 +1789,9 @@ static int parse_graph_tracer_opts(const struct option *opt,
>  	if (ret)
>  		return ret;
>  
> +	if (duration != -1)
> +		ftrace->graph_noduration = !duration;
> +

[Severity: Medium]
Does this logic unconditionally overwrite the noduration parameter?

If a user executes perf ftrace with --graph-opts duration=1,noduration, the
token parsing loop in perf_parse_sublevel_options() correctly processes them
sequentially. It sets duration to 1 and ftrace->graph_noduration to 1.

However, since duration != -1 is evaluated after the loop, it overwrites
ftrace->graph_noduration with !1 (which is 0). This causes the duration
parameter to always clobber the noduration parameter, regardless of their
order in the comma-separated list.

Would it be possible to parse both directives strictly in the order they are
specified without unconditionally overriding one after the loop?

>  	if (filter_retaddr != -1) {
>  		ftrace->filter_retaddr = (filter_retaddr != 0);
>  		ftrace->filter_retaddr_set = true;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006232756.65620-1-atomlin@atomlin.com?part=4

  reply	other threads:[~2026-10-06 23:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 23:27 [PATCH perf-tools-next v2 0/4] perf ftrace: Support inlined functions and display enhancements in function graph tracer Aaron Tomlin
2026-10-06 23:27 ` [PATCH perf-tools-next v2 1/4] perf ftrace: Optimise __cmd_ftrace() stack frame with strbuf streaming Aaron Tomlin
2026-10-06 23:35   ` sashiko-bot
2026-10-07 15:46     ` Aaron Tomlin
2026-10-06 23:27 ` [PATCH perf-tools-next v2 2/4] perf ftrace: Support filtering return address comments Aaron Tomlin
2026-10-06 23:37   ` sashiko-bot
2026-10-07 16:04     ` Aaron Tomlin
2026-10-06 23:27 ` [PATCH perf-tools-next v2 3/4] perf ftrace: Support display of inlined functions in function graph tracer Aaron Tomlin
2026-10-06 23:40   ` sashiko-bot
2026-10-06 23:27 ` [PATCH perf-tools-next v2 4/4] perf ftrace: Support omitting execution duration " Aaron Tomlin
2026-10-06 23:35   ` sashiko-bot [this message]
2026-10-07 23:24 ` [PATCH perf-tools-next v2 0/4] perf ftrace: Support inlined functions and display enhancements " Namhyung Kim

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-162512@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=atomlin@atomlin.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