Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp883214imm; Mon, 21 May 2018 16:26:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZolmevaiUyH7TtJDaa07qzC6uHR41oOuHxeY2JU8q3YPHG9iPzCEh8ngbi+/J+m9PKWwF2S X-Received: by 2002:a62:f17:: with SMTP id x23-v6mr21980947pfi.3.1526945191629; Mon, 21 May 2018 16:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526945191; cv=none; d=google.com; s=arc-20160816; b=YdjyH/voxI3EVrJIi+TkK2A17yzNSVm8Gm1dSTMgpiHLe6TRRSmp5AoRiy/PWB/PfF CuKUtjOYGu/ennqM2++Yk+kbYKt4ow8SjbAKp6x/TuZr9SoR2u+4DEWwjr6X8ZG6CpKx SXoFF4Sf8X74Evtt9ASGkL7Uz+NgoD6WqxZtRa9pTQ212YKiLvLTusNrcduE8/dprsOx dzOJSZhYgikXQj7cCoV6doN8Qg7Wd1r8uvj5r2A+qp3iRQ3QZQi0BOmPgeNPTnYYyBLy 7wvDYdQMk/53S7C47hGXgVD4Fe6bSnyu0F4BDYy7C5w9pwcarrAIZOfX3icosWqZManh p3QA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date:arc-authentication-results; bh=xV3IIZiGZA+51tIbYtZa+pGHDW7fAR5iMCTzhtWMN88=; b=NSBwAOEcXYUXfggnpdYwaOT8wOVDcf1JtihZJXRRB3ncuv+DaC5rT2KHH7vEzaNfEU clJNHpCyUIkZinXPo1k+4byiUYDsBGqRHFn0P5pXyDD34A87jVJwoDIKIAsTK2OjZjMB 0l5h3qGCS+KzIdqF3YYCEmMbuV8DjnBcRqm+4ga8e6XHmJ7TSJbyJbMZPGtGr1JRdZu/ 5sh5lQFjEiK5dPG9giYxIKpa/eCqUKqitiCUv5W7vII0EwPkuSgMaspJKqfivRRliKH5 CF8I9CctF8mRTEG9r1ehyaaACNIo7+atRqYHsfKBhRFZZzRMOvTBgsFa6Qi6HVZ8Vtho 2vVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n3-v6si12006701pga.543.2018.05.21.16.26.16; Mon, 21 May 2018 16:26:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751244AbeEUXZu (ORCPT + 99 others); Mon, 21 May 2018 19:25:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:38964 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751019AbeEUXZs (ORCPT ); Mon, 21 May 2018 19:25:48 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4LNPmxM053125 for ; Mon, 21 May 2018 19:25:48 -0400 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0a-001b2d01.pphosted.com with ESMTP id 2j45vxudm2-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 21 May 2018 19:25:48 -0400 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 May 2018 19:24:05 -0400 Received: from b01cxnp23033.gho.pok.ibm.com (9.57.198.28) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 May 2018 19:24:01 -0400 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w4LNO1U766584758; Mon, 21 May 2018 23:24:01 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2E361B2066; Mon, 21 May 2018 20:25:52 -0400 (EDT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0FAB8B205F; Mon, 21 May 2018 20:25:52 -0400 (EDT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.108]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 21 May 2018 20:25:51 -0400 (EDT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 05C8B16C3F37; Mon, 21 May 2018 16:25:38 -0700 (PDT) Date: Mon, 21 May 2018 16:25:38 -0700 From: "Paul E. McKenney" To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, Joel Fernandes , Josh Triplett , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , byungchul.park@lge.com, kernel-team@android.com Subject: Re: [PATCH v3 4/4] rcu: Unlock non-start node only after accessing its gp_seq_needed Reply-To: paulmck@linux.vnet.ibm.com References: <20180521044220.123933-1-joel@joelfernandes.org> <20180521044220.123933-5-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180521044220.123933-5-joel@joelfernandes.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18052123-0008-0000-0000-0000030AF6A0 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009063; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000261; SDB=6.01035741; UDB=6.00529792; IPR=6.00814868; MB=3.00021229; MTD=3.00000008; XFM=3.00000015; UTC=2018-05-21 23:24:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18052123-0009-0000-0000-0000395433C7 Message-Id: <20180521232537.GJ3803@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-05-21_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805210267 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 20, 2018 at 09:42:20PM -0700, Joel Fernandes wrote: > We acquire gp_seq_needed locklessly. To be safe, lets do the unlocking > after the access. Actually, no, we hold rnp_start's ->lock throughout. And this CPU (or in the case of no-CBs CPUs, this task) is in charge of rdp->gp_seq_needed, so nothing else is accessing it. Or at least that is the intent. ;-) One exception is CPU hotplug, but in that case, only the CPU doing the hotplugging is allowed to touch rdp->gp_seq_needed and even then only while the incoming/outgoing CPU is inactive. Thanx, Paul > Signed-off-by: Joel Fernandes > --- > kernel/rcu/tree.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c > index 879c67a31116..efbd21b2a1a6 100644 > --- a/kernel/rcu/tree.c > +++ b/kernel/rcu/tree.c > @@ -1603,13 +1603,13 @@ static bool rcu_start_this_gp(struct rcu_node *rnp_start, struct rcu_data *rdp, > trace_rcu_grace_period(rsp->name, READ_ONCE(rsp->gp_seq), TPS("newreq")); > ret = true; /* Caller must wake GP kthread. */ > unlock_out: > - if (rnp != rnp_start) > - raw_spin_unlock_rcu_node(rnp); > /* Push furthest requested GP to leaf node and rcu_data structure. */ > if (ULONG_CMP_GE(rnp->gp_seq_needed, gp_seq_req)) { > rnp_start->gp_seq_needed = gp_seq_req; > rdp->gp_seq_needed = gp_seq_req; > } > + if (rnp != rnp_start) > + raw_spin_unlock_rcu_node(rnp); > return ret; > } > > -- > 2.17.0.441.gb46fe60e1d-goog >