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


Groups > linux.kernel > #1220449

Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events()

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events()
Date 2015-09-08 04:00 +0200
Message-ID <q6gmt-6J6-3@gated-at.bofh.it> (permalink)
References <q4Y8i-1MD-3@gated-at.bofh.it> <q5CS5-NJ-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sun, Sep 06, 2015 at 03:47:37PM +0800, Wangnan (F) wrote:
> Hi Namhyung,

Hi,

I'm off until Wednesday.  I'll be able to take a look at it on
Thursday.

Thanks,
Namhyung


> 
> Thanks for this patchset.
> 
> Could you plase have a look at patch 5/27 and 6/27 in my newest pull
> request?
> These 2 patches utilize new probing API to create probe point and collect
> probe_trace_events. I'm not very sure I fully understand your design
> principle,
> especially the cleanup part, because I can see different functions dealing
> with
> cleanup:
> 
> cleanup_perf_probe_events
> del_perf_probe_events
> clear_perf_probe_event
> clear_probe_trace_event
> 
> But non of them works perfectly for me.
> 
> In bpf_prog_priv__clear() function of 6/27, I copied some code from
> cleanup_perf_probe_events(), because I think when destroying bpf programs,
> the probe_trace_events should also be cleanuped, but we don't need call
> exit_symbol_maps() many times, because we are in 'perf record', and not
> sure whether other parts of perf need symbol maps. Otherwise I think
> directly
> calling cleanup_perf_probe_events() sould be better.
> 
> You can find patch from:
> 
> http://lkml.kernel.org/n/1441523623-152703-6-git-send-email-wangnan0@huawei.com
> 
> http://lkml.kernel.org/n/1441523623-152703-7-git-send-email-wangnan0@huawei.com
> 
> Thank you.
> 
> On 2015/9/4 20:15, Namhyung Kim wrote:
> >The add_perf_probe_events() does 3 things:
> >
> >  1. convert all perf events to trace events
> >  2. add all trace events to kernel
> >  3. cleanup all trace events
> >
> >But sometimes we need to do something with the trace events.  So split
> >the funtion into three, so that it can access intermediate trace events
> >via struct __event_package if needed.
> >
> >Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> >Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> >---
> >  tools/perf/util/probe-event.c | 39 +++++++++++++++++++++++++++++++++++----
> >  1 file changed, 35 insertions(+), 4 deletions(-)
> >
> >diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
> >index eb5f18b75402..2c762f41e7a5 100644
> >--- a/tools/perf/util/probe-event.c
> >+++ b/tools/perf/util/probe-event.c
> >@@ -2765,9 +2765,10 @@ struct __event_package {
> >  	int				ntevs;
> >  };
> >-int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> >+static int convert_perf_probe_events(struct perf_probe_event *pevs, int npevs,
> >+				     struct __event_package **ppkgs)
> >  {
> >-	int i, j, ret;
> >+	int i, ret;
> >  	struct __event_package *pkgs;
> >  	ret = 0;
> >@@ -2792,12 +2793,21 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> >  		ret  = convert_to_probe_trace_events(pkgs[i].pev,
> >  						     &pkgs[i].tevs);
> >  		if (ret < 0)
> >-			goto end;
> >+			return ret;
> >  		pkgs[i].ntevs = ret;
> >  	}
> >  	/* This just release blacklist only if allocated */
> >  	kprobe_blacklist__release();
> >+	*ppkgs = pkgs;
> >+
> >+	return 0;
> >+}
> >+
> >+static int apply_perf_probe_events(struct __event_package *pkgs, int npevs)
> >+{
> >+	int i, ret = 0;
> >+
> >  	/* Loop 2: add all events */
> >  	for (i = 0; i < npevs; i++) {
> >  		ret = __add_probe_trace_events(pkgs[i].pev, pkgs[i].tevs,
> >@@ -2806,7 +2816,16 @@ int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> >  		if (ret < 0)
> >  			break;
> >  	}
> >-end:
> >+	return ret;
> >+}
> >+
> >+static void cleanup_perf_probe_events(struct __event_package *pkgs, int npevs)
> >+{
> >+	int i, j;
> >+
> >+	if (pkgs == NULL)
> >+		return;
> >+
> >  	/* Loop 3: cleanup and free trace events  */
> >  	for (i = 0; i < npevs; i++) {
> >  		for (j = 0; j < pkgs[i].ntevs; j++)
> >@@ -2815,6 +2834,18 @@ end:
> >  	}
> >  	free(pkgs);
> >  	exit_symbol_maps();
> >+}
> >+
> >+int add_perf_probe_events(struct perf_probe_event *pevs, int npevs)
> >+{
> >+	int ret;
> >+	struct __event_package *pkgs = NULL;
> >+
> >+	ret = convert_perf_probe_events(pevs, npevs, &pkgs);
> >+	if (ret == 0)
> >+		ret = apply_perf_probe_events(pkgs, npevs);
> >+
> >+	cleanup_perf_probe_events(pkgs, npevs);
> >  	return ret;
> >  }
> 
> 
--
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 v2 1/5] perf probe: Split add_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 14:20 +0200
  [PATCH v2 2/5] perf probe: Attach trace_probe_event with perf_probe_event Namhyung Kim <namhyung@kernel.org> - 2015-09-04 14:20 +0200
    [tip:perf/core] perf probe:   Link trace_probe_event into perf_probe_event tip-bot for Wang Nan <tipbot@zytor.com> - 2015-09-08 16:50 +0200
  [PATCH v2 5/5] perf probe: Print deleted events in cmd_probe() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 14:20 +0200
    RE: [PATCH v2 5/5] perf probe: Print deleted events in cmd_probe() 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-07 03:20 +0200
    [tip:perf/core] perf probe: Print deleted events in cmd_probe() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-09-08 16:50 +0200
  [PATCH v2 4/5] perf probe: Split del_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-04 14:30 +0200
    [tip:perf/core] perf probe: Split del_perf_probe_events() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-09-08 16:50 +0200
  Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() "Wangnan (F)" <wangnan0@huawei.com> - 2015-09-06 09:50 +0200
    Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-08 04:00 +0200
    Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-10 04:30 +0200
      RE: Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-10 07:10 +0200
        Re: Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-10 08:50 +0200
          RE: Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() 平松雅巳 / HIRAMATU,MASAMI   <masami.hiramatsu.pt@hitachi.com> - 2015-09-10 10:20 +0200
            Re: Re: [PATCH v2 1/5] perf probe: Split add_perf_probe_events() Namhyung Kim <namhyung@kernel.org> - 2015-09-11 18:40 +0200
  [tip:perf/core] perf probe: Split add_perf_probe_events() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2015-09-08 16:40 +0200

csiph-web