From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752588AbbILFrB (ORCPT ); Sat, 12 Sep 2015 01:47:01 -0400 Received: from mail-ob0-f171.google.com ([209.85.214.171]:34862 "EHLO mail-ob0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750768AbbILFq7 (ORCPT ); Sat, 12 Sep 2015 01:46:59 -0400 Date: Sat, 12 Sep 2015 13:46:37 +0800 From: Boqun Feng To: "Paul E. McKenney" Cc: Fengguang Wu , LKP , LKML , Frederic Weisbecker Subject: Re: [rcu] kernel BUG at include/linux/pagemap.h:149! Message-ID: <20150912054624.GF1521@fixme-laptop.cn.ibm.com> References: <20150910005708.GA23369@wfg-t540p.sh.intel.com> <20150910102513.GA1677@fixme-laptop.cn.ibm.com> <20150910171649.GE4029@linux.vnet.ibm.com> <20150911021933.GA1521@fixme-laptop.cn.ibm.com> <20150911215937.GH4029@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IvGM3kKqwtniy32b" Content-Disposition: inline In-Reply-To: <20150911215937.GH4029@linux.vnet.ibm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IvGM3kKqwtniy32b Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Sep 11, 2015 at 02:59:37PM -0700, Paul E. McKenney wrote: >=20 > Queued for v4.4, thank you! Please see below for updated commit log, > and please let me know if there are any problems with it. >=20 Looks great to me! Thank you ;-) Regards, Boqun > ------------------------------------------------------------------------ >=20 > rcu: Don't disable preemption for Tiny and Tree RCU readers > =20 > 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=3Dn builds, these > barrier() instances generate needless extra code for each instance of > rcu_read_lock() and rcu_read_unlock(). This extra code slows down Tr= ee > RCU and bloats Tiny RCU. > =20 > This commit therefore removes the preempt_disable() and preempt_enabl= e() > 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=3Dy, because this allows detection of sleeping i= nside > atomic sections in non-preemptible kernels. > =20 > This is based on an earlier patch by Paul E. McKenney, fixing > a bug encountered in kernels built with CONFIG_PREEMPT=3Dn and > CONFIG_PREEMPT_COUNT=3Dy. > =20 > Signed-off-by: Boqun Feng > Signed-off-by: Paul E. McKenney >=20 > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h > index d63bb77dab35..6c3ceceb6148 100644 > --- a/include/linux/rcupdate.h > +++ b/include/linux/rcupdate.h > @@ -297,12 +297,14 @@ void synchronize_rcu(void); > =20 > static inline void __rcu_read_lock(void) > { > - preempt_disable(); > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT)) > + preempt_disable(); > } > =20 > static inline void __rcu_read_unlock(void) > { > - preempt_enable(); > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT)) > + preempt_enable(); > } > =20 > static inline void synchronize_rcu(void) > diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h > index c8a0722f77ea..4c1aaf9cce7b 100644 > --- a/include/linux/rcutiny.h > +++ b/include/linux/rcutiny.h > @@ -216,6 +216,7 @@ static inline bool rcu_is_watching(void) > =20 > static inline void rcu_all_qs(void) > { > + barrier(); /* Avoid RCU read-side critical sections leaking across. */ > } > =20 > #endif /* __LINUX_RCUTINY_H */ > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index ce43fac5ff91..b4882f8b8a9e 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -337,12 +337,14 @@ static void rcu_momentary_dyntick_idle(void) > */ > void rcu_note_context_switch(void) > { > + barrier(); /* Avoid RCU read-side critical sections leaking down. */ > trace_rcu_utilization(TPS("Start context switch")); > rcu_sched_qs(); > rcu_preempt_note_context_switch(); > if (unlikely(raw_cpu_read(rcu_sched_qs_mask))) > rcu_momentary_dyntick_idle(); > trace_rcu_utilization(TPS("End context switch")); > + barrier(); /* Avoid RCU read-side critical sections leaking up. */ > } > EXPORT_SYMBOL_GPL(rcu_note_context_switch); > =20 > @@ -353,12 +355,19 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch); > * RCU flavors in desperate need of a quiescent state, which will normal= ly > * be none of them). Either way, do a lightweight quiescent state for > * all RCU flavors. > + * > + * The barrier() calls are redundant in the common case when this is > + * called externally, but just in case this is called from within this > + * file. > + * > */ > void rcu_all_qs(void) > { > + barrier(); /* Avoid RCU read-side critical sections leaking down. */ > if (unlikely(raw_cpu_read(rcu_sched_qs_mask))) > rcu_momentary_dyntick_idle(); > this_cpu_inc(rcu_qs_ctr); > + barrier(); /* Avoid RCU read-side critical sections leaking up. */ > } > EXPORT_SYMBOL_GPL(rcu_all_qs); > =20 >=20 --IvGM3kKqwtniy32b Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJV87w2AAoJEEl56MO1B/q4G6EIAKEDs7tavQHBOYJ/JxZ6BzA/ 4LDMa9582QD4Wd+WmJ5KwEZVEKq8GCZl6tsEOtWFxYIRgu7XEMHynb3nLicag5Lz a5FlmdjqzQlvqaxRtSU/8WZzSlihPVs7kIUu1FX0abt4K7Ca7er+bOzJZ89sWTDi 0RtyztXtu33BoIraa0+cdAp7h6wcnNrQtg7Bt7/2AwTeA3FU31BLRWuegB0jsDxn h954G4DGx4tCRI8GOQCYFgEZprMoR7p1hCA1nvxxndcBXNDT6Ph+CPXGQsGdIxpu J6qwhawjL4Ab8am7t2QFZaG7QYaP4fKBSWP47A5c5CZ3e2led7UnboJcf3ljKxY= =sfqn -----END PGP SIGNATURE----- --IvGM3kKqwtniy32b--