linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Thomas Richter <tmricht@linux.ibm.com>
Cc: "linux-perf-use." <linux-perf-users@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Sumanth Korikkar <sumanthk@linux.ibm.com>,
	Heiko Carstens <hca@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Subject: Re: Fedora 33 and perf probe failures
Date: Thu, 26 Nov 2020 22:08:48 +0900	[thread overview]
Message-ID: <20201126220848.e515e3da6921d1512108e3bf@kernel.org> (raw)
In-Reply-To: <42f12f48-d515-8d7b-0116-d063afea9273@linux.ibm.com>

Hi Thomas,

I've setup fedora33 and found strange debuginfo.

On Thu, 19 Nov 2020 09:16:57 +0100
Thomas Richter <tmricht@linux.ibm.com> wrote:

> [root@f33 ~]# perf probe -vvv -L getname_flags
> Looking at the vmlinux_path (8 entries long)
> Using /lib/modules/5.9.8-200.fc33.x86_64/build/vmlinux for symbols
> Open Debuginfo file: /lib/modules/5.9.8-200.fc33.x86_64/build/vmlinux
> fname: ./include/linux/fs.h, lineno:2527
> New line range: 2527 to 2147483647
> path: (null)
> Specified source line is not found.
>   Error: Failed to show lines. Reason: No such file or directory (Code: -2)

Above error was reproduced, and I found that the perf-probe's routine
failed to find the real function definition.

I decoded the vmlinux with eu-readelf -w, and I found there were 2
entries (DIEs) for the getname_flags.

(1)
 [2dbe7c6]    subprogram           abbrev: 54
             external             (flag_present) yes
             name                 (strp) "getname_flags"
             decl_file            (data1) fs.h (8)
             decl_line            (data2) 2527
             decl_column          (data1) 25
             prototyped           (flag_present) yes
             type                 (ref4) [2dbe7e7]
             sibling              (ref4) [2dbe7e7]
 [2dbe7d7]      formal_parameter     abbrev: 4
               type                 (ref4) [2da9721]
 [2dbe7dc]      formal_parameter     abbrev: 4
               type                 (ref4) [2da97a1]
 [2dbe7e1]      formal_parameter     abbrev: 4
               type                 (ref4) [2dabbdd]

(2)
 [2e0fde0]    subprogram           abbrev: 162
             external             (flag_present) yes
             name                 (strp) "getname_flags"
             decl_file            (data1) namei.c (1)
             decl_line            (data1) 128
             decl_column          (data1) 1
             prototyped           (flag_present) yes
             type                 (ref4) [2dfced6]
             inline               (data1) inlined (1)
             sibling              (ref4) [2e0fe49]
 [2e0fdf2]      formal_parameter     abbrev: 31
               name                 (strp) "filename"
               decl_file            (data1) namei.c (1)
               decl_line            (data1) 128
               decl_column          (data1) 34
               type                 (ref4) [2de77f3]
 [2e0fdfe]      formal_parameter     abbrev: 31
               name                 (strp) "flags"
               decl_file            (data1) namei.c (1)
               decl_line            (data1) 128
               decl_column          (data1) 48
               type                 (ref4) [2de7873]
 [2e0fe0a]      formal_parameter     abbrev: 31
               name                 (strp) "empty"
               decl_file            (data1) namei.c (1)
               decl_line            (data1) 128
               decl_column          (data1) 60
               type                 (ref4) [2de9ce4]

The first one is not the actual function, but that is a DIE
for the declaration. However, this DIE doesn't have DW_AT_declaration
attribute, it should be there if the DIE represents the declaration.

In perf, die_is_func_def() checks that attribute, and if the DIE doen't
have DW_AT_declaration, line_range_search_cb() think the DIE represents
the function definition (function prototype). And search the instance
to find the line range.

However, since the (1) has no DW_AT_declaration, perf probe was mislead
that the DIE is the function definition, and search the function instance
which links to the DIE. And it failed to find any instances because
the DIE it found was just a prototype in the header file. (But it seems
some call-site DIE refers the declaration DIE.)

Let me try to fix if we skip the first DIE.

Thank you,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

  parent reply	other threads:[~2020-11-26 13:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 16:37 Fedora 33 and perf probe failures Thomas Richter
2020-11-19  1:07 ` Masami Hiramatsu
2020-11-19  8:16   ` Thomas Richter
2020-11-19 13:04     ` Masami Hiramatsu
2020-11-26 13:08     ` Masami Hiramatsu [this message]
2020-11-26 17:28       ` Arnaldo Carvalho de Melo
2020-11-27  0:10         ` Masami Hiramatsu
2020-11-27 11:36           ` Arnaldo Carvalho de Melo
2020-11-27  5:48         ` [PATCH 1/2] perf-probe: Fix to die_entrypc() returns error correctly Masami Hiramatsu
2020-11-27  5:48         ` [PATCH 2/2] perf-probe: Change function definition check due to broken dwarf Masami Hiramatsu
2020-11-27 17:36           ` Arnaldo Carvalho de Melo

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=20201126220848.e515e3da6921d1512108e3bf@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=acme@kernel.org \
    --cc=hca@linux.ibm.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sumanthk@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=tmricht@linux.ibm.com \
    /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 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).