public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	containers@lists.osdl.org,
	Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
	"Serge E. Hallyn" <serue@us.ibm.com>,
	Steven Rostedt <srostedt@redhat.com>
Subject: Re: [PATCH 3/3] ftrace: add ability to only trace swapper tasks
Date: Thu, 04 Dec 2008 05:52:06 -0800	[thread overview]
Message-ID: <m1ljuwt5dl.fsf@frodo.ebiederm.org> (raw)
In-Reply-To: <alpine.DEB.1.10.0812040803340.5240@gandalf.stny.rr.com> (Steven Rostedt's message of "Thu, 4 Dec 2008 08:12:27 -0500 (EST)")

Steven Rostedt <rostedt@goodmis.org> writes:

> On Thu, 4 Dec 2008, Andrew Morton wrote:
>
>> On Thu, 04 Dec 2008 00:26:41 -0500 Steven Rostedt <rostedt@goodmis.org> wrote:
>> 
>> > From: Steven Rostedt <srostedt@redhat.com>
>> > 
>> > Impact: New feature
>> > 
>> > This patch lets the swapper tasks of all CPUS be filtered by the
>> > set_ftrace_pid file.
>> 
>> "filtered" is one of those nasty words.  It is unclear whether the
>> filteree is included or excluded.
>> 
>> > If '0' is echoed into this file, then all the idle tasks (aka swapper)
>> > is flagged to be traced.  This affects all CPU idle tasks.
>> > 
>> 
>> s/is/are/
>
> My English is much better before midnight.
> But warning, it is worse before my first coffee. ;-)
>
>> 
>> > Signed-off-by: Steven Rostedt <srostedt@redhat.com>
>> 
>> What does this patch actually do?  Is swapper currently excluded from
>> tracing for undisclosed reasons and this patch permits it to be traced?
>> If so, why was swapper thus excluded?  Or am I totally off track?
>
> Yes, it is excluded. For two reasons:
>
> 1) you can not get to the swapper task using struct pid
> 2) the swapper task is not part of the task link list. Well, the first
>   swapper task may be, but not the ones for other CPUS.
>
> In fork.c:
>
> 	if (likely(p->pid)) {
> 		[...]
> 		if (thread_group_leader(p)) {
> 			[...]
> 			list_add_tail_rcu(&p->tasks, &init_task.tasks);
>
>
>

>> > ---
>> > kernel/trace/ftrace.c | 74 +++++++++++++++++++++++++++++++++++++++++-------
>> >  1 files changed, 63 insertions(+), 11 deletions(-)
>> > 
>> > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
>> > index 10b1d7c..eb57dc1 100644
>> > --- a/kernel/trace/ftrace.c
>> > +++ b/kernel/trace/ftrace.c
>> > @@ -49,6 +49,7 @@ static int last_ftrace_enabled;
>> >  
>> >  /* set when tracing only a pid */
>> >  struct pid *ftrace_pid_trace;
>> > +static struct pid * const ftrace_swapper_pid = (struct pid *)1;
>> 
>> eh?
>
> The swapper task has no pid structure
It does have a pid structure it just isn't hashed.

>, if we want to trace it, we
> need to find it outside the pid code. But other parts of ftrace use the
> ftrace_pid_trace to see if it it should only trace the tasks that have
> the trace bit set. We have:
>
> 	if (ftrace_pid_trace)
> 		/* only trace this task if it is marked to trace */
>
> But, I get your point. That line deserves a comment ;-)

>> What locking does this traversal need, and does this function have it?
>
> No idea, I only did what Eric suggested.

Sorry I'm tired going fast and was just sketching the highlights.

> And people wonder why we still stick to "task->pid"

Hey thanks for trying to figure it out.

Eric


  reply	other threads:[~2008-12-04 13:56 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-04  5:26 [PATCH 0/3] ftrace: clean ups for tip Steven Rostedt
2008-12-04  5:26 ` [PATCH 1/3] fix the do_each_pid_task macro Steven Rostedt
2008-12-04  5:26 ` [PATCH 2/3] ftrace: use struct pid Steven Rostedt
2008-12-04 12:42   ` Eric W. Biederman
2008-12-04 12:56     ` Dave Hansen
2008-12-04 13:07       ` Dave Hansen
2008-12-04 13:40         ` Eric W. Biederman
2008-12-04 15:12           ` Dave Hansen
2008-12-04 15:35             ` Steven Rostedt
2008-12-04 15:41           ` Dave Hansen
2008-12-04 15:44             ` Steven Rostedt
2008-12-04 14:29         ` Steven Rostedt
2008-12-05  3:17         ` Dipankar Sarma
2008-12-04 12:55   ` Eric W. Biederman
2008-12-04 14:23     ` Steven Rostedt
2008-12-04 14:32       ` Eric W. Biederman
2008-12-04 16:22         ` Sukadev Bhattiprolu
2008-12-04  5:26 ` [PATCH 3/3] ftrace: add ability to only trace swapper tasks Steven Rostedt
2008-12-04  5:34   ` Wang Liming
2008-12-04  5:50     ` Wang Liming
2008-12-04  8:06   ` Ingo Molnar
2008-12-04  8:18   ` Andrew Morton
2008-12-04  9:10     ` Ingo Molnar
2008-12-04 12:59       ` Eric W. Biederman
2008-12-04 14:46         ` Steven Rostedt
2008-12-04 20:41           ` Eric W. Biederman
2008-12-04 20:57             ` Steven Rostedt
2008-12-04 21:43               ` Eric W. Biederman
2008-12-04 21:56                 ` Steven Rostedt
2008-12-05  7:43                   ` Eric W. Biederman
2008-12-05 12:23                     ` Steven Rostedt
2008-12-05 16:35                       ` Eric W. Biederman
2008-12-05  4:30                 ` [PATCH] ftrace: use init_struct_pid as swapper pid Steven Rostedt
2008-12-05 13:51                   ` Ingo Molnar
2008-12-04 15:36         ` [PATCH 3/3] ftrace: add ability to only trace swapper tasks Ingo Molnar
2008-12-04 15:47           ` Steven Rostedt
2008-12-04 13:12     ` Steven Rostedt
2008-12-04 13:52       ` Eric W. Biederman [this message]
2008-12-04 12:54   ` Eric W. Biederman
2008-12-04 14:57     ` Steven Rostedt
2008-12-04  8:10 ` [PATCH 0/3] ftrace: clean ups for tip Ingo Molnar
2008-12-04  8:30   ` [PATCH] tracing: fix typo Ingo Molnar
2008-12-04  8:34     ` [PATCH] tracing: fix typo and missing inline function Ingo Molnar
2008-12-04 13:16       ` Steven Rostedt
2008-12-04 15:35         ` Ingo Molnar

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=m1ljuwt5dl.fsf@frodo.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=containers@lists.osdl.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=serue@us.ibm.com \
    --cc=srostedt@redhat.com \
    --cc=sukadev@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