Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1221858

[PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
Date 2015-09-10 04:40 +0200
Message-ID <q6ZWi-59b-15@gated-at.bofh.it> (permalink)
References <q6ZWi-59b-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-10 04:40 +0200
  [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers Namhyung Kim <namhyung@kernel.org> - 2015-09-10 04:40 +0200
    RE: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into  callers 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-10 15:00 +0200
      Re: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into  callers Namhyung Kim <namhyung@kernel.org> - 2015-09-11 18:00 +0200
        Re: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into  callers Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-14 20:20 +0200
  [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps() Namhyung Kim <namhyung@kernel.org> - 2015-09-10 04:40 +0200
    RE: [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps() 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-10 15:00 +0200
    [tip:perf/core] perf probe: Export init/exit_probe_symbol_maps() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-09-16 09:30 +0200
  RE: [PATCH 1/3] perf probe: Free perf probe event in  cleanup_perf_probe_events() 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-10 11:00 +0200
  [tip:perf/core] perf probe:   Free perf_probe_event in cleanup_perf_probe_events() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-09-16 09:30 +0200

csiph-web