All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
	Kan Liang <kan.liang@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v5 07/12] perf annotate: Add --code-with-type support for TUI
Date: Wed, 20 Aug 2025 16:38:50 -0700	[thread overview]
Message-ID: <aKZcig1ZIjZV8f1y@google.com> (raw)
In-Reply-To: <aKYZ-dhGJvWoIres@x1>

Hi Arnaldo,

On Wed, Aug 20, 2025 at 03:54:49PM -0300, Arnaldo Carvalho de Melo wrote:
> On Fri, Aug 15, 2025 at 08:16:30PM -0700, Namhyung Kim wrote:
> > Until now, the --code-with-type option is available only on stdio.
> > But it was an artifical limitation because of an implemention issue.
> > 
> > Implement the same logic in annotation_line__write() for stdio2/TUI
> > and remove the limitation and update the man page.
> 
> Samples: 54K of event 'cycles:P', 4000 Hz, Event count (approx.): 25749717559
> poll_idle  /usr/lib/debug/lib/modules/6.15.9-201.fc42.x86_64/vmlinux [Percent: local period]
> Percent │      mov     %rdi,%rbx                                                                                                                                        ▒
>         │    → call    local_clock_noinstr              # data-type: (stack operation)                                                                                  ▒
>         │      andb    $0xfb,(%rbx)             # data-type: struct cpuidle_device +0 (registered:1)                                                                    ▒
>         │      mov     %rax,%rbp                                                                                                                                        ▒
>         │    → call    *0x1342a22(%rip)        # ffffffff8384f778 <pv_ops+0xf8>         # data-type: (stack operation)                                                  ▒
>         │      mov     current_task,%r14                # data-type: struct task_struct* +0                                                                             ▒
>         │      lock    orb     $0x20,0x2(%r14)          # data-type: struct task_struct +0x2 (thread_info.flags)                                                        ▒
>         │      mov     (%r14),%rax              # data-type: struct task_struct +0 (thread_info.flags)                                                                  ▒
>         │      test    $0x8,%al                                                                                                                                         ▒
>         │    ↓ jne     6d                                                                                                                                               ▒
>         │      mov     %r12,%rdi                                                                                                                                        ▒
>         │      mov     %rbx,%rsi                                                                                                                                        ▒
>         │    → call    cpuidle_poll_time                # data-type: (stack operation)                                                                                  ▒
>         │      mov     %rax,%r12                                                                                                                                        ▒
>         │49:   mov     $0xc9,%eax                                                                                                                                       ▒
>    0.75 │4e:   mov     (%r14),%rdx              # data-type: struct task_struct +0 (thread_info.flags)                                                                  ▒
>    0.42 │      and     $0x8,%edx                                                                                                                                        ▒
>         │    ↓ jne     6d                                                                                                                                               ▒
>   97.81 │      pause                                                                                                                                                    ▒
>    0.70 │      sub     $0x1,%eax                                                                                                                                        ▒
>    0.04 │    ↑ jne     4e                                                                                                                                               ▒
>    0.14 │    → call    local_clock_noinstr              # data-type: (stack operation)                                                                                  ▒
>    0.01 │      sub     %rbp,%rax                                                                                                                                        ▒
>    0.05 │      cmp     %rax,%r12                                                                                                                                        ▒
>         │    ↑ jae     49                                                                                                                                               ▒
>         │      orb     $0x4,(%rbx)              # data-type: struct cpuidle_device +0 (registered:1)                                                                    ▒
>         │6d: → call    *0x13429cd(%rip)        # ffffffff8384f770 <pv_ops+0xf0>         # data-type: (stack operation)                                                  ▒
>         │      lock    andb    $0xdf,0x2(%r14)          # data-type: struct task_struct +0x2 (thread_info.flags)                                                        ▒
>         │      mov     (%r14),%rax              # data-type: struct task_struct +0 (thread_info.flags) 
> 
> 
> Some suggestions:
> 
> Align the # data-type: annotations.

I was thinking about this but then probably it needs to align to the
longest line like call instruction.  It can be annoying if you are
using a small terminal.

> 
> Remove the "data-type: " part, just uses space and it should be obvious
> what that type refers to.

I think it's better to have some kind of signature to find the info
deterministically as I need to extract them in a script.

> 
> At some point, if we can do it super cheaply, maybe BTF, do this by
> default.

BTF doesn't have variables and locations so it's impossible to match
instructions to types currently.

> 
> The 'T' hotkey looks great, but perhaps we should have more visibility
> for it? Like what I suggested in:
> 
> https://lore.kernel.org/all/aBvx-J-ISifmw0NS@google.com/T/#u

Yep, in the next patch. :)

Thanks,
Namhyung

  reply	other threads:[~2025-08-20 23:38 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-16  3:16 [PATCHSET v5 00/12] perf annotate: Support --code-with-type on TUI Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 01/12] perf annotate: Rename to __hist_entry__tui_annotate() Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 02/12] perf annotate: Remove annotation_print_data.start Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 03/12] perf annotate: Remove __annotation_line__write() Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 04/12] perf annotate: Pass annotation_print_data to annotation_line__write() Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 05/12] perf annotate: Simplify width calculation in annotation_line__write() Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 06/12] perf annotate: Return printed number from disasm_line__write() Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 07/12] perf annotate: Add --code-with-type support for TUI Namhyung Kim
2025-08-20 18:54   ` Arnaldo Carvalho de Melo
2025-08-20 23:38     ` Namhyung Kim [this message]
2025-08-16  3:16 ` [PATCH v5 08/12] perf annotate: Add 'T' hot key to toggle data type display Namhyung Kim
2025-08-20 21:13   ` Arnaldo Carvalho de Melo
2025-08-20 23:43     ` Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 09/12] perf annotate: Show warning when debuginfo is not available Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 10/12] perf annotate: Hide data-type for stack operation and canary Namhyung Kim
2025-08-20 21:28   ` Arnaldo Carvalho de Melo
2025-08-20 21:30     ` Arnaldo Carvalho de Melo
2025-08-16  3:16 ` [PATCH v5 11/12] perf annotate: Add dso__debuginfo() helper Namhyung Kim
2025-08-16  3:16 ` [PATCH v5 12/12] perf annotate: Use a hashmap to save type data Namhyung Kim
2025-08-20 21:37   ` Arnaldo Carvalho de Melo
2025-08-20 23:46     ` Namhyung Kim
2025-08-20 21:40 ` [PATCHSET v5 00/12] perf annotate: Support --code-with-type on TUI Arnaldo Carvalho de Melo
2025-08-20 21:43   ` Arnaldo Carvalho de Melo
2025-08-20 23:47     ` Namhyung Kim

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=aKZcig1ZIjZV8f1y@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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.