Re: [PATCH v4 22/23] perf annotate-arm64: Support per-cpu variable access tracking
| Newsgroups | org.kernel.vger.linux-perf-users |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Incomplete offset calculation for multi-register memory operands causes inaccurate type resolution. -- --- Patch [22]: [PATCH v4 22/23] perf annotate-arm64: Support per-cpu variable access tracking --- commit d7e10ade80ba3983e6d311e1ab11f19b4af2d53e Author: Tengda Wu <[email protected]> Subject: perf annotate-arm64: Support per-cpu variable access tracking This commit extends update_insn_state() for arm64 to handle per-cpu variable addressing. It identifies per-cpu base initialization and propagates type information to subsequent instructions. This allows the tracker to correctly resolve the actual variable type in per-cpu flows. > diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c > index 7fe5b979563f7..8b0584486cce9 100644 > --- a/tools/perf/util/annotate-data.c > +++ b/tools/perf/util/annotate-data.c > @@ -1253,11 +1253,33 @@ static enum type_match_result check_matching_type(struct type_state *state, > } > > if (state->regs[reg].kind == TSR_KIND_PERCPU_BASE) { > - u64 var_addr = dloc->op->offset; > + u64 var_addr; > int var_offset; [ ... ] > + var_addr = dloc->op->offset; > + > if (dloc->op->multi_regs) { > int reg2 = dloc->op->reg2; [Severity: Medium] Does the TSR_KIND_GLOBAL_ADDR handling later in check_matching_type() need similar logic for multi-register operands to ensure accurate type resolution? Currently, for TSR_KIND_GLOBAL_ADDR, the logic does not consider multi-register operands: if (state->regs[reg].kind == TSR_KIND_GLOBAL_ADDR) { u64 var_addr = state->regs[reg].imm_value + dloc->op->offset; int var_offset; This calculation omits adding state->regs[reg2].imm_value for multi-register operands, unlike the TSR_KIND_PERCPU_BASE logic in the same function. The omission also appears to apply to TSR_KIND_TYPE and TSR_KIND_POINTER. Can this incomplete offset calculation cause incorrect type resolution in tools/perf/util/annotate-data.c:check_matching_type() when perf processes a memory instruction where op->multi_regs is true, the primary register is TSR_KIND_GLOBAL_ADDR (or TYPE/POINTER), and the secondary register is TSR_KIND_CONST? -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=22