Re: [PATCH v2 08/16] perf annotate-arm64: Enable instruction tracking support
From: Tengda Wu
Date: Fri Apr 10 2026 - 06:30:03 EST
On 2026/4/10 14:09, Namhyung Kim wrote:
> On Fri, Apr 03, 2026 at 09:47:52AM +0000, Tengda Wu wrote:
>> Enable instruction tracking for the arm64 architecture in 'perf annotate'
>> to support data type profiling.
>>
>> Define ARM64_REG_SP as 31 to correctly identify the stack pointer
>> register during type state initialization. Update
>> arch_supports_insn_tracking() to include arm64, which allows
>> find_data_type_block() to process the instruction scope for arm64.
>>
>> Signed-off-by: Li Huafei <lihuafei1@xxxxxxxxxx>
>> Signed-off-by: Tengda Wu <wutengda@xxxxxxxxxxxxxxx>
>> ---
>> tools/perf/util/annotate-data.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/annotate-data.c b/tools/perf/util/annotate-data.c
>> index 1eff0a27237d..fd6416d43a2e 100644
>> --- a/tools/perf/util/annotate-data.c
>> +++ b/tools/perf/util/annotate-data.c
>> @@ -28,6 +28,7 @@
>>
>> /* register number of the stack pointer */
>> #define X86_REG_SP 7
>> +#define ARM64_REG_SP 31
>>
>> static void delete_var_types(struct die_var_type *var_types);
>>
>> @@ -177,7 +178,8 @@ static void init_type_state(struct type_state *state, const struct arch *arch)
>> state->regs[11].caller_saved = true;
>> state->ret_reg = 0;
>> state->stack_reg = X86_REG_SP;
>> - }
>> + } else if (arch__is_arm64(arch))
>> + state->stack_reg = ARM64_REG_SP;
>
> Probably you want to setup caller-saved registers and the return
> register as well.
>
> Thanks,
> Namhyung
>
You're right. Thanks!
-- Tengda
>
>> }
>>
>> static void exit_type_state(struct type_state *state)
>> @@ -1421,7 +1423,8 @@ static enum type_match_result find_data_type_insn(struct data_loc_info *dloc,
>>
>> static int arch_supports_insn_tracking(struct data_loc_info *dloc)
>> {
>> - if ((arch__is_x86(dloc->arch)) || (arch__is_powerpc(dloc->arch)))
>> + if ((arch__is_x86(dloc->arch)) || (arch__is_powerpc(dloc->arch)) ||
>> + (arch__is_arm64(dloc->arch)))
>> return 1;
>> return 0;
>> }
>> --
>> 2.34.1
>>