Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v9 03/13] perf annotate: Handle absolute addressing in data type profiling
Date: Fri, 20 Nov 2026 01:49:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-224340@kernel.org> (raw)
In-Reply-To: <20261120013211.1510-4-acme@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf annotate: missing movabs entry in x86__instructions
  leaves it unparsed
--

commit 1846110498ff835d20605b89dd376d9b33a97c53
Author: Arnaldo Carvalho de Melo <acme@redhat.com>

perf annotate: Handle absolute addressing in data type profiling

This commit parses bare hex displacements as absolute memory operands on x86
and resolves their global variable types during instruction state tracking
and data type profiling.

> diff --git a/tools/perf/util/annotate-arch/annotate-x86.c b/tools/perf/util/annotate-arch/annotate-x86.c
> index e38a4e7a54d55..03c32032cde0c 100644
> --- a/tools/perf/util/annotate-arch/annotate-x86.c
> +++ b/tools/perf/util/annotate-arch/annotate-x86.c

[ ... ]

> @@ -960,6 +970,30 @@ static void extract_op_location_x86(const struct arch *arch,
>  			op_loc->offset = strtol(s + 1, &p, 0);
>  			if (p && p != s + 1)
>  				op_loc->imm = true;
> +		} else if ((*s == '-' || strstarts(s, "0x")) &&
> +			   !ins__is_call(&dl->ins) && !ins__is_jump(&dl->ins) &&
> +			   strncmp(dl->ins.name, "loop", 4)) {
> +			bool neg = *s == '-';
> +			bool movabs = !strncmp(dl->ins.name, "movabs", 6);
> +			u64 offset = strtoull(s + neg, NULL, 0);
> +			bool exact;
> +
> +			if (neg)
> +				offset = -offset;
> +			/*
> +			 * The offset is an int: a disp32 fits it as a u32 or,
> +			 * sign extended, as an int, which is how the LLVM
> +			 * disassembler prints one that does not fit an int.
> +			 * A movabs takes a full 64-bit address, keep only the
> +			 * values the sign extension gives back exactly.
> +			 */
> +			exact = (s64)(int)offset == (s64)offset;
> +			if (offset != 0 && (movabs ? exact :
> +					    (offset <= UINT_MAX || exact))) {
> +				/* An absolute address: 32-bit code, or a 64-bit disp32 */
> +				op_loc->mem_ref = true;
> +				op_loc->offset = offset;
> +			}
>  		}
>  	}
>  }

[Severity: Medium]
Can extract_op_location_x86() ever reach this movabs check on real
disassembly when x86__instructions[] has no entry for "movabs"?

Because ins__find() fails to match "movabs" or "movabsq",
disasm_line__init_ins() never runs mov__parse() to split dl->ops.raw into
dl->ops.source.raw and dl->ops.target.raw.  annotate_get_insn_location()
then passes a NULL op_str to extract_op_location_x86(), which returns early
without resolving the operand.  The new test in annotate-ops.c passes only
because check_operand() populates dl.ops.source.raw directly instead of
going through disasm_line__init_ins().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120013211.1510-1-acme@kernel.org?part=3

  reply	other threads:[~2026-11-20  1:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  1:31 [PATCH v9 00/13] perf coverage: A harness for perf, and the fixes it found Arnaldo Carvalho de Melo
2026-11-20  1:31 ` [PATCH v9 01/13] perf build: Link the GTK UI with EXTRA_CFLAGS Arnaldo Carvalho de Melo
2026-11-20  1:38   ` sashiko-bot
2026-11-20  1:31 ` [PATCH v9 02/13] perf scripts: Add a coverage harness for perf Arnaldo Carvalho de Melo
2026-11-20  1:40   ` sashiko-bot
2026-11-20  1:31 ` [PATCH v9 03/13] perf annotate: Handle absolute addressing in data type profiling Arnaldo Carvalho de Melo
2026-11-20  1:49   ` sashiko-bot [this message]
2026-11-20  1:31 ` [PATCH v9 04/13] perf tests: Exercise DW_OP_addrx global variables Arnaldo Carvalho de Melo
2026-11-20  1:45   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 05/13] perf tests: Exercise the flexible array member path Arnaldo Carvalho de Melo
2026-11-20  1:38   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 06/13] perf annotate-data: Count flexible array accesses for the whole struct Arnaldo Carvalho de Melo
2026-11-20  1:41   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 07/13] perf tests: Exercise data type resolution from a register Arnaldo Carvalho de Melo
2026-11-20  1:39   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 08/13] perf annotate: Print the stats after the annotations Arnaldo Carvalho de Melo
2026-11-20  1:37   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 09/13] perf tests: Silence the libbfd probe in build-test Arnaldo Carvalho de Melo
2026-11-20  1:35   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 10/13] perf build: Record the features checked outside FEATURE_TESTS Arnaldo Carvalho de Melo
2026-11-20  1:40   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 11/13] perf tests: Fix the Intel PT virtual LBR check Arnaldo Carvalho de Melo
2026-11-20  1:39   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 12/13] perf test: Drop samples without an IP in the dlfilter test Arnaldo Carvalho de Melo
2026-11-20  1:39   ` sashiko-bot
2026-11-20  1:32 ` [PATCH v9 13/13] perf test: Skip the LBR inline unwinding check when unsupported Arnaldo Carvalho de Melo
2026-11-20  1:39   ` 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-224340@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=acme@kernel.org \
    --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