From: Namhyung Kim <namhyung@kernel.org>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Jiri Olsa <jolsa@redhat.com>, LKML <linux-kernel@vger.kernel.org>,
Wang Nan <wangnan0@huawei.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Subject: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
Date: Thu, 10 Sep 2015 11:27:06 +0900 [thread overview]
Message-ID: <1441852026-28974-3-git-send-email-namhyung@kernel.org> (raw)
In-Reply-To: <1441852026-28974-1-git-send-email-namhyung@kernel.org>
The init/exit_probe_symbol_maps() was a part of
convert_perf_probe_events() and cleanup_perf_probe_events(). But as
these functions can be called multiple times, it'd be better moving
init/exit functions out of them, so that it should be called only once.
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/builtin-probe.c | 5 +++++
tools/perf/util/probe-event.c | 11 +++++------
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 2bec9c1ef2a3..94385ee89dc8 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -317,6 +317,10 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs)
int i, k;
const char *event = NULL, *group = NULL;
+ ret = init_probe_symbol_maps(pevs->uprobes);
+ if (ret < 0)
+ return ret;
+
ret = convert_perf_probe_events(pevs, npevs);
if (ret < 0)
goto out_cleanup;
@@ -354,6 +358,7 @@ static int perf_add_probe_events(struct perf_probe_event *pevs, int npevs)
out_cleanup:
cleanup_perf_probe_events(pevs, npevs);
+ exit_probe_symbol_maps();
return ret;
}
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 64e15cba7223..2b78e8f19b45 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2746,10 +2746,6 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs)
{
int i, ret;
- ret = init_probe_symbol_maps(pevs->uprobes);
- if (ret < 0)
- return ret;
-
/* Loop 1: convert all events */
for (i = 0; i < npevs; i++) {
/* Init kprobe blacklist if needed */
@@ -2794,20 +2790,23 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
pevs[i].ntevs = 0;
clear_perf_probe_event(&pevs[i]);
}
-
- exit_probe_symbol_maps();
}
int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
{
int ret;
+ ret = init_probe_symbol_maps(pevs->uprobes);
+ if (ret < 0)
+ return ret;
+
ret = convert_perf_probe_events(pevs, npevs);
if (ret == 0)
ret = apply_perf_probe_events(pevs, npevs);
cleanup_perf_probe_events(pevs, npevs);
+ exit_probe_symbol_maps();
return ret;
}
--
2.5.0
next prev parent reply other threads:[~2015-09-10 2:31 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-10 2:27 [PATCH 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events() Namhyung Kim
2015-09-10 2:27 ` [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps() Namhyung Kim
2015-09-10 12:56 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-16 7:28 ` [tip:perf/core] " tip-bot for Namhyung Kim
2015-09-10 2:27 ` Namhyung Kim [this message]
2015-09-10 12:58 ` [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers 平松雅巳 / HIRAMATU,MASAMI
2015-09-11 15:52 ` Namhyung Kim
2015-09-14 18:18 ` Arnaldo Carvalho de Melo
2015-09-10 8:51 ` [PATCH 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events() 平松雅巳 / HIRAMATU,MASAMI
2015-09-16 7:28 ` [tip:perf/core] perf probe: Free perf_probe_event " tip-bot for Namhyung Kim
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=1441852026-28974-3-git-send-email-namhyung@kernel.org \
--to=namhyung@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@kernel.org \
--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
all inboxes | Powered by JetHome®