From: Dave Hansen <dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: Frederic Weisbecker
<fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Steven Rostedt <rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>,
Steven Rostedt <srostedt-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Dipankar Sarma <dipankar-xthvdsQ13ZrQT0dZR+AlfA@public.gmane.org>,
containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org,
Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org>,
Sukadev Bhattiprolu
<sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Andrew Morton
<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH 2/3] ftrace: use struct pid
Date: Thu, 04 Dec 2008 07:41:31 -0800 [thread overview]
Message-ID: <1228405291.13111.86.camel@nimitz> (raw)
In-Reply-To: <m1prk8t5xr.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
On Thu, 2008-12-04 at 05:40 -0800, Eric W. Biederman wrote:
> Dave Hansen <dave-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> writes:
> > On Thu, 2008-12-04 at 04:56 -0800, Dave Hansen wrote:
> >> On Thu, 2008-12-04 at 04:42 -0800, Eric W. Biederman wrote:
> >> >
> >> > > +static void clear_ftrace_pid_task(struct pid **pid)
> >> > > +{
> >> > > + struct task_struct *p;
> >> > > +
> >> > rcu_read_lock();
> >> >
> >> > > + do_each_pid_task(*pid, PIDTYPE_PID, p) {
> >> > > + clear_tsk_trace_trace(p);
> >> > > + } while_each_pid_task(*pid, PIDTYPE_PID, p);
> >> > rcu_read_unlock()
> >> >
> >> > > + put_pid(*pid);
> >> > > +
> >> > > + *pid = NULL;
> >> > > +}
> >>
> >> Could we get away with sticking the rcu_read_{un}lock() inside
> those
> >> macros? Those are going to get used in pretty high level code and
> we're
> >> allowed to nest rcu_read_lock(). No danger of deadlocks or lock
> >> inversions.
> >
> > Why don't any of the other users of do_each_pid_task() use
> > rcu_read_lock()? They all seem to be under
> read_lock(&tasklist_lock)
> > (except one is under a write lock of the same).
>
> We probably should. Historically read_lock(&tasklist_lock) implies
> rcu_read_lock(). And the tasklist lock is what we hold when it is
> safe.
So, Dipankar tells me that you really do need rcu_read_lock/unlock() for
the guarantee here; the tasklist lock is not sufficient. The realtime
kernel will preempt even those sections covered by spinlocks.
-- Dave
WARNING: multiple messages have this Message-ID (diff)
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>,
linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Steven Rostedt <srostedt@redhat.com>,
containers@lists.osdl.org, Ingo Molnar <mingo@elte.hu>,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Dipankar Sarma <dipankar@in.ibm.com>
Subject: Re: [PATCH 2/3] ftrace: use struct pid
Date: Thu, 04 Dec 2008 07:41:31 -0800 [thread overview]
Message-ID: <1228405291.13111.86.camel@nimitz> (raw)
In-Reply-To: <m1prk8t5xr.fsf@frodo.ebiederm.org>
On Thu, 2008-12-04 at 05:40 -0800, Eric W. Biederman wrote:
> Dave Hansen <dave@linux.vnet.ibm.com> writes:
> > On Thu, 2008-12-04 at 04:56 -0800, Dave Hansen wrote:
> >> On Thu, 2008-12-04 at 04:42 -0800, Eric W. Biederman wrote:
> >> >
> >> > > +static void clear_ftrace_pid_task(struct pid **pid)
> >> > > +{
> >> > > + struct task_struct *p;
> >> > > +
> >> > rcu_read_lock();
> >> >
> >> > > + do_each_pid_task(*pid, PIDTYPE_PID, p) {
> >> > > + clear_tsk_trace_trace(p);
> >> > > + } while_each_pid_task(*pid, PIDTYPE_PID, p);
> >> > rcu_read_unlock()
> >> >
> >> > > + put_pid(*pid);
> >> > > +
> >> > > + *pid = NULL;
> >> > > +}
> >>
> >> Could we get away with sticking the rcu_read_{un}lock() inside
> those
> >> macros? Those are going to get used in pretty high level code and
> we're
> >> allowed to nest rcu_read_lock(). No danger of deadlocks or lock
> >> inversions.
> >
> > Why don't any of the other users of do_each_pid_task() use
> > rcu_read_lock()? They all seem to be under
> read_lock(&tasklist_lock)
> > (except one is under a write lock of the same).
>
> We probably should. Historically read_lock(&tasklist_lock) implies
> rcu_read_lock(). And the tasklist lock is what we hold when it is
> safe.
So, Dipankar tells me that you really do need rcu_read_lock/unlock() for
the guarantee here; the tasklist lock is not sufficient. The realtime
kernel will preempt even those sections covered by spinlocks.
-- Dave
next prev parent reply other threads:[~2008-12-04 15:41 UTC|newest]
Thread overview: 52+ 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
[not found] ` <m1prk8t5xr.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-12-04 15:41 ` Dave Hansen [this message]
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
[not found] ` <20081204052735.362609481-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org>
2008-12-04 5:34 ` Wang Liming
2008-12-04 5:34 ` Wang Liming
[not found] ` <49376BFE.2010501-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2008-12-04 5:50 ` Wang Liming
2008-12-04 5:50 ` Wang Liming
2008-12-04 12:54 ` Eric W. Biederman
2008-12-04 12:54 ` Eric W. Biederman
2008-12-04 14:57 ` Steven Rostedt
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
[not found] ` <m1vdtzr4zn.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-12-04 21:56 ` Steven Rostedt
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
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:30 ` Ingo Molnar
2008-12-04 8:34 ` [PATCH] tracing: fix typo and missing inline function Ingo Molnar
2008-12-04 8:34 ` 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=1228405291.13111.86.camel@nimitz \
--to=dave-23vcf4htsmix0ybbhkvfkdbpr1lh4cv8@public.gmane.org \
--cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=containers-qjLDD68F18O7TbgM5vRIOg@public.gmane.org \
--cc=dipankar-xthvdsQ13ZrQT0dZR+AlfA@public.gmane.org \
--cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
--cc=fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-X9Un+BFzKDI@public.gmane.org \
--cc=rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org \
--cc=srostedt-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=sukadev-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.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.