Messages in this thread | | | From | 平松雅巳 / HIRAMATU,MASAMI <> | Subject | RE: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers | Date | Thu, 10 Sep 2015 12:58:59 +0000 |
| |
-- Masami HIRAMATSU Linux Technology Research Center, System Productivity Research Dept. Center for Technology Innovation - Systems Engineering Hitachi, Ltd., Research & Development Group E-mail: masami.hiramatsu.pt@hitachi.com
>-----Original Message----- >From: Namhyung Kim [mailto:namhyung@gmail.com] On Behalf Of Namhyung Kim >Sent: Thursday, September 10, 2015 11:27 AM >To: Arnaldo Carvalho de Melo >Cc: Ingo Molnar; Peter Zijlstra; Jiri Olsa; LKML; Wang Nan; 平松雅巳 / HIRAMATU,MASAMI >Subject: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers > >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.
Ah, OK, I see. But I'd rather like exposing prototypes in this patch, since this is the true user of it.
Thanks!
> >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
| |