perf probe: Free perf probe event in cleanup_perf_probe_events()
Namhyung Kim
maintainerPATCH 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.
--- tools/perf/util/probe-event.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/probe-event.c +1 -0
@@ -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 ();
Signature · 1 line
2.5.0
Namhyung Kim
maintainerPATCH 2/3 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'. :)
--- tools/perf/util/probe-event.c | 24 ++++++++++++------------ tools/perf/util/probe-event.h | 2 ++ 2 files changed, 14 insertions(+), 12 deletions(-)
tools/perf/util/probe-event.c +12 -12
@@ -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; }
tools/perf/util/probe-event.h +2 -0
@@ -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,
Signature · 1 line
2.5.0
RE: [PATCH 2/3] perf probe: Export init/exit_probe_symbol_maps()
Quoted 7 lines
From: Namhyung Kim [mailto:[email protected]] 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,
Quoted 131 lines
Cc Masami Hiramatsu <[email protected]>Cc Wang Nan <[email protected]>Signed-off-by Namhyung Kim <[email protected]>---
tools/perf/util/probe-event.c| 24 ++++++++++++------------tools/perf/util/probe-event.h| 2 ++2 files changed, 14 insertions(+), 12 deletions(-)tools/perf/util/probe-event.c +5
-5@@ -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:
tools/perf/util/probe-event.c +1
-1-exit_symbol_maps (); +exit_probe_symbol_maps ();return ret; }tools/perf/util/probe-event.c +6
-6@@ -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; }tools/perf/util/probe-event.h +2
-1@@ -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, --
Quoted 1 line
2.5.0
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf probe: Export init/exit_probe_symbol_maps()
In reply to Namhyung Kimperf probe: Export init/exit_probe_symbol_maps()
Commit-ID: 9bae1e8c3fe5359ce17309b894f54667fd563e98 Gitweb: http://git.kernel.org/tip/9bae1e8c3fe5359ce17309b894f54667fd563e98 Author: Namhyung Kim <[email protected]> AuthorDate: Thu, 10 Sep 2015 11:27:05 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> 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'. :)
--- 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(-)
tools/perf/builtin-probe.c +5 -0
@@ -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; }
tools/perf/util/probe-event.c +15 -16
@@ -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; }
tools/perf/util/probe-event.h +2 -0
@@ -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,
Namhyung Kim
maintainerPATCH 3/3 perf probe: Move init/exit_probe_symbol_maps() into callers
In reply to Namhyung KimThe 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.
--- tools/perf/builtin-probe.c | 5 +++++ tools/perf/util/probe-event.c | 11 +++++------ 2 files changed, 10 insertions(+), 6 deletions(-)
tools/perf/builtin-probe.c +5 -0
@@ -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; }
tools/perf/util/probe-event.c +5 -6
@@ -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; }
Signature · 1 line
2.5.0
RE: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
Signature · 6 lines
-- Masami HIRAMATSU Linux Technology Research Center, System Productivity Research Dept. Center for Technology Innovation - Systems Engineering Hitachi, Ltd., Research & Development Group E-mail: [email protected]
Quoted 11 lines
-----Original Message-----
From: Namhyung Kim [mailto:[email protected]] 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 callersThe init/exit_probe_symbol_maps() was a part of
convert_perf_probe_events()andcleanup_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!
Quoted 74 lines
Cc Masami Hiramatsu <[email protected]>Cc Wang Nan <[email protected]>Signed-off-by Namhyung Kim <[email protected]>---
tools/perf/builtin-probe.c| 5 +++++tools/perf/util/probe-event.c| 11 +++++------2 files changed, 10 insertions(+), 6 deletions(-)tools/perf/builtin-probe.c +4
-0@@ -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);tools/perf/builtin-probe.c +1
-0+exit_probe_symbol_maps ();return ret; }tools/perf/util/probe-event.c +5
-7@@ -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; } --
Quoted 1 line
2.5.0
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Namhyung Kim
maintainerRe: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
Quoted 10 lines · 平松雅巳 / HIRAMATU,MASAMI
Quoted 6 lines
From: Namhyung Kim [mailto:[email protected]] On Behalf Of Namhyung Kim The init/exit_probe_symbol_maps() was a part of
convert_perf_probe_events()andcleanup_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
Arnaldo Carvalho de Melo
maintainerRe: [PATCH 3/3] perf probe: Move init/exit_probe_symbol_maps() into callers
Em Sat, Sep 12, 2015 at 12:52:22AM +0900, Namhyung Kim escreveu:
Quoted 8 lines · 平松雅巳 / HIRAMATU,MASAMI
Quoted 7 lines
Quoted 6 lines
From: Namhyung Kim [mailto:[email protected]] On Behalf Of Namhyung Kim The init/exit_probe_symbol_maps() was a part of
convert_perf_probe_events()andcleanup_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.
Quoted 6 lines
Quoted 3 lines
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
Hi Namhyung,
Quoted 9 lines
From: Namhyung Kim [mailto:[email protected]] 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 incleanup_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 callclear_perf_probe_event()too.
This looks good to me :)
Thanks!
Quoted 21 lines
Cc Masami Hiramatsu <[email protected]>Reported-by Wang Nan <[email protected]>Signed-off-by Namhyung Kim <[email protected]>---
tools/perf/util/probe-event.c| 1 +1 file changed, 1 insertion(+)tools/perf/util/probe-event.c +1
-1@@ -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 (); --
Quoted 1 line
2.5.0
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
tip-bot for Namhyung Kim
merge bot[tip:perf/core] perf probe: Free perf_probe_event in cleanup_perf_probe_events()
In reply to Namhyung Kimperf probe: Free perf_probe_event in cleanup_perf_probe_events()
Commit-ID: a43aac299c3abc09eff856039f5b72166b780d35 Gitweb: http://git.kernel.org/tip/a43aac299c3abc09eff856039f5b72166b780d35 Author: Namhyung Kim <[email protected]> AuthorDate: Thu, 10 Sep 2015 11:27:04 +0900 Committer: Arnaldo Carvalho de Melo <[email protected]> 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.
--- tools/perf/util/probe-event.c | 1 + 1 file changed, 1 insertion(+)
tools/perf/util/probe-event.c +1 -0
@@ -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 ();