From: tip-bot for Arnaldo Carvalho de Melo <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jolsa@redhat.com, acme@redhat.com, bp@suse.de,
eranian@google.com, fweisbec@gmail.com, mingo@kernel.org,
masami.hiramatsu.pt@hitachi.com, dsahern@gmail.com,
tglx@linutronix.de, adrian.hunter@intel.com, wangnan0@huawei.com,
linux-kernel@vger.kernel.org, hpa@zytor.com, namhyung@kernel.org
Subject: [tip:perf/urgent] perf probe: Use existing routine to look for a kernel module by dso->short_name
Date: Fri, 25 Sep 2015 23:21:34 -0700 [thread overview]
Message-ID: <tip-266fa2b22294909ddf6e7d2f8acfe07adf9fd978@git.kernel.org> (raw)
In-Reply-To: <20150924015008.GE1897@kernel.org>
Commit-ID: 266fa2b22294909ddf6e7d2f8acfe07adf9fd978
Gitweb: http://git.kernel.org/tip/266fa2b22294909ddf6e7d2f8acfe07adf9fd978
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Thu, 24 Sep 2015 11:24:18 -0300
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 25 Sep 2015 10:41:31 -0300
perf probe: Use existing routine to look for a kernel module by dso->short_name
We have map_groups__find_by_name() to look at the list of modules that
are in place for a given machine, so use it instead of traversing the
machine dso list, which also includes DSOs for userspace.
When merging the user and kernel DSO lists a bug was introduced where
'perf probe' stopped being able to add probes to modules using its short
name:
# perf probe -m usbnet --add usbnet_start_xmit
usbnet_start_xmit is out of .text, skip it.
Error: Failed to add events.
#
With this fix it works again:
# perf probe -m usbnet --add usbnet_start_xmit
Added new event:
probe:usbnet_start_xmit (on usbnet_start_xmit in usbnet)
You can now use it in all perf tools, such as:
perf record -e probe:usbnet_start_xmit -aR sleep 1
#
Reported-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Fixes: 3d39ac538629 ("perf machine: No need to have two DSOs lists")
Link: http://lkml.kernel.org/r/20150924015008.GE1897@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index eb5f18b..c6f9af7 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -270,12 +270,13 @@ static int kernel_get_module_dso(const char *module, struct dso **pdso)
int ret = 0;
if (module) {
- list_for_each_entry(dso, &host_machine->dsos.head, node) {
- if (!dso->kernel)
- continue;
- if (strncmp(dso->short_name + 1, module,
- dso->short_name_len - 2) == 0)
- goto found;
+ char module_name[128];
+
+ snprintf(module_name, sizeof(module_name), "[%s]", module);
+ map = map_groups__find_by_name(&host_machine->kmaps, MAP__FUNCTION, module_name);
+ if (map) {
+ dso = map->dso;
+ goto found;
}
pr_debug("Failed to find module %s.\n", module);
return -ENOENT;
prev parent reply other threads:[~2015-09-26 6:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 3:34 [PATCH] perf probe: Fix module probing with shortname Wang Nan
2015-09-22 13:35 ` Arnaldo Carvalho de Melo
2015-09-23 1:14 ` Wangnan (F)
2015-09-23 2:49 ` Arnaldo Carvalho de Melo
2015-09-23 16:03 ` Arnaldo Carvalho de Melo
2015-09-24 1:50 ` Arnaldo Carvalho de Melo
2015-09-24 2:05 ` Arnaldo Carvalho de Melo
2015-09-24 8:28 ` pi3orama
2015-09-24 10:10 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-24 13:23 ` 'Arnaldo Carvalho de Melo'
2015-09-25 1:57 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-24 10:18 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-26 6:21 ` tip-bot for Arnaldo Carvalho de Melo [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-266fa2b22294909ddf6e7d2f8acfe07adf9fd978@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=bp@suse.de \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.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