public inbox for linux-kernel@vger.kernel.org
 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 v3 3/7] perf probe: Do not show non representive lines by perf-probe -L
Date: Mon, 18 Nov 2019 19:01:47 -0300	[thread overview]
Message-ID: <20191118220147.GD20465@kernel.org> (raw)
In-Reply-To: <157406473064.24476.2913278267727587314.stgit@devnote2>

Em Mon, Nov 18, 2019 at 05:12:10PM +0900, Masami Hiramatsu escreveu:
> Since perf probe -L shows non representive lines, it can be
> mislead users where user can put probes.
> This prevents to show such non representive lines so that user
> can understand which lines user can probe.
> 
>   # perf probe -L kernel_read
>   <kernel_read@/build/linux-pvZVvI/linux-5.0.0/fs/read_write.c:0>
>         0  ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
>            {
>         2         mm_segment_t old_fs;
>                   ssize_t result;
> 
>                   old_fs = get_fs();
>         6         set_fs(get_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);

Thanks, this fixes the problem I reported, applied.

- Arnaldo
 
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> ---
>  tools/perf/util/probe-finder.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
> index ef1b320cedf8..f12ad507a822 100644
> --- a/tools/perf/util/probe-finder.c
> +++ b/tools/perf/util/probe-finder.c
> @@ -1734,12 +1734,19 @@ static int line_range_walk_cb(const char *fname, int lineno,
>  			      void *data)
>  {
>  	struct line_finder *lf = data;
> +	const char *__fname;
> +	int __lineno;
>  	int err;
>  
>  	if ((strtailcmp(fname, lf->fname) != 0) ||
>  	    (lf->lno_s > lineno || lf->lno_e < lineno))
>  		return 0;
>  
> +	/* Make sure this line can be reversable */
> +	if (cu_find_lineinfo(&lf->cu_die, addr, &__fname, &__lineno) > 0
> +	    && (lineno != __lineno || strcmp(fname, __fname)))
> +		return 0;
> +
>  	err = line_range_add_line(fname, lineno, lf->lr);
>  	if (err < 0 && err != -EEXIST)
>  		return err;

-- 

- Arnaldo

  reply	other threads:[~2019-11-18 22:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-18  8:11 [PATCH v3 0/7] perf/probe: Support multiprobe and immediates with fixes Masami Hiramatsu
2019-11-18  8:11 ` [PATCH v3 1/7] perf probe: Show correct statement line number by perf probe -l Masami Hiramatsu
2019-11-18 21:57   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 2/7] perf probe: Verify given line is a representive line Masami Hiramatsu
2019-11-18 21:59   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 3/7] perf probe: Do not show non representive lines by perf-probe -L Masami Hiramatsu
2019-11-18 22:01   ` Arnaldo Carvalho de Melo [this message]
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 4/7] perf probe: Generate event name with line number Masami Hiramatsu
2019-11-18 22:03   ` Arnaldo Carvalho de Melo
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 5/7] perf probe: Support multiprobe event Masami Hiramatsu
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 6/7] perf probe: Support DW_AT_const_value constant value Masami Hiramatsu
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18  8:12 ` [PATCH v3 7/7] perf probe: Trace a magic number if variable is not found Masami Hiramatsu
2019-11-19 16:56   ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu
2019-11-18 22:11 ` [PATCH v3 0/7] perf/probe: Support multiprobe and immediates with fixes Arnaldo Carvalho de Melo
2019-11-19 13:46   ` Masami Hiramatsu
2019-11-19 14:33     ` 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=20191118220147.GD20465@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