Messages in this thread | | | Date | Thu, 7 Nov 2019 22:47:01 +0900 | From | Masami Hiramatsu <> | Subject | Re: [PATCH 3/5] perf probe: Support multiprobe event |
| |
On Wed, 6 Nov 2019 16:56:30 -0300 Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Em Tue, Nov 05, 2019 at 09:17:09AM +0900, Masami Hiramatsu escreveu: > > Support multiprobe event if the event is based on function > > and lines and kernel supports it. In this case, perf probe > > creates the first probe with an event, and tries to append > > following probes on that event, since those probes must be > > on the same source code line. > > > > Before this patch; > > # perf probe -a vfs_read:18 > > Added new events: > > probe:vfs_read_L18 (on vfs_read:18) > > probe:vfs_read_L18_1 (on vfs_read:18) > > So this seems to depend on the previous one, I'll leave it for later, > till we figure that one out,
Yes, multiprobe can append several different probe points to one probe-event. User can operate those probes in one action. (sorry, not "atomically" controlled. that requires a stop_machine...)
Thank you,
> > - Arnaldo > > > You can now use it in all perf tools, such as: > > > > perf record -e probe:vfs_read_L18_1 -aR sleep 1 > > > > # > > > > After this patch (on multiprobe supported kernel) > > # perf probe -a vfs_read:18 > > Added new events: > > probe:vfs_read_L18 (on vfs_read:18) > > probe:vfs_read_L18 (on vfs_read:18) > > > > You can now use it in all perf tools, such as: > > > > perf record -e probe:vfs_read_L18 -aR sleep 1 > > > > # > > > > Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org> > > --- > > tools/perf/util/probe-event.c | 9 +++++++-- > > tools/perf/util/probe-file.c | 7 +++++++ > > tools/perf/util/probe-file.h | 1 + > > 3 files changed, 15 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c > > index d14b970a6461..23db6786c3ea 100644 > > --- a/tools/perf/util/probe-event.c > > +++ b/tools/perf/util/probe-event.c > > @@ -2738,8 +2738,13 @@ static int probe_trace_event__set_name(struct probe_trace_event *tev, > > if (tev->event == NULL || tev->group == NULL) > > return -ENOMEM; > > > > - /* Add added event name to namelist */ > > - strlist__add(namelist, event); > > + /* > > + * Add new event name to namelist if multiprobe event is NOT > > + * supported, since we have to use new event name for following > > + * probes in that case. > > + */ > > + if (!multiprobe_event_is_supported()) > > + strlist__add(namelist, event); > > return 0; > > } > > > > diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c > > index b659466ea498..a63f1a19b0e8 100644 > > --- a/tools/perf/util/probe-file.c > > +++ b/tools/perf/util/probe-file.c > > @@ -1007,6 +1007,7 @@ enum ftrace_readme { > > FTRACE_README_KRETPROBE_OFFSET, > > FTRACE_README_UPROBE_REF_CTR, > > FTRACE_README_USER_ACCESS, > > + FTRACE_README_MULTIPROBE_EVENT, > > FTRACE_README_END, > > }; > > > > @@ -1020,6 +1021,7 @@ static struct { > > DEFINE_TYPE(FTRACE_README_KRETPROBE_OFFSET, "*place (kretprobe): *"), > > DEFINE_TYPE(FTRACE_README_UPROBE_REF_CTR, "*ref_ctr_offset*"), > > DEFINE_TYPE(FTRACE_README_USER_ACCESS, "*[u]<offset>*"), > > + DEFINE_TYPE(FTRACE_README_MULTIPROBE_EVENT, "*Create/append/*"), > > }; > > > > static bool scan_ftrace_readme(enum ftrace_readme type) > > @@ -1085,3 +1087,8 @@ bool user_access_is_supported(void) > > { > > return scan_ftrace_readme(FTRACE_README_USER_ACCESS); > > } > > + > > +bool multiprobe_event_is_supported(void) > > +{ > > + return scan_ftrace_readme(FTRACE_README_MULTIPROBE_EVENT); > > +} > > diff --git a/tools/perf/util/probe-file.h b/tools/perf/util/probe-file.h > > index 986c1c94f64f..850d1b52d60a 100644 > > --- a/tools/perf/util/probe-file.h > > +++ b/tools/perf/util/probe-file.h > > @@ -71,6 +71,7 @@ bool probe_type_is_available(enum probe_type type); > > bool kretprobe_offset_is_supported(void); > > bool uprobe_ref_ctr_is_supported(void); > > bool user_access_is_supported(void); > > +bool multiprobe_event_is_supported(void); > > #else /* ! HAVE_LIBELF_SUPPORT */ > > static inline struct probe_cache *probe_cache__new(const char *tgt __maybe_unused, struct nsinfo *nsi __maybe_unused) > > { > > -- > > - Arnaldo
-- Masami Hiramatsu <mhiramat@kernel.org>
| |