linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Joel Fernandes <agnel.joel@gmail.com>,
	Taeung Song <treeze.taeung@gmail.com>,
	Joel Fernandes <joel.opensrc@gmail.com>,
	linux-perf-users@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>
Subject: Re: [RFC] perf: probe_finder: continue if atleast one probe point found
Date: Mon, 29 Feb 2016 11:19:44 -0300	[thread overview]
Message-ID: <20160229141944.GF8720@kernel.org> (raw)
In-Reply-To: <CAD=GYpZtDb3ugJRFQg1karJ_Fb7RsGPpSu0ZbL8i9Oy8x5eZ9A@mail.gmail.com>

Em Sun, Feb 28, 2016 at 03:49:44AM -0800, Joel Fernandes escreveu:
> Taeung,
> 
> Thanks for that. As this is an RFC, I have added them now to this email
> thread and when I post the final patch, I'll include them in CC.
> 
> All,
> Please provide your comments on my patch.

Masami, are you ok with this patch?

- Arnaldo
 
> Thanks,
> Joel
> 
> On Sun, Feb 28, 2016 at 3:35 AM, Taeung Song <treeze.taeung@gmail.com>
> wrote:
> 
> > Hi, Joel
> >
> > perf subsystem's maintainers are
> > Arnaldo Carvalho de Melo <acme@kernel.org>
> > Peter Zijlstra <peterz@infradead.org>
> > Ingo Molnar <mingo@redhat.com>
> >
> > (or Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>)
> >
> > AFAIK,
> > When sending some patches, it would be better to add them into To: or Cc:
> >
> >
> > Thanks,
> > Taeung
> >
> >
> > On 02/28/2016 08:14 PM, Joel Fernandes wrote:
> >
> >> Sometimes for inline functions, perf probe can fail such as if an
> >> arguments are
> >> requested at probe points. This is probably because when the compiler
> >> inlines,
> >> for some instances it optimizes away arguments. Either way, the DWARF has
> >> missing arguments for certain probe points of inline functions causing
> >> 'perf
> >> probe' to fail. I noticed this when probing the C library that ships with
> >> my
> >> distribution. With the following patch I am successfully able to record
> >> kprobe
> >> events with arguments.
> >>
> >> Test
> >> ----
> >>   ./perf probe \
> >>     -k ./vmlinux -s ./ -x /lib/x86_64-linux-gnu/libc.so.6 -a 'malloc
> >> bytes' -v
> >>
> >> Without the patch
> >> -----------------
> >> Matched function: __libc_malloc
> >> found inline addr: 0x831a6
> >> Probe point found: malloc_atfork+150
> >> Searching 'bytes' variable in context.
> >> Converting variable bytes into trace event.
> >> bytes type is long unsigned int.
> >> found inline addr: 0x844a0
> >> Probe point found: __libc_malloc+0
> >> Searching 'bytes' variable in context.
> >> Converting variable bytes into trace event.
> >> bytes type is long unsigned int.
> >> found inline addr: 0x8463b
> >> Probe point found: __malloc_get_state+11
> >> Searching 'bytes' variable in context.
> >> Failed to find 'bytes' in this function.
> >> An error occurred in debuginfo analysis (-2).
> >>    Error: Failed to add events. Reason: No such file or directory (Code:
> >> -2)
> >>
> >> With the patch
> >> --------------
> >> Open Debuginfo file: /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.21.so
> >> Try to find probe point from debuginfo.
> >> Symbol malloc address found : 844a0
> >> Matched function: __libc_malloc
> >> found inline addr: 0x831a6
> >> Probe point found: malloc_atfork+150
> >> Searching 'bytes' variable in context.
> >> Converting variable bytes into trace event.
> >> bytes type is long unsigned int.
> >> found inline addr: 0x844a0
> >> Probe point found: __libc_malloc+0
> >> Searching 'bytes' variable in context.
> >> Converting variable bytes into trace event.
> >> bytes type is long unsigned int.
> >> found inline addr: 0x8463b
> >> Probe point found: __malloc_get_state+11
> >> Searching 'bytes' variable in context.
> >> Failed to find 'bytes' in this function.
> >> Probe point error, ignoring. Atleast one probe point found
> >> found inline addr: 0x84bba
> >> Probe point found: __libc_realloc+410
> >> Searching 'bytes' variable in context.
> >> Failed to find 'bytes' in this function.
> >> Probe point error, ignoring. Atleast one probe point found
> >> found inline addr: 0x84d08
> >> ...
> >> Probe point error, ignoring. Atleast one probe point found
> >> Found 3 probe_trace_events.
> >> Opening /sys/kernel/debug/tracing//uprobe_events write=1
> >> Writing event: p:probe_libc/malloc /lib/x86_64-linux-gnu/libc-2.21.so:0x831a6
> >> bytes=%bp:u64
> >> Writing event: p:probe_libc/malloc_1 /lib/x86_64-linux-gnu/libc-2.21.so:0x844a0
> >> bytes=%di:u64
> >> Writing event: p:probe_libc/malloc_2 /lib/x86_64-linux-gnu/libc-2.21.so:0x85af7
> >> bytes=%di:u64
> >> Added new events:
> >>    probe_libc:malloc    (on malloc in /lib/x86_64-linux-gnu/libc-2.21.so
> >> with bytes)
> >>    probe_libc:malloc_1  (on malloc in /lib/x86_64-linux-gnu/libc-2.21.so
> >> with bytes)
> >>    probe_libc:malloc_2  (on malloc in /lib/x86_64-linux-gnu/libc-2.21.so
> >> with bytes)
> >>
> >> Signed-off-by: Joel Fernandes <agnel.joel@gmail.com>
> >> ---
> >>   tools/perf/util/probe-finder.c | 4 ++++
> >>   1 file changed, 4 insertions(+)
> >>
> >> diff --git a/tools/perf/util/probe-finder.c
> >> b/tools/perf/util/probe-finder.c
> >> index 4ce5c5e..3ac9481 100644
> >> --- a/tools/perf/util/probe-finder.c
> >> +++ b/tools/perf/util/probe-finder.c
> >> @@ -1255,6 +1255,10 @@ end:
> >>         if (ret) {
> >>                 clear_probe_trace_event(tev);
> >>                 tf->ntevs--;
> >> +               if (tf->ntevs != 0) {
> >> +                       pr_debug("Ignoring error as atleast one probe
> >> point found.\n");
> >> +                       ret = 0;
> >> +               }
> >>         }
> >>         free(args);
> >>         return ret;
> >>
> >>

  parent reply	other threads:[~2016-02-29 14:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-28 11:14 [RFC] perf: probe_finder: continue if atleast one probe point found Joel Fernandes
2016-02-28 11:35 ` Taeung Song
     [not found]   ` <CAD=GYpZtDb3ugJRFQg1karJ_Fb7RsGPpSu0ZbL8i9Oy8x5eZ9A@mail.gmail.com>
2016-02-29 14:19     ` Arnaldo Carvalho de Melo [this message]
2016-03-01  3:09       ` 平松雅巳 / HIRAMATU,MASAMI
2016-03-01  4:29         ` 平松雅巳 / HIRAMATU,MASAMI
2016-03-01 10:34           ` Joel Fernandes
2016-03-01 10:36             ` Joel Fernandes

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=20160229141944.GF8720@kernel.org \
    --to=acme@kernel.org \
    --cc=agnel.joel@gmail.com \
    --cc=joel.opensrc@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=treeze.taeung@gmail.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).