linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	linux-kernel@vger.kernel.org,
	Tom Zanussi <tom.zanussi@linux.intel.com>,
	Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: [PATCH v2 1/4] perf probe: Generate event name with line number
Date: Mon, 11 Nov 2019 11:04:50 -0300	[thread overview]
Message-ID: <20191111140450.GB9365@kernel.org> (raw)
In-Reply-To: <157314407850.4063.2307803945694526578.stgit@devnote2>

Em Fri, Nov 08, 2019 at 01:27:58AM +0900, Masami Hiramatsu escreveu:
> Generate event name from function name with line number
> as <function>_L<line_number>. Note that this is only for
> the new event which is defined by the line number of
> function (except for line 0).
> 
> If there is another event on same line, you have to use
> "-f" option. In that case, the new event has "_1" suffix.
> 
>  e.g.
>   # perf probe -a kernel_read:1
>   Added new events:
>     probe:kernel_read_L1 (on kernel_read:1)

While testing this, using the same function (kernel_read), I found it
confusing that it is possible to insert probes in lines seemingly with
no code, for instance:

[root@quaco ~]# perf probe -a kernel_read:1
Added new event:
  probe:kernel_read_L1 (on kernel_read:1)

You can now use it in all perf tools, such as:

	perf record -e probe:kernel_read_L1 -aR sleep 1

[root@quaco ~]# perf probe -a kernel_read:2
Added new event:
  probe:kernel_read_L2 (on kernel_read:2)

You can now use it in all perf tools, such as:

	perf record -e probe:kernel_read_L2 -aR sleep 1

[root@quaco ~]#
[root@quaco ~]# perf probe --list
  probe:kernel_read_L1 (on kernel_read@fs/read_write.c)
  probe:kernel_read_L2 (on kernel_read:1@fs/read_write.c)
[root@quaco ~]# perf probe -L kernel_read
<kernel_read@/usr/src/debug/kernel-5.3.fc30/linux-5.3.8-200.fc30.x86_64/fs/read_write.c:0>
      0  ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
      1  {
      2         mm_segment_t old_fs;
      3         ssize_t result;

      5         old_fs = get_fs();
      6         set_fs(KERNEL_DS);
                /* The cast to a user pointer is valid due to the set_fs() */
      8         result = vfs_read(file, (void __user *)buf, count, pos);
      9         set_fs(old_fs);
     10         return result;
         }
         EXPORT_SYMBOL(kernel_read);


[root@quaco ~]#


What is the point of putting a probe on line 2? I is not initializing,
etc, 1 as well, notthing there and we already have 0 (or not specifying
a line number) to put a probe at the start of a function, can you
clarify?

I'll apply this patch, the problem above isn't strictly related to it.

- Arnaldo

  reply	other threads:[~2019-11-11 14:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-07 16:27 [PATCH v2 0/4] perf/probe: Support multiprobe and immediates Masami Hiramatsu
2019-11-07 16:27 ` [PATCH v2 1/4] perf probe: Generate event name with line number Masami Hiramatsu
2019-11-11 14:04   ` Arnaldo Carvalho de Melo [this message]
2019-11-11 14:06     ` Arnaldo Carvalho de Melo
2019-11-11 14:07       ` Arnaldo Carvalho de Melo
2019-11-12 10:31         ` Masami Hiramatsu
2019-11-13  1:01           ` Masami Hiramatsu
2019-11-13 12:09             ` Arnaldo Carvalho de Melo
2019-11-14  4:14               ` Masami Hiramatsu
2019-11-07 16:28 ` [PATCH v2 2/4] perf probe: Support multiprobe event Masami Hiramatsu
2019-11-07 16:28 ` [PATCH v2 3/4] perf probe: Support DW_AT_const_value constant value Masami Hiramatsu
2019-11-07 16:28 ` [PATCH v2 4/4] perf probe: Trace a magic number if variable is not found Masami Hiramatsu

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=20191111140450.GB9365@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=ravi.bangoria@linux.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.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).