mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Wang Nan <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: acme@redhat.com, namhyung@kernel.org,
	linux-kernel@vger.kernel.org, masami.hiramatsu.pt@hitachi.com,
	paulus@samba.org, hpa@zytor.com, a.p.zijlstra@chello.nl,
	tglx@linutronix.de, lizefan@huawei.com, mingo@kernel.org,
	wangnan0@huawei.com
Subject: [tip:perf/core] perf probe: Load map before glob matching
Date: Wed, 20 May 2015 05:23:27 -0700	[thread overview]
Message-ID: <tip-75e4a2a6af15e956993913314ced2582b350a647@git.kernel.org> (raw)
In-Reply-To: <1431692084-46287-1-git-send-email-wangnan0@huawei.com>

Commit-ID:  75e4a2a6af15e956993913314ced2582b350a647
Gitweb:     http://git.kernel.org/tip/75e4a2a6af15e956993913314ced2582b350a647
Author:     Wang Nan <wangnan0@huawei.com>
AuthorDate: Fri, 15 May 2015 12:14:44 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 18 May 2015 10:16:48 -0300

perf probe: Load map before glob matching

Commit 4c859351226c920b227fec040a3b447f0d482af3 ("perf probe: Support
glob wildcards for function name") introduces a problem:

  # /root/perf probe kmem_cache_free
 Failed to find symbol kmem_cache_free in kernel
   Error: Failed to add events.

The reason is the replacement of map__for_each_symbol_by_name() (by
map__for_each_symbol()). Although their names are similar,
map__for_each_symbol doesn't call map__load() and dso__sort_by_name()
before searching. The missing of map__load() causes this problem because
it search symbol before load dso map.

This patch ensures map__load() is called before using
map__for_each_symbol().

After this patch:

 # /root/perf probe kmem_cache_free
  Added new event:
    probe:kmem_cache_free (on kmem_cache_free%return)

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

        perf record -e probe:kmem_cache_free -aR sleep 1

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1431692084-46287-1-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/probe-event.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 2399dc4..1faa1e6 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2499,6 +2499,9 @@ static int find_probe_functions(struct map *map, char *name)
 	struct symbol *sym;
 	struct rb_node *tmp;
 
+	if (map__load(map, NULL) < 0)
+		return 0;
+
 	map__for_each_symbol(map, sym, tmp) {
 		if (strglobmatch(sym->name, name))
 			found++;

      parent reply	other threads:[~2015-05-20 12:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 12:14 [PATCH tip/perf/core] " Wang Nan
2015-05-15 15:15 ` Masami Hiramatsu
2015-05-15 20:07   ` Arnaldo Carvalho de Melo
2015-05-16 12:10     ` Masami Hiramatsu
2015-05-18 13:17       ` Arnaldo Carvalho de Melo
2015-05-18 23:41         ` Masami Hiramatsu
2015-05-19 13:46           ` Arnaldo Carvalho de Melo
2015-05-20 12:23 ` tip-bot for Wang Nan [this message]

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=tip-75e4a2a6af15e956993913314ced2582b350a647@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.org \
    --cc=tglx@linutronix.de \
    --cc=wangnan0@huawei.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

Powered by JetHome