mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: jolsa@redhat.com, mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2] tracing - support multiple pids in set_pid_ftrace file
Date: Tue, 15 Sep 2009 21:33:33 -0400	[thread overview]
Message-ID: <1253064813.20020.171.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <4AB038A7.2070108@cn.fujitsu.com>

On Wed, 2009-09-16 at 09:00 +0800, Li Zefan wrote:
> jolsa@redhat.com wrote:
> > Adding the possibility to set more than 1 pid in the set_pid_ftrace file,
> > thus allowing to trace more than 1 independent processes.
> > 
> > Usage:
> > 
> > sh-4.0# echo 284 > ./set_ftrace_pid 
> > sh-4.0# cat ./set_ftrace_pid 
> > 284
> > sh-4.0# echo 1 >> ./set_ftrace_pid 
> > sh-4.0# echo 0 >> ./set_ftrace_pid 
> > sh-4.0# cat ./set_ftrace_pid 
> > swapper tasks
> > 1
> > 284
> > sh-4.0# echo 4 > ./set_ftrace_pid 
> > sh-4.0# cat ./set_ftrace_pid 
> > 4
> > sh-4.0# echo > ./set_ftrace_pid 
> > sh-4.0# cat ./set_ftrace_pid 
> > no pid
> > sh-4.0# 
> > 
> > 
> > wbr,
> > jirka
> > 
> > Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> 
> Looks good.
> 
> Reviewed-by: Li Zefan <lizf@cn.fujitsu.com>

Thanks!

> 
> a few nitpicks.
> 
> >  /* set when tracing only a pid */
> 
> This comment should be removed too.

Yeah, it goes with the deleted pointer below.

> 
> > -struct pid *ftrace_pid_trace;
> >  static struct pid * const ftrace_swapper_pid = &init_struct_pid;
> >  
> ...
> > +static int ftrace_pid_add(int p)
> > +{
> > +	struct pid *pid;
> > +	struct ftrace_pid *fpid;
> > +	int ret = -EINVAL;
> > +
> > +	mutex_lock(&ftrace_lock);
> > +
> > +	if (!p)
> > +		pid = ftrace_swapper_pid;
> > +	else
> > +		pid = find_get_pid(p);
> > +
> > +	if (!pid)
> > +		goto out;
> > +
> > +	list_for_each_entry(fpid, &ftrace_pids, list)
> > +		if (fpid->pid == pid)
> > +			goto out_put;
> 
> rather than returning EINVAL, return EEXIST or just return 0?

I agree, return 0, if it already exists, there's no harm in it returning
success.

-- Steve



  reply	other threads:[~2009-09-16  1:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 13:04 jolsa
2009-09-15 14:46 ` Steven Rostedt
2009-09-16  1:00 ` Li Zefan
2009-09-16  1:33   ` Steven Rostedt [this message]
2009-09-16  8:15     ` Jiri Olsa

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=1253064813.20020.171.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mingo@elte.hu \
    /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

all inboxes | Powered by JetHome®