linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1 perf-tools-next] perf top: Don't complain about lack of vmlinux when not resolving some kernel samples
@ 2025-01-03 16:47 Arnaldo Carvalho de Melo
  2025-01-06 21:04 ` Namhyung Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-01-03 16:47 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Christophe Leroy, Adrian Hunter, Ian Rogers, James Clark,
	Jiri Olsa, Kan Liang, Linux Kernel Mailing List, linux-perf-users

Recently we got a case where a kernel sample wasn't being resolved due
to a bug that was not setting the end address on kernel functions
implemented in assembly (see Link: tag), and then those were not being
found by machine__resolve() -> map__find_symbol().

So we ended up with:

  # perf top --stdio
  PerfTop: 0 irqs/s  kernel: 0%  exact: 0% lost: 0/0 drop: 0/0 [cycles/P]
  -----------------------------------------------------------------------

  Warning:
  A vmlinux file was not found.
  Kernel samples will not be resolved.
  ^Z
  [1]+  Stopped                 perf top --stdio
  #

But then resolving all other kernel symbols.

So just fixup the logic to only print that warning when there are no
symbols in the kernel map.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/Z3buKhcCsZi3_aGb@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-top.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 724a7938632126bf..ca3e8eca6610e851 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -809,7 +809,7 @@ static void perf_event__process_sample(const struct perf_tool *tool,
 		 * invalid --vmlinux ;-)
 		 */
 		if (!machine->kptr_restrict_warned && !top->vmlinux_warned &&
-		    __map__is_kernel(al.map) && map__has_symbols(al.map)) {
+		    __map__is_kernel(al.map) && !map__has_symbols(al.map)) {
 			if (symbol_conf.vmlinux_name) {
 				char serr[256];
 
-- 
2.47.0


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

* Re: [PATCH 1/1 perf-tools-next] perf top: Don't complain about lack of vmlinux when not resolving some kernel samples
  2025-01-03 16:47 [PATCH 1/1 perf-tools-next] perf top: Don't complain about lack of vmlinux when not resolving some kernel samples Arnaldo Carvalho de Melo
@ 2025-01-06 21:04 ` Namhyung Kim
  2025-01-08 20:20   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Namhyung Kim @ 2025-01-06 21:04 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Christophe Leroy, Adrian Hunter, Ian Rogers, James Clark,
	Jiri Olsa, Kan Liang, Linux Kernel Mailing List, linux-perf-users

Hi Arnaldo,

On Fri, Jan 03, 2025 at 01:47:19PM -0300, Arnaldo Carvalho de Melo wrote:
> Recently we got a case where a kernel sample wasn't being resolved due
> to a bug that was not setting the end address on kernel functions
> implemented in assembly (see Link: tag), and then those were not being
> found by machine__resolve() -> map__find_symbol().
> 
> So we ended up with:
> 
>   # perf top --stdio
>   PerfTop: 0 irqs/s  kernel: 0%  exact: 0% lost: 0/0 drop: 0/0 [cycles/P]
>   -----------------------------------------------------------------------
> 
>   Warning:
>   A vmlinux file was not found.
>   Kernel samples will not be resolved.
>   ^Z
>   [1]+  Stopped                 perf top --stdio
>   #
> 
> But then resolving all other kernel symbols.
> 
> So just fixup the logic to only print that warning when there are no
> symbols in the kernel map.
> 
> Cc: Adrian Hunter <adrian.hunter@intel.com>
> Cc: Ian Rogers <irogers@google.com>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: James Clark <james.clark@linaro.org>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kan Liang <kan.liang@linux.intel.com>
> Link: https://lore.kernel.org/lkml/Z3buKhcCsZi3_aGb@x1
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

Reviewed-by: Namhyung Kim <namhyung@kernel.org>

Looks like an old bug since d88205db9caa0e9d ("perf dso: Add
dso__has_symbols() method"). :)

Thanks,
Namhyung

> ---
>  tools/perf/builtin-top.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 724a7938632126bf..ca3e8eca6610e851 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -809,7 +809,7 @@ static void perf_event__process_sample(const struct perf_tool *tool,
>  		 * invalid --vmlinux ;-)
>  		 */
>  		if (!machine->kptr_restrict_warned && !top->vmlinux_warned &&
> -		    __map__is_kernel(al.map) && map__has_symbols(al.map)) {
> +		    __map__is_kernel(al.map) && !map__has_symbols(al.map)) {
>  			if (symbol_conf.vmlinux_name) {
>  				char serr[256];
>  
> -- 
> 2.47.0
> 

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

* Re: [PATCH 1/1 perf-tools-next] perf top: Don't complain about lack of vmlinux when not resolving some kernel samples
  2025-01-06 21:04 ` Namhyung Kim
@ 2025-01-08 20:20   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-01-08 20:20 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Christophe Leroy, Adrian Hunter, Ian Rogers, James Clark,
	Jiri Olsa, Kan Liang, Linux Kernel Mailing List, linux-perf-users

On Mon, Jan 06, 2025 at 01:04:45PM -0800, Namhyung Kim wrote:
> Hi Arnaldo,
> 
> On Fri, Jan 03, 2025 at 01:47:19PM -0300, Arnaldo Carvalho de Melo wrote:
> > Recently we got a case where a kernel sample wasn't being resolved due
> > to a bug that was not setting the end address on kernel functions
> > implemented in assembly (see Link: tag), and then those were not being
> > found by machine__resolve() -> map__find_symbol().
> > 
> > So we ended up with:
> > 
> >   # perf top --stdio
> >   PerfTop: 0 irqs/s  kernel: 0%  exact: 0% lost: 0/0 drop: 0/0 [cycles/P]
> >   -----------------------------------------------------------------------
> > 
> >   Warning:
> >   A vmlinux file was not found.
> >   Kernel samples will not be resolved.
> >   ^Z
> >   [1]+  Stopped                 perf top --stdio
> >   #
> > 
> > But then resolving all other kernel symbols.
> > 
> > So just fixup the logic to only print that warning when there are no
> > symbols in the kernel map.
> > 
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: Ian Rogers <irogers@google.com>
> > Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> > Cc: James Clark <james.clark@linaro.org>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Kan Liang <kan.liang@linux.intel.com>
> > Link: https://lore.kernel.org/lkml/Z3buKhcCsZi3_aGb@x1
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Reviewed-by: Namhyung Kim <namhyung@kernel.org>
> 
> Looks like an old bug since d88205db9caa0e9d ("perf dso: Add
> dso__has_symbols() method"). :)

Agreed, logic inversion, I'm adding the Fixes tag, thanks for finding
it!

- Arnaldo

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

end of thread, other threads:[~2025-01-08 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03 16:47 [PATCH 1/1 perf-tools-next] perf top: Don't complain about lack of vmlinux when not resolving some kernel samples Arnaldo Carvalho de Melo
2025-01-06 21:04 ` Namhyung Kim
2025-01-08 20:20   ` 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).