[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110511074403.GW2258@linux.vnet.ibm.com>
Date: Wed, 11 May 2011 00:44:03 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Ingo Molnar <mingo@...e.hu>
Cc: Valdis.Kletnieks@...edu, Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: 2.6.39-rc6-mmotm0506 - lockdep splat in RCU code on page fault
On Tue, May 10, 2011 at 10:44:43PM +0200, Ingo Molnar wrote:
>
> * Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
>
> > On Tue, May 10, 2011 at 10:57:46AM +0200, Ingo Molnar wrote:
> > >
> > > * Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
> > >
> > > > - raw_spin_lock_irqsave(&rnp->lock, flags);
> > > > - rnp->wakemask |= rdp->grpmask;
> > > > - raw_spin_unlock_irqrestore(&rnp->lock, flags);
> > > > + do {
> > > > + old = rnp->wakemask;
> > > > + new = old | rdp->grpmask;
> > > > + } while (cmpxchg(&rnp->wakemask, old, new) != old);
> > >
> > > Hm, isnt this an inferior version of atomic_or_long() in essence?
> > >
> > > Note that atomic_or_long() is x86 only, so a generic one would have to be
> > > offered too i suspect, atomic_cmpxchg() driven or so - which would look like
> > > the above loop.
> > >
> > > Most architectures could offer atomic_or_long() i suspect.
> >
> > Is the following what you had in mind? This (untested) patch provides only
> > the generic function: if this is what you had in mind, I can put together
> > optimized versions for a couple of the architectures.
>
> Yeah, something like this, except:
>
> > +#ifndef CONFIG_ARCH_HAS_ATOMIC_OR_LONG
> > +static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
> > +{
> > + unsigned long old;
> > + unsigned long new;
> > +
> > + do {
> > + old = ACCESS_ONCE(*v1);
> > + new = old | v2;
> > + } while (cmpxchg(v1, old, new) != old);
> > +}
> > +#endif /* #ifndef CONFIG_ARCH_HAS_ATOMIC_OR_LONG */
>
> Shouldnt that method work on atomic_t (or atomic64_t)?
Works for me -- and in this case it is quite easy to change existing uses.
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists