From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758000Ab2GFQdB (ORCPT ); Fri, 6 Jul 2012 12:33:01 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:48544 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932196Ab2GFQcc (ORCPT ); Fri, 6 Jul 2012 12:32:32 -0400 Date: Fri, 6 Jul 2012 09:31:29 -0700 From: "Paul E. McKenney" To: Frederic Weisbecker Cc: LKML , Alessio Igor Bogani , Andrew Morton , Avi Kivity , Chris Metcalf , Christoph Lameter , Geoff Levand , Gilad Ben Yossef , Hakan Akkan , "H. Peter Anvin" , Ingo Molnar , Josh Triplett , Kevin Hilman , Max Krasnyansky , Peter Zijlstra , Stephen Hemminger , Steven Rostedt , Sven-Thorsten Dietrich , Thomas Gleixner Subject: Re: [PATCH 1/6] rcu: Settle config for userspace extended quiescent state Message-ID: <20120706163129.GV2522@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <1341576018-10721-1-git-send-email-fweisbec@gmail.com> <1341576018-10721-2-git-send-email-fweisbec@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1341576018-10721-2-git-send-email-fweisbec@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12070616-1780-0000-0000-0000072A1D48 X-IBM-ISS-SpamDetectors: X-IBM-ISS-DetailInfo: BY=3.00000284; HX=3.00000191; KW=3.00000007; PH=3.00000001; SC=3.00000004; SDB=6.00154304; UDB=6.00034812; UTC=2012-07-06 16:32:26 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 06, 2012 at 02:00:13PM +0200, Frederic Weisbecker wrote: > Create a new config option under the RCU menu that put > CPUs under RCU extended quiescent state (as in dynticks > idle mode) when they run in userspace. This require > some contribution from architectures to hook into kernel > and userspace boundaries. > > Signed-off-by: Frederic Weisbecker > Cc: Alessio Igor Bogani > Cc: Andrew Morton > Cc: Avi Kivity > Cc: Chris Metcalf > Cc: Christoph Lameter > Cc: Geoff Levand > Cc: Gilad Ben Yossef > Cc: Hakan Akkan > Cc: H. Peter Anvin > Cc: Ingo Molnar > Cc: Josh Triplett > Cc: Kevin Hilman > Cc: Max Krasnyansky > Cc: Peter Zijlstra > Cc: Stephen Hemminger > Cc: Steven Rostedt > Cc: Sven-Thorsten Dietrich > Cc: Thomas Gleixner > --- > arch/Kconfig | 13 +++++++++++++ > init/Kconfig | 10 ++++++++++ > kernel/rcutree.c | 4 ++++ > 3 files changed, 27 insertions(+), 0 deletions(-) > > diff --git a/arch/Kconfig b/arch/Kconfig > index 8c3d957..c2e0ce4 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -274,4 +274,17 @@ config SECCOMP_FILTER > > See Documentation/prctl/seccomp_filter.txt for details. > > +config HAVE_RCU_USER_QS > + bool > + help > + Provide kernel entry/exit hooks necessary for userspace > + RCU extended quiescent state. Syscalls and exceptions > + low level handlers must be wrapped with a call to rcu_user_exit() > + on entry and rcu_user_enter() before resuming userspace. Irqs > + entry don't need to call rcu_user_exit() because their high level > + handlers are protected inside rcu_irq_enter/rcu_irq_exit() but > + preemption or signal handling on irq exit still need to be protected > + with a call to rcu_user_exit(). rcu_user_enter() must then be > + called back on irq exit when the preempted task is back on the CPU. > + > source "kernel/gcov/Kconfig" > diff --git a/init/Kconfig b/init/Kconfig > index d07dcf9..3a4af8f 100644 > --- a/init/Kconfig > +++ b/init/Kconfig > @@ -441,6 +441,16 @@ config PREEMPT_RCU > This option enables preemptible-RCU code that is common between > the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations. > > +config RCU_USER_QS > + bool "Consider userspace as in RCU extended quiescent state" > + depends on HAVE_RCU_USER_QS && SMP OK, I'll bite... Why the "SMP"? RCU could make good use of knowing about user-mode executing even in UP kernels. > + help > + This option sets hooks on kernel / userspace boundaries and > + puts RCU in extended quiescent state when the CPU runs in > + userspace. It means that when a CPU runs in userspace, it is > + excluded from the global RCU state machine and thus doesn't > + need to keep the timer tick on for RCU. > + > config RCU_FANOUT > int "Tree-based hierarchical RCU fanout value" > range 2 64 if 64BIT > diff --git a/kernel/rcutree.c b/kernel/rcutree.c > index 5541a07..64fc2cd 100644 > --- a/kernel/rcutree.c > +++ b/kernel/rcutree.c > @@ -423,6 +423,7 @@ void rcu_idle_enter(void) > } > EXPORT_SYMBOL_GPL(rcu_idle_enter); > > +#ifdef CONFIG_RCU_USER_QS > /** > * rcu_user_enter - inform RCU that we are resuming userspace. > * > @@ -436,6 +437,7 @@ void rcu_user_enter(void) > rcu_eqs_enter(1); > } > EXPORT_SYMBOL_GPL(rcu_user_enter); > +#endif > > > /** > @@ -561,6 +563,7 @@ void rcu_idle_exit(void) > } > EXPORT_SYMBOL_GPL(rcu_idle_exit); > > +#ifdef CONFIG_RCU_USER_QS > /** > * rcu_user_exit - inform RCU that we are exiting userspace. > * > @@ -572,6 +575,7 @@ void rcu_user_exit(void) > rcu_eqs_exit(1); > } > EXPORT_SYMBOL_GPL(rcu_user_exit); > +#endif > > /** > * rcu_user_exit_irq - inform RCU that we won't resume to userspace > -- > 1.7.5.4 >