All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: jolsa@redhat.com
Cc: mingo@elte.hu, rostedt@goodmis.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2] tracing - support multiple pids in set_pid_ftrace file
Date: Wed, 16 Sep 2009 09:00:23 +0800	[thread overview]
Message-ID: <4AB038A7.2070108@cn.fujitsu.com> (raw)
In-Reply-To: <1253019893-30131-1-git-send-email-jolsa@redhat.com>

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>

a few nitpicks.

>  /* set when tracing only a pid */

This comment should be removed too.

> -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?

> +
> +	ret = -ENOMEM;

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

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 13:04 [PATCHv2] tracing - support multiple pids in set_pid_ftrace file jolsa
2009-09-15 14:46 ` Steven Rostedt
2009-09-16  1:00 ` Li Zefan [this message]
2009-09-16  1:33   ` Steven Rostedt
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=4AB038A7.2070108@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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.