public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Oleg Nesterov <oleg@redhat.com>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4] tracing/uprobes: Support ftrace_event_file base multibuffer
Date: Tue, 02 Jul 2013 20:26:51 +0900	[thread overview]
Message-ID: <51D2B8FB.6060006@hitachi.com> (raw)
In-Reply-To: <51CE920C.5020001@huawei.com>

A comment I just have is a cosmetic one.

(2013/06/29 16:51), zhangwei(Jovi) wrote:
> @@ -605,33 +629,87 @@ typedef bool (*filter_func_t)(struct uprobe_consumer *self,
>  				struct mm_struct *mm);
> 
>  static int
> -probe_event_enable(struct trace_uprobe *tu, int flag, filter_func_t filter)
> +probe_event_enable(struct trace_uprobe *tu, struct ftrace_event_file *file,
> +		   filter_func_t filter)
>  {
> +	bool enabled = is_trace_uprobe_enabled(tu);
> +	struct event_file_link *link;
>  	int ret = 0;
> 
> -	if (is_trace_uprobe_enabled(tu))
> -		return -EINTR;
> +	if (file) {
> +		if (tu->flags & TP_FLAG_PROFILE)
> +			return -EINTR;
> +
> +		link = kmalloc(sizeof(*link), GFP_KERNEL);
> +		if (!link)
> +			return -ENOMEM;
> +
> +		link->file = file;
> +		list_add_tail_rcu(&link->list, &tu->files);
> +
> +		tu->flags |= TP_FLAG_TRACE;
> +	} else {
> +		if (tu->flags & TP_FLAG_TRACE)
> +			return -EINTR;
> +
> +		tu->flags |= TP_FLAG_PROFILE;
> +	}
> 
>  	WARN_ON(!uprobe_filter_is_empty(&tu->filter));
> 
> -	tu->flags |= flag;
> -	tu->consumer.filter = filter;
> -	ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
> -	if (ret)
> -		tu->flags &= ~flag;
> +	/* we cannot call uprobe_register twice for same tu */
> +	if (!enabled) {
> +		tu->consumer.filter = filter;
> +		ret = uprobe_register(tu->inode, tu->offset, &tu->consumer);
> +	}
> +
> +	if (ret) {

Here, since the ret is only changed by uprobe_register, this block
would better be included in the above block. :)

> +		if (file) {
> +			list_del_rcu(&link->list);
> +			kfree(link);
> +			tu->flags &= ~TP_FLAG_TRACE;
> +		} else
> +			tu->flags &= ~TP_FLAG_PROFILE;
> +	}
> 
>  	return ret;
>  }

Thank you,

-- 
Masami HIRAMATSU
IT Management Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com



      parent reply	other threads:[~2013-07-02 11:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-29  7:51 [PATCH v4] tracing/uprobes: Support ftrace_event_file base multibuffer zhangwei(Jovi)
2013-07-01 19:22 ` Steven Rostedt
2013-07-01 20:27 ` Oleg Nesterov
2013-07-01 21:10   ` Oleg Nesterov
2013-07-02  7:04     ` zhangwei(Jovi)
2013-07-02  6:51   ` zhangwei(Jovi)
2013-07-02 11:26 ` Masami Hiramatsu [this message]

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=51D2B8FB.6060006@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=fweisbec@gmail.com \
    --cc=jovi.zhangwei@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox