Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leo Yan" <leo.yan@arm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v6 5/8] perf cs-etm: Support call indentation
Date: Tue, 26 May 2026 19:42:15 +0000	[thread overview]
Message-ID: <20260526194215.C70AD1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260526-b4-arm_cs_callchain_support_v1-v6-5-f9f49f53c9dd@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The condition for swapping packets in `cs_etm__packet_swap()` was not updated to include the new `use_thread_stack` flag, which breaks the `callindent` feature if branch and instruction sampling are disabled.
--

commit 36aa886e2c5be33efb8d11e03a02df7c74dce99b
Author: Leo Yan <leo.yan@linux.dev>

perf cs-etm: Support call indentation
    
This commit introduces a use_thread_stack flag to track whether the branch
stack needs to be recorded. This allows call indentation to function
independently of the last branch record feature.

[ ... ]

> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index ea2424175558d..b31d0dd46a45d 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c

[ ... ]

> @@ -1914,7 +1915,7 @@ static int cs_etm__flush(struct cs_etm_queue *etmq,
>  	cs_etm__packet_swap(etm, tidq);

[Severity: Medium]
Will this swap logic still work if branch and instruction sampling are
disabled?

Looking at cs_etm__packet_swap(), the condition to perform the swap was not
updated to check the new use_thread_stack flag:

tools/perf/util/cs-etm.c:cs_etm__packet_swap() {
    if (etm->synth_opts.branches || etm->synth_opts.last_branch ||
        etm->synth_opts.instructions) {
        ...
        // swap packets
    }
}

If a user runs perf script -F +callindent without enabling branches,
last_branch, or instructions, cs_etm__packet_swap() won't swap the packets.

Does the previous packet remaining empty prevent the thread stack from being
populated, causing callindent to silently fail?

Could cs_etm__packet_swap() be updated to check use_thread_stack as well?

>  
>  	/* Reset last branches after flush the trace */
> -	if (etm->synth_opts.last_branch)
> +	if (etm->use_thread_stack)
>  		thread_stack__flush(tidq->thread);
>  
>  	return err;

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260526-b4-arm_cs_callchain_support_v1-v6-0-f9f49f53c9dd@arm.com?part=5

  reply	other threads:[~2026-05-26 19:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 16:59 [PATCH v6 0/8] perf cs-etm: Support thread stack and callchain Leo Yan
2026-05-26 16:59 ` [PATCH v6 1/8] perf cs-etm: Decode ETE exception packets Leo Yan
2026-05-26 16:59 ` [PATCH v6 2/8] perf cs-etm: Refactor instruction size handling Leo Yan
2026-05-26 16:59 ` [PATCH v6 3/8] perf cs-etm: Use thread-stack for last branch entries Leo Yan
2026-05-26 18:32   ` sashiko-bot
2026-05-26 16:59 ` [PATCH v6 4/8] perf cs-etm: Flush thread stacks after decoder reset Leo Yan
2026-05-26 19:10   ` sashiko-bot
2026-05-26 16:59 ` [PATCH v6 5/8] perf cs-etm: Support call indentation Leo Yan
2026-05-26 19:42   ` sashiko-bot [this message]
2026-05-26 16:59 ` [PATCH v6 6/8] perf cs-etm: Filter synthesized branch samples Leo Yan
2026-05-26 16:59 ` [PATCH v6 7/8] perf cs-etm: Synthesize callchains for instruction samples Leo Yan
2026-05-26 16:59 ` [PATCH v6 8/8] perf test: Add Arm CoreSight callchain test Leo Yan
2026-05-26 20:56   ` 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=20260526194215.C70AD1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=leo.yan@arm.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