linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf annotate: Fix data type profiling on stdio
@ 2024-04-23  2:06 Namhyung Kim
  2024-04-23 16:57 ` Ian Rogers
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2024-04-23  2:06 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Ian Rogers, Kan Liang
  Cc: Jiri Olsa, Adrian Hunter, Peter Zijlstra, Ingo Molnar, LKML,
	linux-perf-users

The loop in hists__find_annotations() never set the 'nd' pointer to NULL
and it makes stdio output repeating the last element forever.  I think
it doesn't set to NULL for TUI to prevent it from exiting unexpectedly.
But it should just set on stdio mode.

Fixes: d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
 tools/perf/builtin-annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 6f7104f06c42..83812b9d5363 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -491,7 +491,7 @@ static void hists__find_annotations(struct hists *hists,
 				return;
 			}
 
-			if (next != NULL)
+			if (use_browser == 0 || next != NULL)
 				nd = next;
 
 			continue;
-- 
2.44.0.769.g3c40516874-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf annotate: Fix data type profiling on stdio
  2024-04-23  2:06 [PATCH] perf annotate: Fix data type profiling on stdio Namhyung Kim
@ 2024-04-23 16:57 ` Ian Rogers
  2024-04-23 23:07   ` Namhyung Kim
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Rogers @ 2024-04-23 16:57 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Arnaldo Carvalho de Melo, Kan Liang, Jiri Olsa, Adrian Hunter,
	Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users

On Mon, Apr 22, 2024 at 7:06 PM Namhyung Kim <namhyung@kernel.org> wrote:
>
> The loop in hists__find_annotations() never set the 'nd' pointer to NULL
> and it makes stdio output repeating the last element forever.  I think
> it doesn't set to NULL for TUI to prevent it from exiting unexpectedly.
> But it should just set on stdio mode.
>
> Fixes: d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>

Acked-by: Ian Rogers <irogers@google.com>

Should we have a test to cover things like this?

Thanks,
Ian

> ---
>  tools/perf/builtin-annotate.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
> index 6f7104f06c42..83812b9d5363 100644
> --- a/tools/perf/builtin-annotate.c
> +++ b/tools/perf/builtin-annotate.c
> @@ -491,7 +491,7 @@ static void hists__find_annotations(struct hists *hists,
>                                 return;
>                         }
>
> -                       if (next != NULL)
> +                       if (use_browser == 0 || next != NULL)
>                                 nd = next;
>
>                         continue;
> --
> 2.44.0.769.g3c40516874-goog
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf annotate: Fix data type profiling on stdio
  2024-04-23 16:57 ` Ian Rogers
@ 2024-04-23 23:07   ` Namhyung Kim
  2024-04-25 18:57     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2024-04-23 23:07 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Arnaldo Carvalho de Melo, Kan Liang, Jiri Olsa, Adrian Hunter,
	Peter Zijlstra, Ingo Molnar, LKML, linux-perf-users

On Tue, Apr 23, 2024 at 9:57 AM Ian Rogers <irogers@google.com> wrote:
>
> On Mon, Apr 22, 2024 at 7:06 PM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > The loop in hists__find_annotations() never set the 'nd' pointer to NULL
> > and it makes stdio output repeating the last element forever.  I think
> > it doesn't set to NULL for TUI to prevent it from exiting unexpectedly.
> > But it should just set on stdio mode.
> >
> > Fixes: d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>
> Acked-by: Ian Rogers <irogers@google.com>

Thanks for your review!

>
> Should we have a test to cover things like this?

Ok, I'll try to add one for perf annotate.

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf annotate: Fix data type profiling on stdio
  2024-04-23 23:07   ` Namhyung Kim
@ 2024-04-25 18:57     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-04-25 18:57 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Ian Rogers, Kan Liang, Jiri Olsa, Adrian Hunter, Peter Zijlstra,
	Ingo Molnar, LKML, linux-perf-users

On Tue, Apr 23, 2024 at 04:07:08PM -0700, Namhyung Kim wrote:
> On Tue, Apr 23, 2024 at 9:57 AM Ian Rogers <irogers@google.com> wrote:
> >
> > On Mon, Apr 22, 2024 at 7:06 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > The loop in hists__find_annotations() never set the 'nd' pointer to NULL
> > > and it makes stdio output repeating the last element forever.  I think
> > > it doesn't set to NULL for TUI to prevent it from exiting unexpectedly.
> > > But it should just set on stdio mode.
> > >
> > > Fixes: d001c7a7f473 ("perf annotate-data: Add hist_entry__annotate_data_tui()")
> > > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> >
> > Acked-by: Ian Rogers <irogers@google.com>
> 
> Thanks for your review!

Thanks, applied to perf-tools-next,

- Arnaldo
 
> >
> > Should we have a test to cover things like this?
> 
> Ok, I'll try to add one for perf annotate.
> 
> Thanks,
> Namhyung

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-04-25 18:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-23  2:06 [PATCH] perf annotate: Fix data type profiling on stdio Namhyung Kim
2024-04-23 16:57 ` Ian Rogers
2024-04-23 23:07   ` Namhyung Kim
2024-04-25 18:57     ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).