lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 6 Oct 2015 10:46:31 -0700
From:	Josh Triplett <josh@...htriplett.org>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...nel.org,
	jiangshanlai@...il.com, dipankar@...ibm.com,
	akpm@...ux-foundation.org, mathieu.desnoyers@...icios.com,
	tglx@...utronix.de, peterz@...radead.org, rostedt@...dmis.org,
	dhowells@...hat.com, edumazet@...gle.com, dvhart@...ux.intel.com,
	fweisbec@...il.com, oleg@...hat.com, bobby.prani@...il.com,
	Boqun Feng <boqun.feng@...il.com>
Subject: Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for
 Tiny and Tree RCU readers

On Tue, Oct 06, 2015 at 10:42:04AM -0700, Paul E. McKenney wrote:
> On Tue, Oct 06, 2015 at 10:16:30AM -0700, Josh Triplett wrote:
> > On Tue, Oct 06, 2015 at 10:01:01AM -0700, Paul E. McKenney wrote:
> > > On Tue, Oct 06, 2015 at 09:44:45AM -0700, Josh Triplett wrote:
> > > > On Tue, Oct 06, 2015 at 09:13:39AM -0700, Paul E. McKenney wrote:
> > > > > From: Boqun Feng <boqun.feng@...il.com>
> > > > > 
> > > > > Because preempt_disable() maps to barrier() for non-debug builds,
> > > > > it forces the compiler to spill and reload registers.  Because Tree
> > > > > RCU and Tiny RCU now only appear in CONFIG_PREEMPT=n builds, these
> > > > > barrier() instances generate needless extra code for each instance of
> > > > > rcu_read_lock() and rcu_read_unlock().  This extra code slows down Tree
> > > > > RCU and bloats Tiny RCU.
> > > > > 
> > > > > This commit therefore removes the preempt_disable() and preempt_enable()
> > > > > from the non-preemptible implementations of __rcu_read_lock() and
> > > > > __rcu_read_unlock(), respectively.  However, for debug purposes,
> > > > > preempt_disable() and preempt_enable() are still invoked if
> > > > > CONFIG_PREEMPT_COUNT=y, because this allows detection of sleeping inside
> > > > > atomic sections in non-preemptible kernels.
> > > > > 
> > > > > This is based on an earlier patch by Paul E. McKenney, fixing
> > > > > a bug encountered in kernels built with CONFIG_PREEMPT=n and
> > > > > CONFIG_PREEMPT_COUNT=y.
> > > > 
> > > > This also adds explicit barrier() calls to several internal RCU
> > > > functions, but the commit message doesn't explain those at all.
> > > 
> > > To compensate for them being removed from rcu_read_lock() and
> > > rcu_read_unlock(), but yes, I will update.
> > 
> > That much seemed clear from the comments, but that doesn't explain *why*
> > those functions need barriers of their own even though rcu_read_lock()
> > and rcu_read_unlock() don't.
> 
> Ah.  The reason is that Tiny RCU and Tree RCU (the !PREEMPT ones) act
> by implicitly extending (and, if need be, merging) the RCU read-side
> critical sections to include all the code between successive quiescent
> states, for example, all the code between a pair of calls to schedule().
> 
> Therefore, there need to be barrier() calls in the quiescent-state
> functions.  Some could be argued to be implicitly present due to
> translation-unit boundaries, but paranoia and all that.
> 
> Would adding that sort of explanation help?

Yes, it would.
--
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