All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@infradead.org>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Oleg Nesterov <oleg@redhat.com>, Mark Wielaard <mjw@redhat.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Naren A Devaiah <naren.devaiah@in.ibm.com>,
	Jim Keniston <jkenisto@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"Frank Ch. Eigler" <fche@redhat.com>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCHv10 2.6.35-rc6-tip 11/14]  perf: perf interface for uprobes
Date: Fri, 30 Jul 2010 16:19:03 -0300	[thread overview]
Message-ID: <20100730191903.GD12166@ghostprotocols.net> (raw)
In-Reply-To: <20100727111105.24690.48335.sendpatchset@localhost6.localdomain6>

Em Tue, Jul 27, 2010 at 04:41:05PM +0530, Srikar Dronamraju escreveu:
> 
> Enhances perf probe to accept pid and user vaddr.
> Provides very basic support for uprobes.
> @@ -188,6 +190,8 @@ static const struct option options[] = {
>  	OPT__DRY_RUN(&probe_event_dry_run),
>  	OPT_INTEGER('\0', "max-probes", &params.max_probe_points,
>  		 "Set how many probe points can be found for a probe."),
> +	OPT_INTEGER('p', "pid", &params.upid,
> +			"specify a pid for a uprobes based probe"),

"ubrobes based probe" could be made clear as:

"Specify pid of process where the probe will be added"

?

The following three hunks could be moved to a separate patch that I'd
apply on my perf/core branch, so to reduce this patchset size, like I
did with the s/kprobe/probe/g one that is already there:

http://git.kernel.org/?p=linux/kernel/git/acme/linux-2.6.git;a=commitdiff;h=0e60836bbd392300198c5c2d918c18845428a1fe

> diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
> index 1e8e92e..b513e40 100644
> --- a/tools/perf/builtin-top.c
> +++ b/tools/perf/builtin-top.c
> @@ -1082,26 +1082,6 @@ static void event__process_sample(const event_t *self,
>  	}
>  }
>  
> -static int event__process(event_t *event, struct perf_session *session)
> -{
> -	switch (event->header.type) {
> -	case PERF_RECORD_COMM:
> -		event__process_comm(event, session);
> -		break;
> -	case PERF_RECORD_MMAP:
> -		event__process_mmap(event, session);
> -		break;
> -	case PERF_RECORD_FORK:
> -	case PERF_RECORD_EXIT:
> -		event__process_task(event, session);
> -		break;
> -	default:
> -		break;
> -	}
> -
> -	return 0;
> -}
> -
>  struct mmap_data {
>  	int			counter;
>  	void			*base;
> diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
> index d7f21d7..d93e0bb 100644
> --- a/tools/perf/util/event.c
> +++ b/tools/perf/util/event.c
> @@ -552,6 +552,26 @@ int event__process_task(event_t *self, struct perf_session *session)
>  	return 0;
>  }
>  
> +int event__process(event_t *event, struct perf_session *session)
> +{
> +	switch (event->header.type) {
> +	case PERF_RECORD_COMM:
> +		event__process_comm(event, session);
> +		break;
> +	case PERF_RECORD_MMAP:
> +		event__process_mmap(event, session);
> +		break;
> +	case PERF_RECORD_FORK:
> +	case PERF_RECORD_EXIT:
> +		event__process_task(event, session);
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return 0;
> +}
> +
>  void thread__find_addr_map(struct thread *self,
>  			   struct perf_session *session, u8 cpumode,
>  			   enum map_type type, pid_t pid, u64 addr,
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
> index 887ee63..8e790da 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -154,6 +154,7 @@ int event__process_comm(event_t *self, struct perf_session *session);
>  int event__process_lost(event_t *self, struct perf_session *session);
>  int event__process_mmap(event_t *self, struct perf_session *session);
>  int event__process_task(event_t *self, struct perf_session *session);
> +int event__process(event_t *event, struct perf_session *session);
>  
>  struct addr_location;
>  int event__preprocess_sample(const event_t *self, struct perf_session *session,

[...]

>  			group = pev->group;
> -		else
> +		else if (!pev->upid)
>  			group = PERFPROBE_GROUP;
> +		else {
> +			/*
> +			 * For uprobes based probes create a group
> +			 * probe_<pid>.
> +			 */
> +			snprintf(buf, 64, "%s_%d", PERFPROBE_GROUP, pev->upid);
> +			group = buf;
> +		}
> +
> +		tev->group = strdup(group);

Here you don't check as you do on the next strdups 

> +		if (pev->event)
> +			event = pev->event;
> +		else if (pev->point.function)
> +			event = pev->point.function;
> +		else
> +			event = tev->point.symbol;
>  
>  		/* Get an unused new event name */
>  		ret = get_new_event_name(buf, 64, event,
> @@ -1471,9 +1681,8 @@ static int __add_probe_trace_events(struct perf_probe_event *pev,
>  		if (ret < 0)
>  			break;
>  		event = buf;
> -
>  		tev->event = strdup(event);
> -		tev->group = strdup(group);
> +

here

>  		if (tev->event == NULL || tev->group == NULL) {
>  			ret = -ENOMEM;
>  			break;
> @@ -1571,6 +1780,11 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
>  		}
>  	}
>  
> +	if (pev->upid) {
> +		tev->upid = pev->upid;
> +		return 1;
> +	}
> +
>  	/* Currently just checking function name from symbol map */
>  	sym = map__find_symbol_by_name(machine.vmlinux_maps[MAP__FUNCTION],
>  				       tev->point.symbol, NULL);
> @@ -1598,15 +1812,19 @@ struct __event_package {
>  int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
>  			  bool force_add, int max_tevs)
>  {
> -	int i, j, ret;
> +	int i, j, ret = 0;
>  	struct __event_package *pkgs;
>  
>  	pkgs = zalloc(sizeof(struct __event_package) * npevs);
>  	if (pkgs == NULL)
>  		return -ENOMEM;
>  
> -	/* Init vmlinux path */
> -	ret = init_vmlinux();
> +	if (!pevs->upid)
> +		/* Init vmlinux path */
> +		ret = init_vmlinux();
> +	else
> +		ret = init_perf_uprobes();
> +
>  	if (ret < 0)

pkgs leaks here.

>  		return ret;
>  
> @@ -1666,23 +1884,15 @@ error:
>  	return ret;
>  }

  parent reply	other threads:[~2010-07-30 19:19 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-27 11:08 [PATCHv10 2.6.35-rc6-tip 0/14] Uprobes Patches Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 1/14] mm: Move replace_page() / write_protect_page() to mm/memory.c Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 2/14] uprobes: Breakpoint insertion/removal in user space applications Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 3/14] uprobes: Slot allocation for Execution out of line(XOL) Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 4/14] uprobes: x86 specific functions for user space breakpointing Srikar Dronamraju
2010-07-27 11:09 ` [PATCHv10 2.6.35-rc6-tip 5/14] uprobes: Uprobes (un)registration and exception handling Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 6/14] uprobes: X86 support for Uprobes Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 7/14] uprobes: Uprobes Documentation Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 8/14] trace: Extract out common code for kprobes/uprobes traceevents Srikar Dronamraju
2010-07-27 13:22   ` Masami Hiramatsu
2010-07-27 14:03     ` Srikar Dronamraju
2010-07-28  7:56       ` Masami Hiramatsu
2010-07-29 14:16     ` Srikar Dronamraju
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 9/14] trace: uprobes trace_event interface Srikar Dronamraju
2010-07-29  5:04   ` Masami Hiramatsu
2010-08-02  2:20     ` Frederic Weisbecker
2010-08-02  3:45       ` Masami Hiramatsu
2010-08-02  6:46         ` Srikar Dronamraju
2010-08-02  7:58           ` Frederic Weisbecker
2010-08-02  7:46         ` Frederic Weisbecker
2010-08-02  7:56           ` Ingo Molnar
2010-08-02  8:00             ` Christoph Hellwig
2010-08-02  9:29               ` Masami Hiramatsu
2010-08-02  9:36                 ` Christoph Hellwig
2010-07-29  5:04   ` Masami Hiramatsu
2010-07-29  5:20     ` Srikar Dronamraju
2010-07-29 14:15     ` Srikar Dronamraju
2010-08-02  2:28       ` Frederic Weisbecker
2010-07-27 11:10 ` [PATCHv10 2.6.35-rc6-tip 10/14] perf: rename common fields/functions from kprobe to probe Srikar Dronamraju
2010-07-29 11:51   ` Masami Hiramatsu
2010-07-29 14:13     ` Srikar Dronamraju
2010-07-29 19:42       ` Arnaldo Carvalho de Melo
2010-08-02  7:53       ` [tip:perf/core] perf probe: Rename " tip-bot for Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 11/14] perf: perf interface for uprobes Srikar Dronamraju
2010-07-29 12:01   ` Masami Hiramatsu
2010-07-29 14:11     ` Srikar Dronamraju
2010-07-30 19:19   ` Arnaldo Carvalho de Melo [this message]
2010-07-31  2:57     ` Srikar Dronamraju
2010-07-31 19:30       ` Arnaldo Carvalho de Melo
2010-08-02  1:51         ` Masami Hiramatsu
2010-08-02 12:27     ` Srikar Dronamraju
2010-08-02 14:56       ` Arnaldo Carvalho de Melo
2010-08-02 12:38     ` [PATCH] perf: expose event__process function Srikar Dronamraju
2010-08-05  8:01       ` [tip:perf/core] " tip-bot for Srikar Dronamraju
2010-08-02 12:41     ` [PATCHv10 2.6.35-rc6-tip 11/14] perf: perf interface for uprobes Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 12/14] perf: Add third parameter to symbol_filter_t Srikar Dronamraju
2010-08-05 15:19   ` Arnaldo Carvalho de Melo
2010-08-05 15:20     ` Arnaldo Carvalho de Melo
2010-08-05 15:23     ` Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 13/14] [RFC] perf: Show Potential probe points Srikar Dronamraju
2010-07-27 11:11 ` [PATCHv10 2.6.35-rc6-tip 14/14] [RFC] perf: show functions in a file without using pid Srikar Dronamraju

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100730191903.GD12166@ghostprotocols.net \
    --to=acme@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=fche@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=hch@infradead.org \
    --cc=jkenisto@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@elte.hu \
    --cc=mjw@redhat.com \
    --cc=naren.devaiah@in.ibm.com \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rdunlap@xenotime.net \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.