All of lore.kernel.org
 help / color / mirror / Atom feed
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Anton Arapov <anton@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/6] uprobes/tracing: Introduce is_ret_probe() and uretprobe_dispatcher()
Date: Sun, 7 Apr 2013 19:42:50 +0530	[thread overview]
Message-ID: <20130407141250.GB8672@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130401160848.GA19573@redhat.com>

* Oleg Nesterov <oleg@redhat.com> [2013-04-01 18:08:48]:

> Create the new functions we need to support uretprobes, and change
> alloc_trace_uprobe() to initialize consumer.ret_handler if the new
> "is_ret" argument is true. Curently this argument is always false,
> so the new code is never called and is_ret_probe(tu) is false too.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>

> ---
>  kernel/trace/trace_uprobe.c |   42 ++++++++++++++++++++++++++++++++++++++++--
>  1 files changed, 40 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c
> index 2ea9961..e91a354 100644
> --- a/kernel/trace/trace_uprobe.c
> +++ b/kernel/trace/trace_uprobe.c
> @@ -75,6 +75,8 @@ static DEFINE_MUTEX(uprobe_lock);
>  static LIST_HEAD(uprobe_list);
> 
>  static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs);
> +static int uretprobe_dispatcher(struct uprobe_consumer *con,
> +				unsigned long func, struct pt_regs *regs);
> 
>  static inline void init_trace_uprobe_filter(struct trace_uprobe_filter *filter)
>  {
> @@ -88,11 +90,16 @@ static inline bool uprobe_filter_is_empty(struct trace_uprobe_filter *filter)
>  	return !filter->nr_systemwide && list_empty(&filter->perf_events);
>  }
> 
> +static inline bool is_ret_probe(struct trace_uprobe *tu)
> +{
> +	return tu->consumer.ret_handler != NULL;
> +}
> +
>  /*
>   * Allocate new trace_uprobe and initialize it (including uprobes).
>   */
>  static struct trace_uprobe *
> -alloc_trace_uprobe(const char *group, const char *event, int nargs)
> +alloc_trace_uprobe(const char *group, const char *event, int nargs, bool is_ret)
>  {
>  	struct trace_uprobe *tu;
> 
> @@ -117,6 +124,8 @@ alloc_trace_uprobe(const char *group, const char *event, int nargs)
> 
>  	INIT_LIST_HEAD(&tu->list);
>  	tu->consumer.handler = uprobe_dispatcher;
> +	if (is_ret)
> +		tu->consumer.ret_handler = uretprobe_dispatcher;
>  	init_trace_uprobe_filter(&tu->filter);
>  	return tu;
> 
> @@ -314,7 +323,7 @@ static int create_trace_uprobe(int argc, char **argv)
>  		kfree(tail);
>  	}
> 
> -	tu = alloc_trace_uprobe(group, event, argc);
> +	tu = alloc_trace_uprobe(group, event, argc, false);
>  	if (IS_ERR(tu)) {
>  		pr_info("Failed to allocate trace_uprobe.(%d)\n", (int)PTR_ERR(tu));
>  		ret = PTR_ERR(tu);
> @@ -529,6 +538,12 @@ static int uprobe_trace_func(struct trace_uprobe *tu, struct pt_regs *regs)
>  	return 0;
>  }
> 
> +static void uretprobe_trace_func(struct trace_uprobe *tu, unsigned long func,
> +				struct pt_regs *regs)
> +{
> +	uprobe_trace_print(tu, func, regs);
> +}
> +
>  /* Event entry printers */
>  static enum print_line_t
>  print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *event)
> @@ -799,6 +814,12 @@ static int uprobe_perf_func(struct trace_uprobe *tu, struct pt_regs *regs)
>  	uprobe_perf_print(tu, 0, regs);
>  	return 0;
>  }
> +
> +static void uretprobe_perf_func(struct trace_uprobe *tu, unsigned long func,
> +				struct pt_regs *regs)
> +{
> +	uprobe_perf_print(tu, func, regs);
> +}
>  #endif	/* CONFIG_PERF_EVENTS */
> 
>  static
> @@ -853,6 +874,23 @@ static int uprobe_dispatcher(struct uprobe_consumer *con, struct pt_regs *regs)
>  	return ret;
>  }
> 
> +static int uretprobe_dispatcher(struct uprobe_consumer *con,
> +				unsigned long func, struct pt_regs *regs)
> +{
> +	struct trace_uprobe *tu;
> +
> +	tu = container_of(con, struct trace_uprobe, consumer);
> +
> +	if (tu->flags & TP_FLAG_TRACE)
> +		uretprobe_trace_func(tu, func, regs);
> +
> +#ifdef CONFIG_PERF_EVENTS
> +	if (tu->flags & TP_FLAG_PROFILE)
> +		uretprobe_perf_func(tu, func, regs);
> +#endif
> +	return 0;
> +}
> +
>  static struct trace_event_functions uprobe_funcs = {
>  	.trace		= print_uprobe_event
>  };
> -- 
> 1.5.5.1
> 

-- 
Thanks and Regards
Srikar Dronamraju


  reply	other threads:[~2013-04-07 14:18 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-29 18:15 [PATCH 0/4] uprobes/tracing: uretprobes, initial preparations Oleg Nesterov
2013-03-29 18:15 ` [PATCH 1/4] uprobes/tracing: Kill the pointless task_pt_regs() calls Oleg Nesterov
2013-04-02  8:57   ` Anton Arapov
2013-04-04 14:24   ` Srikar Dronamraju
2013-03-29 18:15 ` [PATCH 2/4] uprobes/tracing: Kill the pointless seq_print_ip_sym() call Oleg Nesterov
2013-04-02  8:57   ` Anton Arapov
2013-04-04 14:24   ` Srikar Dronamraju
2013-03-29 18:15 ` [PATCH 3/4] uprobes/tracing: Kill the pointless local_save_flags/preempt_count calls Oleg Nesterov
2013-04-02  8:58   ` Anton Arapov
2013-04-04 14:25   ` Srikar Dronamraju
2013-04-05  3:47     ` Masami Hiramatsu
2013-04-05 15:01       ` Oleg Nesterov
2013-04-08  9:29         ` Masami Hiramatsu
2013-04-10 14:58           ` [PATCH 0/1] uprobes/tracing: Don't pass addr=ip to perf_trace_buf_submit() Oleg Nesterov
2013-04-10 14:58             ` [PATCH 1/1] " Oleg Nesterov
2013-04-11 10:19               ` Masami Hiramatsu
2013-04-13  9:28               ` Srikar Dronamraju
2013-04-11 10:38             ` [PATCH 0/1] " Masami Hiramatsu
2013-04-11 11:59               ` Oleg Nesterov
2013-04-12 18:01                 ` Steven Rostedt
2013-04-12 21:19                 ` Steven Rostedt
2013-04-13 14:02                   ` [PATCH 0/1] uprobes/perf: Avoid perf_trace_buf_prepare/submit if ->perf_events is empty Oleg Nesterov
2013-04-13 14:02                     ` [PATCH 1/1] " Oleg Nesterov
2013-04-13 18:22                     ` [PATCH 0/1] " Oleg Nesterov
2013-04-08 15:58   ` [PATCH 3/4] uprobes/tracing: Kill the pointless local_save_flags/preempt_count calls Steven Rostedt
2013-04-09 14:58     ` Oleg Nesterov
2013-04-09 15:12       ` Steven Rostedt
2013-03-29 18:15 ` [PATCH 4/4] uprobes/tracing: generalize struct uprobe_trace_entry_head Oleg Nesterov
2013-04-02  8:59   ` Anton Arapov
2013-04-04 14:25   ` Srikar Dronamraju
2013-04-08 15:55   ` Steven Rostedt
2013-04-09 14:50     ` Oleg Nesterov
2013-04-09 15:07       ` Steven Rostedt
2013-04-09 19:32         ` [PATCH v2 0/7] uprobes/tracing: uretprobes Oleg Nesterov
2013-04-09 19:32           ` [PATCH v2 1/7] uprobes/tracing: Generalize struct uprobe_trace_entry_head Oleg Nesterov
2013-04-09 19:32           ` [PATCH v2 2/7] uprobes/tracing: Introduce uprobe_{trace,perf}_print() helpers Oleg Nesterov
2013-04-09 19:32           ` [PATCH v2 3/7] uprobes/tracing: Introduce is_ret_probe() and uretprobe_dispatcher() Oleg Nesterov
2013-04-09 19:32           ` [PATCH v2 4/7] uprobes/tracing: Make uprobe_{trace,perf}_print() uretprobe-friendly Oleg Nesterov
2013-04-13  9:33             ` Srikar Dronamraju
2013-04-09 19:32           ` [PATCH v2 5/7] uprobes/tracing: Make register_uprobe_event() paths uretprobe-friendly Oleg Nesterov
2013-04-09 19:32           ` [PATCH v2 6/7] uprobes/tracing: Make seq_printf() code uretprobe-friendly Oleg Nesterov
2013-04-09 19:32           ` [PATCH v2 7/7] uprobes/tracing: Change create_trace_uprobe() to support uretprobes Oleg Nesterov
2013-04-01 16:08 ` [PATCH 0/6] uprobes/tracing: uretprobes Oleg Nesterov
2013-04-01 16:08   ` [PATCH 1/6] uprobes/tracing: Introduce uprobe_{trace,perf}_print() helpers Oleg Nesterov
2013-04-07 13:58     ` Srikar Dronamraju
2013-04-01 16:08   ` [PATCH 2/6] uprobes/tracing: Introduce is_ret_probe() and uretprobe_dispatcher() Oleg Nesterov
2013-04-07 14:12     ` Srikar Dronamraju [this message]
2013-04-01 16:08   ` [PATCH 3/6] uprobes/tracing: Make uprobe_{trace,perf}_print() uretprobe-friendly Oleg Nesterov
2013-04-07 10:31     ` Srikar Dronamraju
2013-04-09 13:33       ` Oleg Nesterov
2013-04-13  9:31         ` Srikar Dronamraju
2013-04-08 17:08     ` Steven Rostedt
2013-04-01 16:08   ` [PATCH 4/6] uprobes/tracing: Make register_uprobe_event() paths uretprobe-friendly Oleg Nesterov
2013-04-07 14:14     ` Srikar Dronamraju
2013-04-01 16:08   ` [PATCH 5/6] uprobes/tracing: Make seq_printf() code uretprobe-friendly Oleg Nesterov
2013-04-07 14:15     ` Srikar Dronamraju
2013-04-01 16:09   ` [PATCH 6/6] uprobes/tracing: Change create_trace_uprobe() to support uretprobes Oleg Nesterov
2013-04-07 14:17     ` Srikar Dronamraju
2013-04-02 13:25   ` [PATCH 0/6] uprobes/tracing: uretprobes Anton Arapov

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=20130407141250.GB8672@linux.vnet.ibm.com \
    --to=srikar@linux.vnet.ibm.com \
    --cc=ananth@in.ibm.com \
    --cc=anton@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.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.