Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751919AbcKITLo (ORCPT ); Wed, 9 Nov 2016 14:11:44 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:54752 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750927AbcKITLm (ORCPT ); Wed, 9 Nov 2016 14:11:42 -0500 Date: Wed, 9 Nov 2016 11:11:31 -0800 From: "Paul E. McKenney" To: Will Deacon Cc: Andy Lutomirski , Chris Metcalf , Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , Rik van Riel , Tejun Heo , Frederic Weisbecker , Thomas Gleixner , Christoph Lameter , Viresh Kumar , Catalin Marinas , Daniel Lezcano , Francis Giraldeau , Andi Kleen , Arnd Bergmann , "linux-kernel@vger.kernel.org" Subject: Re: task isolation discussion at Linux Plumbers Reply-To: paulmck@linux.vnet.ibm.com References: <1471382376-5443-1-git-send-email-cmetcalf@mellanox.com> <1605b087-2b3b-77c1-01ac-084e378f5f28@mellanox.com> <20161109014045.GI4127@linux.vnet.ibm.com> <20161109173808.GJ4127@linux.vnet.ibm.com> <20161109185743.GN17771@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161109185743.GN17771@arm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16110919-0028-0000-0000-00000600F9BA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006049; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00778732; UDB=6.00375101; IPR=6.00556087; BA=6.00004866; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013275; XFM=3.00000011; UTC=2016-11-09 19:11:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16110919-0029-0000-0000-000030B7AA21 Message-Id: <20161109191131.GO4127@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-11-09_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611090353 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1907 Lines: 55 On Wed, Nov 09, 2016 at 06:57:43PM +0000, Will Deacon wrote: > Hi Paul, > > Just a couple of comments, but they be more suited to Andy. > > On Wed, Nov 09, 2016 at 09:38:08AM -0800, Paul E. McKenney wrote: > > @@ -355,10 +373,33 @@ static bool rcu_dynticks_in_eqs_since(struct rcu_dynticks *rdtp, int snap) > > static void rcu_dynticks_momentary_idle(void) > > { > > struct rcu_dynticks *rdtp = this_cpu_ptr(&rcu_dynticks); > > - int special = atomic_add_return(2, &rdtp->dynticks); > > + int special = atomic_add_return(2 * RCU_DYNTICK_CTRL_CTR, > > + &rdtp->dynticks); > > > > /* It is illegal to call this from idle state. */ > > - WARN_ON_ONCE(!(special & 0x1)); > > + WARN_ON_ONCE(!(special & RCU_DYNTICK_CTRL_CTR)); > > +} > > + > > +/* > > + * Set the special (bottom) bit of the specified CPU so that it > > + * will take special action (such as flushing its TLB) on the > > + * next exit from an extended quiescent state. Returns true if > > + * the bit was successfully set, or false if the CPU was not in > > + * an extended quiescent state. > > + */ > > Given that TLB maintenance on arm is handled in hardware (no need for IPI), > I'd like to avoid this work if at all possible. However, without seeing the > call site I can't tell if it's optional. For this, I must defer to Andy. > > +bool rcu_eqs_special_set(int cpu) > > +{ > > + int old; > > + int new; > > + struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu); > > + > > + do { > > + old = atomic_read(&rdtp->dynticks); > > + if (old & RCU_DYNTICK_CTRL_CTR) > > + return false; > > + new = old | RCU_DYNTICK_CTRL_MASK; > > + } while (atomic_cmpxchg(&rdtp->dynticks, old, new) != old); > > + return true; > > } > > Can this be a cmpxchg_relaxed? What is it attempting to order? It is attmepting to order my paranoia. ;-) If Andy shows me that less ordering is possible, I can weaken it. Thanx, Paul