linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules
@ 2020-03-02 19:10 Arnaldo Carvalho de Melo
  2020-03-02 19:20 ` Jiri Olsa
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-02 19:10 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Alexander Shishkin, Jiri Olsa, Kim Phillips, Michael Petlan,
	Namhyung Kim, Ravi Bangoria, Linux Kernel Mailing List

The dso->kernel value is now set to everything that is in
machine->kmaps, but that was being used to decide if vmlinux lookup is
needed, which ended up making that lookup be made for kernel modules,
that now have dso->kernel set, leading to these kinds of warnings when
running on a machine with compressed kernel modules, like fedora:31:
    
  [root@five ~]# perf record -F 10000 -a sleep 2
  [ perf record: Woken up 1 times to write data ]
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  [ perf record: Captured and wrote 1.024 MB perf.data (1366 samples) ]
  [root@five ~]#

This happens when collecting the buildid, when we find samples for
kernel modules, fix it by checking if the looked up DSO is a kernel
module by other means.

Fixes: 02213cec64bb ("perf maps: Mark module DSOs with kernel type")
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kim Phillips <kim.phillips@amd.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

---

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 1077013d8ce2..26bc6a0096ce 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1622,7 +1622,12 @@ int dso__load(struct dso *dso, struct map *map)
 		goto out;
 	}
 
-	if (dso->kernel) {
+	kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
+		dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
+		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
+		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
+
+	if (dso->kernel && !kmod) {
 		if (dso->kernel == DSO_TYPE_KERNEL)
 			ret = dso__load_kernel_sym(dso, map);
 		else if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
@@ -1650,12 +1655,6 @@ int dso__load(struct dso *dso, struct map *map)
 	if (!name)
 		goto out;
 
-	kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
-		dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
-		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
-		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
-
-
 	/*
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work

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

* Re: [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules
  2020-03-02 19:10 [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules Arnaldo Carvalho de Melo
@ 2020-03-02 19:20 ` Jiri Olsa
  2020-03-02 20:02 ` Jiri Olsa
  2020-03-04 11:01 ` [tip: perf/urgent] " tip-bot2 for Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Olsa @ 2020-03-02 19:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Alexander Shishkin, Kim Phillips, Michael Petlan,
	Namhyung Kim, Ravi Bangoria, Linux Kernel Mailing List

On Mon, Mar 02, 2020 at 04:10:07PM -0300, Arnaldo Carvalho de Melo wrote:
> The dso->kernel value is now set to everything that is in
> machine->kmaps, but that was being used to decide if vmlinux lookup is
> needed, which ended up making that lookup be made for kernel modules,
> that now have dso->kernel set, leading to these kinds of warnings when
> running on a machine with compressed kernel modules, like fedora:31:
>     
>   [root@five ~]# perf record -F 10000 -a sleep 2
>   [ perf record: Woken up 1 times to write data ]
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   [ perf record: Captured and wrote 1.024 MB perf.data (1366 samples) ]
>   [root@five ~]#
> 
> This happens when collecting the buildid, when we find samples for
> kernel modules, fix it by checking if the looked up DSO is a kernel
> module by other means.

cool, I just saw your other email and was going to check on it ;-)
ging to check on this and review

jirka

> 
> Fixes: 02213cec64bb ("perf maps: Mark module DSOs with kernel type")
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Jiri Olsa <jolsa@kernel.org>
> Cc: Kim Phillips <kim.phillips@amd.com>
> Cc: Michael Petlan <mpetlan@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ---
> 
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 1077013d8ce2..26bc6a0096ce 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1622,7 +1622,12 @@ int dso__load(struct dso *dso, struct map *map)
>  		goto out;
>  	}
>  
> -	if (dso->kernel) {
> +	kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
> +		dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
> +		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
> +		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
> +
> +	if (dso->kernel && !kmod) {
>  		if (dso->kernel == DSO_TYPE_KERNEL)
>  			ret = dso__load_kernel_sym(dso, map);
>  		else if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
> @@ -1650,12 +1655,6 @@ int dso__load(struct dso *dso, struct map *map)
>  	if (!name)
>  		goto out;
>  
> -	kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
> -		dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
> -		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
> -		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
> -
> -
>  	/*
>  	 * Read the build id if possible. This is required for
>  	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
> 


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

* Re: [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules
  2020-03-02 19:10 [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules Arnaldo Carvalho de Melo
  2020-03-02 19:20 ` Jiri Olsa
@ 2020-03-02 20:02 ` Jiri Olsa
  2020-03-02 20:21   ` Arnaldo Carvalho de Melo
  2020-03-04 11:01 ` [tip: perf/urgent] " tip-bot2 for Arnaldo Carvalho de Melo
  2 siblings, 1 reply; 5+ messages in thread
From: Jiri Olsa @ 2020-03-02 20:02 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Jiri Olsa, Alexander Shishkin, Kim Phillips, Michael Petlan,
	Namhyung Kim, Ravi Bangoria, Linux Kernel Mailing List

On Mon, Mar 02, 2020 at 04:10:07PM -0300, Arnaldo Carvalho de Melo wrote:
> The dso->kernel value is now set to everything that is in
> machine->kmaps, but that was being used to decide if vmlinux lookup is
> needed, which ended up making that lookup be made for kernel modules,
> that now have dso->kernel set, leading to these kinds of warnings when
> running on a machine with compressed kernel modules, like fedora:31:
>     
>   [root@five ~]# perf record -F 10000 -a sleep 2
>   [ perf record: Woken up 1 times to write data ]
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   lzma: fopen failed on vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
>   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
>   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
>   [ perf record: Captured and wrote 1.024 MB perf.data (1366 samples) ]
>   [root@five ~]#
> 
> This happens when collecting the buildid, when we find samples for
> kernel modules, fix it by checking if the looked up DSO is a kernel
> module by other means.
> 
> Fixes: 02213cec64bb ("perf maps: Mark module DSOs with kernel type")

ok, I couldn't see that because kcore took over the modules,
for some reason you don't have it enabled on your system?

because I had to disable it manualy in the code.. I think
we should add some --no-kcore option for record

the fix is working for me:

Tested/Acked-by: Jiri Olsa <jolsa@redhat.com>

thanks,
jirka


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

* Re: [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules
  2020-03-02 20:02 ` Jiri Olsa
@ 2020-03-02 20:21   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2020-03-02 20:21 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: Jiri Olsa, Alexander Shishkin, Kim Phillips, Michael Petlan,
	Namhyung Kim, Ravi Bangoria, Linux Kernel Mailing List

Em Mon, Mar 02, 2020 at 09:02:49PM +0100, Jiri Olsa escreveu:
> On Mon, Mar 02, 2020 at 04:10:07PM -0300, Arnaldo Carvalho de Melo wrote:
> > The dso->kernel value is now set to everything that is in
> > machine->kmaps, but that was being used to decide if vmlinux lookup is
> > needed, which ended up making that lookup be made for kernel modules,
> > that now have dso->kernel set, leading to these kinds of warnings when
> > running on a machine with compressed kernel modules, like fedora:31:
> >     
> >   [root@five ~]# perf record -F 10000 -a sleep 2
> >   [ perf record: Woken up 1 times to write data ]
> >   lzma: fopen failed on vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
> >   lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
> >   lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
> >   [ perf record: Captured and wrote 1.024 MB perf.data (1366 samples) ]
> >   [root@five ~]#
> > 
> > This happens when collecting the buildid, when we find samples for
> > kernel modules, fix it by checking if the looked up DSO is a kernel
> > module by other means.
> > 
> > Fixes: 02213cec64bb ("perf maps: Mark module DSOs with kernel type")
> 
> ok, I couldn't see that because kcore took over the modules,
> for some reason you don't have it enabled on your system?

Humm, maybe you don't have a reachable vmlinux so it ends up using
/proc/kcore? I even think we should make the default... :-)
 
> because I had to disable it manualy in the code.. I think
> we should add some --no-kcore option for record
> 
> the fix is working for me:
> 
> Tested/Acked-by: Jiri Olsa <jolsa@redhat.com>

Thanks, for checking!
 
> thanks,
> jirka
> 

-- 

- Arnaldo

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

* [tip: perf/urgent] perf symbols: Don't try to find a vmlinux file when looking for kernel modules
  2020-03-02 19:10 [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules Arnaldo Carvalho de Melo
  2020-03-02 19:20 ` Jiri Olsa
  2020-03-02 20:02 ` Jiri Olsa
@ 2020-03-04 11:01 ` tip-bot2 for Arnaldo Carvalho de Melo
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Arnaldo Carvalho de Melo @ 2020-03-04 11:01 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Jiri Olsa, Alexander Shishkin, Kim Phillips, Michael Petlan,
	Namhyung Kim, Ravi Bangoria, Arnaldo Carvalho de Melo, x86, LKML

The following commit has been merged into the perf/urgent branch of tip:

Commit-ID:     b5c0951860ba98cfe1936b5c0739450875d51451
Gitweb:        https://git.kernel.org/tip/b5c0951860ba98cfe1936b5c0739450875d51451
Author:        Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate:    Mon, 02 Mar 2020 16:03:34 -03:00
Committer:     Arnaldo Carvalho de Melo <acme@redhat.com>
CommitterDate: Tue, 03 Mar 2020 16:20:01 -03:00

perf symbols: Don't try to find a vmlinux file when looking for kernel modules

The dso->kernel value is now set to everything that is in
machine->kmaps, but that was being used to decide if vmlinux lookup is
needed, which ended up making that lookup be made for kernel modules,
that now have dso->kernel set, leading to these kinds of warnings when
running on a machine with compressed kernel modules, like fedora:31:

  [root@five ~]# perf record -F 10000 -a sleep 2
  [ perf record: Woken up 1 times to write data ]
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  lzma: fopen failed on vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux: 'No such file or directory'
  lzma: fopen failed on /boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /usr/lib/debug/boot/vmlinux-5.5.5-200.fc31.x86_64: 'No such file or directory'
  lzma: fopen failed on /lib/modules/5.5.5-200.fc31.x86_64/build/vmlinux: 'No such file or directory'
  [ perf record: Captured and wrote 1.024 MB perf.data (1366 samples) ]
  [root@five ~]#

This happens when collecting the buildid, when we find samples for
kernel modules, fix it by checking if the looked up DSO is a kernel
module by other means.

Fixes: 02213cec64bb ("perf maps: Mark module DSOs with kernel type")
Tested-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Kim Phillips <kim.phillips@amd.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
Link: http://lore.kernel.org/lkml/20200302191007.GD10335@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/symbol.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 1077013..26bc6a0 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1622,7 +1622,12 @@ int dso__load(struct dso *dso, struct map *map)
 		goto out;
 	}
 
-	if (dso->kernel) {
+	kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
+		dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
+		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
+		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
+
+	if (dso->kernel && !kmod) {
 		if (dso->kernel == DSO_TYPE_KERNEL)
 			ret = dso__load_kernel_sym(dso, map);
 		else if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
@@ -1650,12 +1655,6 @@ int dso__load(struct dso *dso, struct map *map)
 	if (!name)
 		goto out;
 
-	kmod = dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE ||
-		dso->symtab_type == DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP ||
-		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE ||
-		dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
-
-
 	/*
 	 * Read the build id if possible. This is required for
 	 * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work

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

end of thread, other threads:[~2020-03-04 11:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 19:10 [PATCH] perf symbols: Don't try to find a vmlinux file when looking for kernel modules Arnaldo Carvalho de Melo
2020-03-02 19:20 ` Jiri Olsa
2020-03-02 20:02 ` Jiri Olsa
2020-03-02 20:21   ` Arnaldo Carvalho de Melo
2020-03-04 11:01 ` [tip: perf/urgent] " tip-bot2 for 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).