* [PATCH 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events()
@ 2015-09-10 2:27 Namhyung Kim
2015-09-10 2:27 ` [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps() Namhyung Kim
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Namhyung Kim @ 2015-09-10 2:27 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan,
Masami Hiramatsu
The cleanup_perf_probe_events() frees all resources related to a perf
probe event. However it only freed resources in trace probe events, not
perf probe events. So call clear_perf_probe_event() too.
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Reported-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/probe-event.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 5964eccbe94d..3d7d60cc6f16 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2792,6 +2792,7 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
clear_probe_trace_event(&pevs[i].tevs[j]);
zfree(&pevs[i].tevs);
pevs[i].ntevs = 0;
+ clear_perf_probe_event(&pevs[i]);
}
exit_symbol_maps();
--
2.5.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps()
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 ` 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 ` [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers Namhyung Kim
` (2 subsequent siblings)
3 siblings, 2 replies; 10+ messages in thread
From: Namhyung Kim @ 2015-09-10 2:27 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan,
Masami Hiramatsu
The init/exit_symbols_maps() functions are to setup and cleanup
necessary info for probe events. But they need to be called from out of
the probe code now, so this patch exports them.
However the names are too generic, so change them to have 'probe'. :)
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/probe-event.c | 24 ++++++++++++------------
tools/perf/util/probe-event.h | 2 ++
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 3d7d60cc6f16..64e15cba7223 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -71,7 +71,7 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
static struct machine *host_machine;
/* Initialize symbol maps and path of vmlinux/modules */
-static int init_symbol_maps(bool user_only)
+int init_probe_symbol_maps(bool user_only)
{
int ret;
@@ -101,7 +101,7 @@ out:
return ret;
}
-static void exit_symbol_maps(void)
+void exit_probe_symbol_maps(void)
{
if (host_machine) {
machine__delete(host_machine);
@@ -859,11 +859,11 @@ int show_line_range(struct line_range *lr, const char *module, bool user)
{
int ret;
- ret = init_symbol_maps(user);
+ ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
ret = __show_line_range(lr, module, user);
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -941,7 +941,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
int i, ret = 0;
struct debuginfo *dinfo;
- ret = init_symbol_maps(pevs->uprobes);
+ ret = init_probe_symbol_maps(pevs->uprobes);
if (ret < 0)
return ret;
@@ -958,7 +958,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
debuginfo__delete(dinfo);
out:
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -2262,7 +2262,7 @@ int show_perf_probe_events(struct strfilter *filter)
setup_pager();
- ret = init_symbol_maps(false);
+ ret = init_probe_symbol_maps(false);
if (ret < 0)
return ret;
@@ -2278,7 +2278,7 @@ int show_perf_probe_events(struct strfilter *filter)
close(kp_fd);
if (up_fd > 0)
close(up_fd);
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -2746,7 +2746,7 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs)
{
int i, ret;
- ret = init_symbol_maps(pevs->uprobes);
+ ret = init_probe_symbol_maps(pevs->uprobes);
if (ret < 0)
return ret;
@@ -2795,7 +2795,7 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
clear_perf_probe_event(&pevs[i]);
}
- exit_symbol_maps();
+ exit_probe_symbol_maps();
}
int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
@@ -2867,7 +2867,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
struct map *map;
int ret;
- ret = init_symbol_maps(user);
+ ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
@@ -2897,7 +2897,7 @@ end:
if (user) {
map__put(map);
}
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index 9bcea36359f2..ba926c30f8cd 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -110,6 +110,8 @@ struct variable_list {
};
struct map;
+int init_probe_symbol_maps(bool user_only);
+void exit_probe_symbol_maps(void);
/* Command string to events */
extern int parse_perf_probe_command(const char *cmd,
--
2.5.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
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 2:27 ` Namhyung Kim
2015-09-10 12:58 ` 平松雅巳 / HIRAMATU,MASAMI
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
3 siblings, 1 reply; 10+ messages in thread
From: Namhyung Kim @ 2015-09-10 2:27 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan,
Masami Hiramatsu
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
^ permalink raw reply related [flat|nested] 10+ messages in thread
* RE: [PATCH 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events()
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 2:27 ` [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers Namhyung Kim
@ 2015-09-10 8:51 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-16 7:28 ` [tip:perf/core] perf probe: Free perf_probe_event " tip-bot for Namhyung Kim
3 siblings, 0 replies; 10+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-09-10 8:51 UTC (permalink / raw)
To: 'Namhyung Kim', Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1505 bytes --]
Hi Namhyung,
>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 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events()
>
>The cleanup_perf_probe_events() frees all resources related to a perf
>probe event. However it only freed resources in trace probe events, not
>perf probe events. So call clear_perf_probe_event() too.
This looks good to me :)
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Thanks!
>
>Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
>Reported-by: Wang Nan <wangnan0@huawei.com>
>Signed-off-by: Namhyung Kim <namhyung@kernel.org>
>---
> tools/perf/util/probe-event.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>index 5964eccbe94d..3d7d60cc6f16 100644
>--- a/tools/perf/util/probe-event.c
>+++ b/tools/perf/util/probe-event.c
>@@ -2792,6 +2792,7 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> clear_probe_trace_event(&pevs[i].tevs[j]);
> zfree(&pevs[i].tevs);
> pevs[i].ntevs = 0;
>+ clear_perf_probe_event(&pevs[i]);
> }
>
> exit_symbol_maps();
>--
>2.5.0
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps()
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
1 sibling, 0 replies; 10+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-09-10 12:56 UTC (permalink / raw)
To: 'Namhyung Kim', Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 4065 bytes --]
>From: Namhyung Kim [mailto:namhyung@gmail.com] On Behalf Of Namhyung Kim
>
>The init/exit_symbols_maps() functions are to setup and cleanup
>necessary info for probe events. But they need to be called from out of
>the probe code now, so this patch exports them.
>
>However the names are too generic, so change them to have 'probe'. :)
Changing name is OK, but why are they exposed??
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/util/probe-event.c | 24 ++++++++++++------------
> tools/perf/util/probe-event.h | 2 ++
> 2 files changed, 14 insertions(+), 12 deletions(-)
>
>diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
>index 3d7d60cc6f16..64e15cba7223 100644
>--- a/tools/perf/util/probe-event.c
>+++ b/tools/perf/util/probe-event.c
>@@ -71,7 +71,7 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
> static struct machine *host_machine;
>
> /* Initialize symbol maps and path of vmlinux/modules */
>-static int init_symbol_maps(bool user_only)
>+int init_probe_symbol_maps(bool user_only)
> {
> int ret;
>
>@@ -101,7 +101,7 @@ out:
> return ret;
> }
>
>-static void exit_symbol_maps(void)
>+void exit_probe_symbol_maps(void)
> {
> if (host_machine) {
> machine__delete(host_machine);
>@@ -859,11 +859,11 @@ int show_line_range(struct line_range *lr, const char *module, bool user)
> {
> int ret;
>
>- ret = init_symbol_maps(user);
>+ ret = init_probe_symbol_maps(user);
> if (ret < 0)
> return ret;
> ret = __show_line_range(lr, module, user);
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
>
> return ret;
> }
>@@ -941,7 +941,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
> int i, ret = 0;
> struct debuginfo *dinfo;
>
>- ret = init_symbol_maps(pevs->uprobes);
>+ ret = init_probe_symbol_maps(pevs->uprobes);
> if (ret < 0)
> return ret;
>
>@@ -958,7 +958,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
>
> debuginfo__delete(dinfo);
> out:
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
> return ret;
> }
>
>@@ -2262,7 +2262,7 @@ int show_perf_probe_events(struct strfilter *filter)
>
> setup_pager();
>
>- ret = init_symbol_maps(false);
>+ ret = init_probe_symbol_maps(false);
> if (ret < 0)
> return ret;
>
>@@ -2278,7 +2278,7 @@ int show_perf_probe_events(struct strfilter *filter)
> close(kp_fd);
> if (up_fd > 0)
> close(up_fd);
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
>
> return ret;
> }
>@@ -2746,7 +2746,7 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> {
> int i, ret;
>
>- ret = init_symbol_maps(pevs->uprobes);
>+ ret = init_probe_symbol_maps(pevs->uprobes);
> if (ret < 0)
> return ret;
>
>@@ -2795,7 +2795,7 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> clear_perf_probe_event(&pevs[i]);
> }
>
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
> }
>
> int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
>@@ -2867,7 +2867,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
> struct map *map;
> int ret;
>
>- ret = init_symbol_maps(user);
>+ ret = init_probe_symbol_maps(user);
> if (ret < 0)
> return ret;
>
>@@ -2897,7 +2897,7 @@ end:
> if (user) {
> map__put(map);
> }
>- exit_symbol_maps();
>+ exit_probe_symbol_maps();
>
> return ret;
> }
>diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
>index 9bcea36359f2..ba926c30f8cd 100644
>--- a/tools/perf/util/probe-event.h
>+++ b/tools/perf/util/probe-event.h
>@@ -110,6 +110,8 @@ struct variable_list {
> };
>
> struct map;
>+int init_probe_symbol_maps(bool user_only);
>+void exit_probe_symbol_maps(void);
>
> /* Command string to events */
> extern int parse_perf_probe_command(const char *cmd,
>--
>2.5.0
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 10+ messages in thread
* RE: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
2015-09-10 2:27 ` [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers Namhyung Kim
@ 2015-09-10 12:58 ` 平松雅巳 / HIRAMATU,MASAMI
2015-09-11 15:52 ` Namhyung Kim
0 siblings, 1 reply; 10+ messages in thread
From: 平松雅巳 / HIRAMATU,MASAMI @ 2015-09-10 12:58 UTC (permalink / raw)
To: 'Namhyung Kim', Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 3230 bytes --]
--
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
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
2015-09-10 12:58 ` 平松雅巳 / HIRAMATU,MASAMI
@ 2015-09-11 15:52 ` Namhyung Kim
2015-09-14 18:18 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 10+ messages in thread
From: Namhyung Kim @ 2015-09-11 15:52 UTC (permalink / raw)
To: 平松雅巳 / HIRAMATU,MASAMI
Cc: Arnaldo Carvalho de Melo, Ingo Molnar, Peter Zijlstra, Jiri Olsa,
LKML, Wang Nan
On Thu, Sep 10, 2015 at 12:58:59PM +0000, 平松雅巳 / HIRAMATU,MASAMI wrote:
>
> >From: Namhyung Kim [mailto:namhyung@gmail.com] On Behalf Of Namhyung Kim
> >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.
I'm fine with merging 2/3 and 3/3. Arnaldo, could you do this or do
you want me to resend?
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
2015-09-11 15:52 ` Namhyung Kim
@ 2015-09-14 18:18 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 10+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-14 18:18 UTC (permalink / raw)
To: Namhyung Kim
Cc: 平松雅巳 / HIRAMATU,MASAMI,
Ingo Molnar, Peter Zijlstra, Jiri Olsa, LKML, Wang Nan
Em Sat, Sep 12, 2015 at 12:52:22AM +0900, Namhyung Kim escreveu:
> On Thu, Sep 10, 2015 at 12:58:59PM +0000, 平松雅巳 / HIRAMATU,MASAMI wrote:
> >
> > >From: Namhyung Kim [mailto:namhyung@gmail.com] On Behalf Of Namhyung Kim
> > >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.
>
> I'm fine with merging 2/3 and 3/3. Arnaldo, could you do this or do
> you want me to resend?
Done. Merged the three, combined 2/3 with 3/3.
- Arnaldo
^ permalink raw reply [flat|nested] 10+ messages in thread
* [tip:perf/core] perf probe: Free perf_probe_event in cleanup_perf_probe_events()
2015-09-10 2:27 [PATCH 1/3] perf probe: Free perf probe event in cleanup_perf_probe_events() Namhyung Kim
` (2 preceding siblings ...)
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-bot for Namhyung Kim
3 siblings, 0 replies; 10+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-09-16 7:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: tglx, a.p.zijlstra, acme, linux-kernel, mingo,
masami.hiramatsu.pt, hpa, wangnan0, jolsa, namhyung
Commit-ID: a43aac299c3abc09eff856039f5b72166b780d35
Gitweb: http://git.kernel.org/tip/a43aac299c3abc09eff856039f5b72166b780d35
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 10 Sep 2015 11:27:04 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 15 Sep 2015 09:48:32 -0300
perf probe: Free perf_probe_event in cleanup_perf_probe_events()
The cleanup_perf_probe_events() frees all resources related to a perf
probe event. However it only freed resources in trace probe events, not
perf probe events. So call clear_perf_probe_event() too.
Reported-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1441852026-28974-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 5964ecc..3d7d60c 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -2792,6 +2792,7 @@ void cleanup_perf_probe_events(struct perf_probe_event *pevs, int npevs)
clear_probe_trace_event(&pevs[i].tevs[j]);
zfree(&pevs[i].tevs);
pevs[i].ntevs = 0;
+ clear_perf_probe_event(&pevs[i]);
}
exit_symbol_maps();
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [tip:perf/core] perf probe: Export init/exit_probe_symbol_maps()
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-bot for Namhyung Kim
1 sibling, 0 replies; 10+ messages in thread
From: tip-bot for Namhyung Kim @ 2015-09-16 7:28 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, masami.hiramatsu.pt, tglx, jolsa, wangnan0,
namhyung, a.p.zijlstra, acme, mingo
Commit-ID: 9bae1e8c3fe5359ce17309b894f54667fd563e98
Gitweb: http://git.kernel.org/tip/9bae1e8c3fe5359ce17309b894f54667fd563e98
Author: Namhyung Kim <namhyung@kernel.org>
AuthorDate: Thu, 10 Sep 2015 11:27:05 +0900
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 15 Sep 2015 09:48:32 -0300
perf probe: Export init/exit_probe_symbol_maps()
The init/exit_symbols_maps() functions are to setup and cleanup
necessary info for probe events. But they need to be called from out of
the probe code now, so this patch exports them.
However the names are too generic, so change them to have 'probe'. :)
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1441852026-28974-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-probe.c | 5 +++++
tools/perf/util/probe-event.c | 31 +++++++++++++++----------------
tools/perf/util/probe-event.h | 2 ++
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 2bec9c1..94385ee 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 3d7d60c..2b78e8f 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -71,7 +71,7 @@ static char *synthesize_perf_probe_point(struct perf_probe_point *pp);
static struct machine *host_machine;
/* Initialize symbol maps and path of vmlinux/modules */
-static int init_symbol_maps(bool user_only)
+int init_probe_symbol_maps(bool user_only)
{
int ret;
@@ -101,7 +101,7 @@ out:
return ret;
}
-static void exit_symbol_maps(void)
+void exit_probe_symbol_maps(void)
{
if (host_machine) {
machine__delete(host_machine);
@@ -859,11 +859,11 @@ int show_line_range(struct line_range *lr, const char *module, bool user)
{
int ret;
- ret = init_symbol_maps(user);
+ ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
ret = __show_line_range(lr, module, user);
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -941,7 +941,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
int i, ret = 0;
struct debuginfo *dinfo;
- ret = init_symbol_maps(pevs->uprobes);
+ ret = init_probe_symbol_maps(pevs->uprobes);
if (ret < 0)
return ret;
@@ -958,7 +958,7 @@ int show_available_vars(struct perf_probe_event *pevs, int npevs,
debuginfo__delete(dinfo);
out:
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -2262,7 +2262,7 @@ int show_perf_probe_events(struct strfilter *filter)
setup_pager();
- ret = init_symbol_maps(false);
+ ret = init_probe_symbol_maps(false);
if (ret < 0)
return ret;
@@ -2278,7 +2278,7 @@ int show_perf_probe_events(struct strfilter *filter)
close(kp_fd);
if (up_fd > 0)
close(up_fd);
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
@@ -2746,10 +2746,6 @@ int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs)
{
int i, ret;
- ret = init_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_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;
}
@@ -2867,7 +2866,7 @@ int show_available_funcs(const char *target, struct strfilter *_filter,
struct map *map;
int ret;
- ret = init_symbol_maps(user);
+ ret = init_probe_symbol_maps(user);
if (ret < 0)
return ret;
@@ -2897,7 +2896,7 @@ end:
if (user) {
map__put(map);
}
- exit_symbol_maps();
+ exit_probe_symbol_maps();
return ret;
}
diff --git a/tools/perf/util/probe-event.h b/tools/perf/util/probe-event.h
index 9bcea36..ba926c3 100644
--- a/tools/perf/util/probe-event.h
+++ b/tools/perf/util/probe-event.h
@@ -110,6 +110,8 @@ struct variable_list {
};
struct map;
+int init_probe_symbol_maps(bool user_only);
+void exit_probe_symbol_maps(void);
/* Command string to events */
extern int parse_perf_probe_command(const char *cmd,
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-09-16 7:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers Namhyung Kim
2015-09-10 12:58 ` 平松雅巳 / 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).