From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753176AbbJFUwF (ORCPT ); Tue, 6 Oct 2015 16:52:05 -0400 Received: from casper.infradead.org ([85.118.1.10]:41900 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752641AbbJFUwD (ORCPT ); Tue, 6 Oct 2015 16:52:03 -0400 Date: Tue, 6 Oct 2015 22:52:00 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Josh Triplett , linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, tglx@linutronix.de, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com, fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com, Boqun Feng Subject: Re: [PATCH tip/core/rcu 04/13] rcu: Don't disable preemption for Tiny and Tree RCU readers Message-ID: <20151006205200.GZ3604@twins.programming.kicks-ass.net> References: <20151006161305.GA9799@linux.vnet.ibm.com> <1444148028-11551-1-git-send-email-paulmck@linux.vnet.ibm.com> <1444148028-11551-4-git-send-email-paulmck@linux.vnet.ibm.com> <20151006164445.GA9600@cloud> <20151006170101.GG3910@linux.vnet.ibm.com> <20151006171630.GC9600@cloud> <20151006174204.GL3910@linux.vnet.ibm.com> <20151006200538.GU3604@twins.programming.kicks-ass.net> <20151006201801.GU3910@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151006201801.GU3910@linux.vnet.ibm.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 06, 2015 at 01:18:01PM -0700, Paul E. McKenney wrote: > On Tue, Oct 06, 2015 at 10:05:38PM +0200, Peter Zijlstra wrote: > > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > > > index b9d9e0249e2f..93c0f23c3e45 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); > > > > These OTOH could be fixed with a noinline, such that the compiler may > > never inline it, even with whole-program-optimizations, thereby > > guaranteeing a function call boundary or compiler barrier. > > I like the barrier() with the comment. I expect it will be a bit more > robust against toolchain changes. Don't you in fact already rely on the fact that schedule() is a function call and will not be inlined? (it doesn't have noinline and I suppose whole program optimizers could go funny on it).