From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753244AbbJFVFp (ORCPT ); Tue, 6 Oct 2015 17:05:45 -0400 Received: from e31.co.us.ibm.com ([32.97.110.149]:41802 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752782AbbJFVFo (ORCPT ); Tue, 6 Oct 2015 17:05:44 -0400 X-IBM-Helo: d03dlp02.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Tue, 6 Oct 2015 14:05:39 -0700 From: "Paul E. McKenney" To: Peter Zijlstra 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: <20151006210539.GZ3910@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com 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> <20151006205200.GZ3604@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151006205200.GZ3604@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15100621-8236-0000-0000-0000127B470D Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 06, 2015 at 10:52:00PM +0200, Peter Zijlstra wrote: > 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). Probably pretty much everywhere I call schedule(). But I was thinking that barrier() and the beginning and end of an external function didn't need to do anything. Is that incorrect? Thanx, Paul