mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tengda Wu <wutengda@huaweicloud.com>
To: Namhyung Kim <namhyung@kernel.org>,
	james.clark@linaro.org, xueshuai@linux.alibaba.com,
	Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>,
	leo.yan@linux.dev, Li Huafei <lihuafei1@huawei.com>,
	Ian Rogers <irogers@google.com>,
	Kim Phillips <kim.phillips@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ingo Molnar <mingo@redhat.com>, Bill Wendling <morbo@google.com>,
	Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Zecheng Li <zli94@ncsu.edu>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, Tengda Wu <wutengda@huaweicloud.com>
Subject: [PATCH v7 07/15] perf annotate-data: Expand type_state_reg imm_value to u64
Date: Tue, 13 Oct 2026 13:28:05 +0000	[thread overview]
Message-ID: <4582a236d6a0ead429a602fec2c8fbbb0916d382.1791629326.git.wutengda@huaweicloud.com> (raw)
In-Reply-To: <cover.1791629326.git.wutengda@huaweicloud.com>

The arm64 'adrp + add/ldr' instruction pair involves global variable address
calculation and passing, which requires storing the 64-bit address in
type_state_reg. Currently, there is no field in type_state_reg that can
hold such an address. The most likely candidate for reuse is imm_value,
but it is defined as u32, which limits the size of values it can carry.

To address this, expand imm_value from u32 to u64. Also update related
compilation warnings and fix the sign-extension issue introduced by this
change.

Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Tengda Wu <wutengda@huaweicloud.com>
---
 tools/perf/util/annotate-arch/annotate-x86.c | 4 ++--
 tools/perf/util/annotate-data.h              | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/annotate-arch/annotate-x86.c b/tools/perf/util/annotate-arch/annotate-x86.c
index aa381d25a63b..f5e40cef08ab 100644
--- a/tools/perf/util/annotate-arch/annotate-x86.c
+++ b/tools/perf/util/annotate-arch/annotate-x86.c
@@ -536,11 +536,11 @@ static void update_insn_state_x86(struct type_state *state,
 
 		if (src->imm) {
 			tsr->kind = TSR_KIND_CONST;
-			tsr->imm_value = src->offset;
+			tsr->imm_value = (s64)src->offset;
 			tsr->offset = 0;
 			tsr->ok = true;
 
-			pr_debug_dtp("mov [%x] imm=%#x -> reg%d\n",
+			pr_debug_dtp("mov [%x] imm=%#"PRIx64" -> reg%d\n",
 				     insn_offset, tsr->imm_value, dst->reg1);
 			return;
 		}
diff --git a/tools/perf/util/annotate-data.h b/tools/perf/util/annotate-data.h
index 453efdf6afa6..12b5b6db5f57 100644
--- a/tools/perf/util/annotate-data.h
+++ b/tools/perf/util/annotate-data.h
@@ -182,7 +182,7 @@ extern struct annotated_data_stat ann_data_stat;
  */
 struct type_state_reg {
 	Dwarf_Die type;
-	u32 imm_value;
+	u64 imm_value;
 	/*
 	 * The offset within the struct that the register points to.
 	 * A value of 0 means the register points to the beginning.
-- 
2.34.1


  parent reply	other threads:[~2026-10-13 13:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13 13:27 [PATCH v7 00/15] perf annotate arm64: Support instruction tracking for data type profiling Tengda Wu
2026-10-13 13:27 ` [PATCH v7 01/15] perf annotate-data: Extract invalidate_reg_state() as a common helper Tengda Wu
2026-10-13 13:28 ` [PATCH v7 02/15] perf annotate-arm64: Enable instruction tracking support Tengda Wu
2026-10-13 13:28 ` [PATCH v7 03/15] perf annotate-data: Add arch_get_reg_offset helper Tengda Wu
2026-10-13 13:28 ` [PATCH v7 04/15] perf annotate-arm64: Track return type after call instructions Tengda Wu
2026-10-13 13:28 ` [PATCH v7 05/15] perf annotate-arm64: Support load instruction tracking Tengda Wu
2026-10-13 13:28 ` [PATCH v7 06/15] perf annotate-arm64: Support store " Tengda Wu
2026-10-15 23:02   ` Namhyung Kim
2026-10-16  1:14     ` Tengda Wu
2026-10-13 13:28 ` Tengda Wu [this message]
2026-10-13 13:28 ` [PATCH v7 08/15] perf annotate-data: Track imm_value for stack variables Tengda Wu
2026-10-13 13:28 ` [PATCH v7 09/15] perf annotate-x86: Delete stale stack state on store of untracked register Tengda Wu
2026-10-13 13:28 ` [PATCH v7 10/15] perf annotate-arm64: Support stack variable tracking Tengda Wu
2026-10-13 13:28 ` [PATCH v7 11/15] perf annotate-arm64: Support 'mov' instruction tracking Tengda Wu
2026-10-13 13:28 ` [PATCH v7 12/15] perf annotate-arm64: Support 'add' " Tengda Wu
2026-10-13 13:28 ` [PATCH v7 13/15] perf annotate-arm64: Support 'adrp' instruction to track global variables Tengda Wu
2026-10-13 13:28 ` [PATCH v7 14/15] perf annotate-arm64: Support per-cpu variable access tracking Tengda Wu
2026-10-13 13:28 ` [PATCH v7 15/15] perf annotate-arm64: Support 'mrs' instruction to track 'current' pointer Tengda Wu
2026-10-15 23:11 ` [PATCH v7 00/15] perf annotate arm64: Support instruction tracking for data type profiling Namhyung Kim
2026-10-16  1:18   ` Tengda Wu
2026-10-21 21:48     ` Arnaldo Carvalho de Melo
2026-10-21 23:46       ` Namhyung Kim
2026-10-22  1:19         ` Tengda Wu
2026-10-22 19:59           ` Arnaldo Carvalho de Melo

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=4582a236d6a0ead429a602fec2c8fbbb0916d382.1791629326.git.wutengda@huaweicloud.com \
    --to=wutengda@huaweicloud.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=kim.phillips@arm.com \
    --cc=leo.yan@linux.dev \
    --cc=lihuafei1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=namhyung@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=peterz@infradead.org \
    --cc=xueshuai@linux.alibaba.com \
    --cc=zli94@ncsu.edu \
    /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

all inboxes | Powered by JetHome®