From: sashiko-bot@kernel.org
To: "Tengda Wu" <wutengda@huaweicloud.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v5 14/26] perf annotate-data: Add arch_get_reg_offset helper
Date: Tue, 08 Sep 2026 13:22:22 +0000 [thread overview]
Message-ID: <20260908132222.90D9F1F00A3F@smtp.kernel.org> (raw)
In-Reply-To: <e2d2dc36b2d8f600b339cf66880b10e611dbf9ab.1788872630.git.wutengda@huaweicloud.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The newly computed effective `offset` from `arch_get_reg_offset` is not propagated to `dloc->type_offset` before querying stack variables, breaking stack type tracking for indexed addressing modes on ARM64.
- [Low] The debug logging variable `offset_sign` is not reset across loop iterations, causing positive offsets to be printed as negative.
--
commit 090fc5d342fd0b37d2080a84b8472453f678a2e5
Author: Tengda Wu <wutengda@huaweicloud.com>
perf annotate-data: Add arch_get_reg_offset helper
Adds a helper to compute the effective offset from a base register
for instruction operands. Currently handles arm64 addressing modes
and falls back to the instruction's raw offset for other architectures.
> diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c
> index c51b20a7af9b6..754c0efe2077e 100644
> --- a/tools/perf/util/annotate-data.c
> +++ b/tools/perf/util/annotate-data.c
[ ... ]
> @@ -1132,18 +1200,26 @@ static enum type_match_result check_matching_type(struct type_state *state,
> Dwarf_Word size;
> u32 insn_offset = dl->al.offset;
> int reg = dloc->op->reg1;
> - int offset = dloc->op->offset;
> + int offset;
> const char *offset_sign = "";
> bool retry = true;
>
> - if (offset < 0) {
> - offset = -offset;
> - offset_sign = "-";
> +again:
> + if (arch_get_reg_offset(dloc->arch, dloc->op, reg, state, false, &offset)) {
> + /*
> + * Fall back to the instruction's offset. This prevents the
> + * register type of the instruction from being completely lost.
> + * Compared to dropping this type inference entirely, providing
> + * a rough type hint is likely more useful.
> + */
> + offset = dloc->op->offset;
> }
>
> -again:
> + if (offset < 0)
> + offset_sign = "-";
[Severity: Low]
Does this code leave offset_sign set to "-" across loop iterations?
If check_matching_type() triggers a retry (goto again) after processing a
negative offset, and the new offset for the retry is positive, offset_sign
will still point to "-" instead of being cleared.
[Severity: Medium]
Since this code now dynamically computes offset using arch_get_reg_offset(),
is it necessary to update dloc->type_offset with this newly computed value?
Later in this function, during stack variable lookups, the code relies on
dloc->type_offset:
tools/perf/util/annotate-data.c:check_matching_type() {
...
check_non_register:
if (reg == dloc->fbreg || reg == state->stack_reg) {
...
stack = find_stack_state(state, dloc->type_offset);
...
}
And similarly for CFA stack lookups:
tools/perf/util/annotate-data.c:check_matching_type() {
...
stack = find_stack_state(state, dloc->type_offset - fboff);
...
}
If dloc->type_offset isn't updated to reflect the true effective offset
calculated by arch_get_reg_offset(), will find_stack_state() end up
using a stale or incorrect offset (e.g. 0 instead of the index offset) for
stack-based array accesses on ARM64?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1788872630.git.wutengda@huaweicloud.com?part=14
next prev parent reply other threads:[~2026-09-08 13:22 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 13:05 [PATCH v5 00/26] perf arm64: Support data type profiling Tengda Wu
2026-09-08 13:05 ` [PATCH v5 01/26] perf capstone: Symbolize address operands to match objdump on arm64 Tengda Wu
2026-09-08 13:18 ` sashiko-bot
2026-09-09 14:49 ` Namhyung Kim
2026-09-10 7:38 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 02/26] perf llvm: Fix arm64 adrp instruction disassembly mismatch with objdump Tengda Wu
2026-09-08 13:16 ` sashiko-bot
2026-09-09 14:50 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 03/26] perf annotate-arm64: Generalize arm64_mov__parse to support more instructions Tengda Wu
2026-09-08 13:15 ` sashiko-bot
2026-09-09 14:52 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 04/26] perf annotate-arm64: Handle load and store instructions Tengda Wu
2026-09-08 13:15 ` sashiko-bot
2026-09-09 14:58 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 05/26] perf annotate: Normalize arch__dwarf_regnum() error return values Tengda Wu
2026-09-08 13:24 ` sashiko-bot
2026-09-08 17:57 ` Ian Rogers
2026-09-09 15:00 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 06/26] perf annotate: Introduce extract_op_location callback for arch-specific parsing Tengda Wu
2026-09-08 13:20 ` sashiko-bot
2026-09-09 15:01 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 07/26] perf dwarf-regs: Adapt get_dwarf_regnum() for arm64 Tengda Wu
2026-09-08 13:21 ` sashiko-bot
2026-09-09 15:03 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 08/26] perf annotate: Adapt arch__dwarf_regnum() " Tengda Wu
2026-09-08 13:15 ` sashiko-bot
2026-09-09 15:04 ` Namhyung Kim
2026-09-08 13:05 ` [PATCH v5 09/26] perf annotate-arm64: Implement extract_op_location() callback Tengda Wu
2026-09-08 13:18 ` sashiko-bot
2026-09-10 8:49 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 10/26] perf annotate: Default to --itrace=i1i for data type profiling Tengda Wu
2026-09-08 13:15 ` sashiko-bot
2026-09-09 15:38 ` Adrian Hunter
2026-09-08 13:05 ` [PATCH v5 11/26] perf arm-spe: Set default synthesized event period to 1 Tengda Wu
2026-09-08 13:12 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 12/26] perf annotate-data: Extract invalidate_reg_state() as a common helper Tengda Wu
2026-09-08 13:11 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 13/26] perf annotate-arm64: Enable instruction tracking support Tengda Wu
2026-09-08 13:18 ` sashiko-bot
2026-09-10 9:20 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 14/26] perf annotate-data: Add arch_get_reg_offset helper Tengda Wu
2026-09-08 13:22 ` sashiko-bot [this message]
2026-09-10 12:13 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 15/26] perf annotate-arm64: Track return type after call instructions Tengda Wu
2026-09-08 13:14 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 16/26] perf annotate-arm64: Support load instruction tracking Tengda Wu
2026-09-08 13:23 ` sashiko-bot
2026-09-10 13:19 ` Tengda Wu
2026-09-10 13:28 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 17/26] perf annotate-arm64: Support store " Tengda Wu
2026-09-08 13:22 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 18/26] perf annotate-data: Expand type_state_reg imm_value to u64 Tengda Wu
2026-09-08 13:26 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 19/26] perf annotate-data: Track imm_value for stack variables Tengda Wu
2026-09-08 13:29 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 20/26] perf annotate-x86: Delete stale stack state on store of untracked register Tengda Wu
2026-09-08 13:20 ` sashiko-bot
2026-09-08 13:05 ` [PATCH v5 21/26] perf annotate-arm64: Support stack variable tracking Tengda Wu
2026-09-08 13:36 ` sashiko-bot
2026-09-11 1:41 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 22/26] perf annotate-arm64: Support 'mov' instruction tracking Tengda Wu
2026-09-08 13:27 ` sashiko-bot
2026-09-11 2:22 ` Tengda Wu
2026-09-08 13:05 ` [PATCH v5 23/26] perf annotate-arm64: Support 'add' " Tengda Wu
2026-09-08 13:27 ` sashiko-bot
2026-09-11 2:29 ` Tengda Wu
2026-09-08 13:06 ` [PATCH v5 24/26] perf annotate-arm64: Support 'adrp' instruction to track global variables Tengda Wu
2026-09-08 13:26 ` sashiko-bot
2026-09-08 13:06 ` [PATCH v5 25/26] perf annotate-arm64: Support per-cpu variable access tracking Tengda Wu
2026-09-08 13:30 ` sashiko-bot
2026-09-11 10:15 ` Tengda Wu
2026-09-08 13:06 ` [PATCH v5 26/26] perf annotate-arm64: Support 'mrs' instruction to track 'current' pointer Tengda Wu
2026-09-08 13:31 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-09-08 13:00 [PATCH v5 00/26] perf arm64: Support data type profiling Tengda Wu
2026-09-08 13:01 ` [PATCH v5 14/26] perf annotate-data: Add arch_get_reg_offset helper Tengda Wu
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=20260908132222.90D9F1F00A3F@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wutengda@huaweicloud.com \
/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.