From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221AbbJFU64 (ORCPT ); Tue, 6 Oct 2015 16:58:56 -0400 Received: from e34.co.us.ibm.com ([32.97.110.152]:54281 "EHLO e34.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752719AbbJFU6x (ORCPT ); Tue, 6 Oct 2015 16:58:53 -0400 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com X-IBM-RcptTo: linux-kernel@vger.kernel.org Date: Tue, 6 Oct 2015 13:58:50 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, 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 Subject: Re: [PATCH tip/core/rcu 02/18] rcu: Move rcu_report_exp_rnp() to allow consolidation Message-ID: <20151006205850.GW3910@linux.vnet.ibm.com> Reply-To: paulmck@linux.vnet.ibm.com References: <20151006162907.GA12020@linux.vnet.ibm.com> <1444148977-14108-1-git-send-email-paulmck@linux.vnet.ibm.com> <1444148977-14108-2-git-send-email-paulmck@linux.vnet.ibm.com> <20151006202937.GX3604@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151006202937.GX3604@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: 15100620-0017-0000-0000-00000E6F00BD Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 06, 2015 at 10:29:37PM +0200, Peter Zijlstra wrote: > On Tue, Oct 06, 2015 at 09:29:21AM -0700, Paul E. McKenney wrote: > > +static void __maybe_unused rcu_report_exp_rnp(struct rcu_state *rsp, > > + struct rcu_node *rnp, bool wake) > > +{ > > + unsigned long flags; > > + unsigned long mask; > > + > > + raw_spin_lock_irqsave(&rnp->lock, flags); > > Normally we require a comment with barriers, explaining the order and > the pairing etc.. :-) > > > + smp_mb__after_unlock_lock(); Hmmmm... That is not good. Worse yet, I am missing comments on most of the pre-existing barriers of this form. The purpose is to enforce the heavy-weight grace-period memory-ordering guarantees documented in the synchronize_sched() header comment and elsewhere. They pair with anything you might use to check for violation of these guarantees, or, simiarly, any ordering that you might use when relying on these guarantees. I could add something like "/* Enforce GP memory ordering. */" Or perhaps "/* See synchronize_sched() header. */" I do not propose reproducing the synchronize_sched() header on each of these. That would be verbose, even for me! ;-) Other thoughts? Thanx, Paul > > + for (;;) { > > + if (!sync_rcu_preempt_exp_done(rnp)) { > > + raw_spin_unlock_irqrestore(&rnp->lock, flags); > > + break; > > + } > > + if (rnp->parent == NULL) { > > + raw_spin_unlock_irqrestore(&rnp->lock, flags); > > + if (wake) { > > + smp_mb(); /* EGP done before wake_up(). */ > > + wake_up(&rsp->expedited_wq); > > + } > > + break; > > + } > > + mask = rnp->grpmask; > > + raw_spin_unlock(&rnp->lock); /* irqs remain disabled */ > > + rnp = rnp->parent; > > + raw_spin_lock(&rnp->lock); /* irqs already disabled */ > > + smp_mb__after_unlock_lock(); > > + rnp->expmask &= ~mask; > > + } > > +} >