linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nick Piggin <nickpiggin@yahoo.com.au>
Subject: Re: [RFC][PATCH 2/6] lockdep: validate rcu_dereference() vs rcu_read_lock()
Date: Wed, 19 Sep 2007 10:48:57 -0700	[thread overview]
Message-ID: <20070919174857.GA11922@linux.vnet.ibm.com> (raw)
In-Reply-To: <20070919173249.GE8666@linux.vnet.ibm.com>

On Wed, Sep 19, 2007 at 10:32:49AM -0700, Paul E. McKenney wrote:
> On Wed, Sep 19, 2007 at 12:59:10PM -0400, Dmitry Torokhov wrote:
> > On 9/19/07, Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
> > > On Wed, Sep 19, 2007 at 11:16:21AM -0400, Dmitry Torokhov wrote:
> > > > On 9/19/07, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > > > > On Wed, 19 Sep 2007 10:17:25 -0400 "Dmitry Torokhov"
> > > > > <dmitry.torokhov@gmail.com> wrote:
> > > > >
> > > > > > Hi Peter,
> > > > > >
> > > > > > On 9/19/07, Peter Zijlstra <a.p.zijlstra@chello.nl> wrote:
> > > > > > > Warn when rcu_dereference() is not used in combination with rcu_read_lock()
> > > > > > >
> > > > > >
> > > > > > According to Paul it is fine to use RCU primitives (when accompanied
> > > > > > with proper comments) when the read-size critical section is guarded
> > > > > > by spin_lock_irqsave()/spin_lock_irqsrestore() instead of
> > > > > > rcu_read_lock()/rcu_read_unlock() and writers synchronize with
> > > > > > synchronize_sched(), not synchronize_rcu(). Your patch will trigger
> > > > > > warnign on such valid usages.
> > > > > >
> > > > >
> > > > > Sounds fragile to begin with. But you're right in that that is valid
> > > > > for Linux as you know it. However in -rt most/all spinlocks are
> > > > > converted to sleeping locks. In that case sync_sched() is not enough.
> > > >
> > > > OK, then it goes beyond RCU... We need to come up with something that
> > > > can be used to synchronize with IRQ handlers (quite often in driver
> > > > code one needs to be sure that current invocation of IRQ handler
> > > > completed before doing something). And once we have it splinlock + RCU
> > > > users can just use that method.
> > >
> > > But Peter's approach would not cause a problem here -- you wouldn't be
> > > doing an rcu_dereference from within the IRQ handler in this case, right?
> > 
> > Yes I do. Along with list_for_each_rcu().
> 
> OK, in that case it does indeed need to be handled.

PS to previous -- any problem with inserting rcu_read_lock() and
rcu_read_unlock() around the portion of the IRQ handler that has
these accesses?

							Thanx, Paul

  reply	other threads:[~2007-09-19 17:49 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19 10:41 [RFC][PATCH 0/6] using lockdep to validate rcu usage Peter Zijlstra
2007-09-19 10:41 ` [RFC][PATCH 1/6] lockdep: annotate rcu_read_{,un}lock{,_bh} Peter Zijlstra
2007-09-19 23:06   ` Paul E. McKenney
2007-09-19 10:41 ` [RFC][PATCH 2/6] lockdep: validate rcu_dereference() vs rcu_read_lock() Peter Zijlstra
2007-09-19 14:17   ` Dmitry Torokhov
2007-09-19 14:31     ` Peter Zijlstra
2007-09-19 15:16       ` Dmitry Torokhov
2007-09-19 15:25         ` Peter Zijlstra
2007-09-19 15:37         ` Paul E. McKenney
2007-09-19 16:59           ` Dmitry Torokhov
2007-09-19 17:32             ` Paul E. McKenney
2007-09-19 17:48               ` Paul E. McKenney [this message]
2007-09-19 18:49                 ` Dmitry Torokhov
2007-09-19 19:41                   ` Peter Zijlstra
2007-09-19 19:49                     ` Dmitry Torokhov
2007-09-19 20:13                       ` Peter Zijlstra
2007-09-19 20:41                         ` Dmitry Torokhov
2007-09-19 21:19                           ` Peter Zijlstra
2007-09-19 21:29                             ` Dmitry Torokhov
2007-09-19 21:47                               ` Peter Zijlstra
2007-09-20 17:31                                 ` Dmitry Torokhov
2007-09-21  0:01                                   ` Paul E. McKenney
2007-09-21 14:15                                     ` Dmitry Torokhov
2007-09-21 14:30                                       ` Peter Zijlstra
2007-09-19 20:48                       ` Paul E. McKenney
2007-09-19 10:41 ` [RFC][PATCH 3/6] lockdep: rcu_dereference() vs preempt_disable() Peter Zijlstra
2007-09-19 10:41 ` [RFC][PATCH 4/6] implicit vs explicit preempt_disable() Peter Zijlstra
2007-09-19 10:41 ` [RFC][PATCH 5/6] fixup funny preemption tricks in irq_exit Peter Zijlstra
2007-09-19 10:41 ` [RFC][PATCH 6/6] fixup early boot Peter Zijlstra
2007-09-19 13:38 ` [RFC][PATCH 0/6] using lockdep to validate rcu usage 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=20070919174857.GA11922@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=nickpiggin@yahoo.com.au \
    /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;
as well as URLs for NNTP newsgroup(s).