All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Valdis.Kletnieks@vt.edu,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: 2.6.39-rc6-mmotm0506 - lockdep splat in RCU code on page fault
Date: Tue, 10 May 2011 22:44:43 +0200	[thread overview]
Message-ID: <20110510204443.GF21903@elte.hu> (raw)
In-Reply-To: <20110510162158.GK2258@linux.vnet.ibm.com>


* Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> On Tue, May 10, 2011 at 10:57:46AM +0200, Ingo Molnar wrote:
> > 
> > * Paul E. McKenney <paulmck@linux.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)?

Thanks,

	Ingo

WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@elte.hu>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Valdis.Kletnieks@vt.edu,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: 2.6.39-rc6-mmotm0506 - lockdep splat in RCU code on page fault
Date: Tue, 10 May 2011 22:44:43 +0200	[thread overview]
Message-ID: <20110510204443.GF21903@elte.hu> (raw)
In-Reply-To: <20110510162158.GK2258@linux.vnet.ibm.com>


* Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:

> On Tue, May 10, 2011 at 10:57:46AM +0200, Ingo Molnar wrote:
> > 
> > * Paul E. McKenney <paulmck@linux.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)?

Thanks,

	Ingo

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-05-10 20:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-10  1:04 2.6.39-rc6-mmotm0506 - lockdep splat in RCU code on page fault Valdis.Kletnieks
2011-05-10  8:20 ` Paul E. McKenney
2011-05-10  8:20   ` Paul E. McKenney
2011-05-10  8:57   ` Ingo Molnar
2011-05-10  8:57     ` Ingo Molnar
2011-05-10 16:21     ` Paul E. McKenney
2011-05-10 16:21       ` Paul E. McKenney
2011-05-10 20:44       ` Ingo Molnar [this message]
2011-05-10 20:44         ` Ingo Molnar
2011-05-11  7:44         ` Paul E. McKenney
2011-05-11  7:44           ` Paul E. McKenney
2011-05-11 23:11   ` Valdis.Kletnieks
2011-05-12  9:47     ` Paul E. McKenney
2011-05-12  9:47       ` Paul E. McKenney
2011-05-12 16:05       ` Valdis.Kletnieks
2011-05-13  7:18         ` Paul E. McKenney
2011-05-13  7:18           ` Paul E. McKenney

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=20110510204443.GF21903@elte.hu \
    --to=mingo@elte.hu \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.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.