Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp494798lqp; Wed, 12 Jun 2024 07:46:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVlrt63zV/uvDvWIJsq6gyHBvB5UYcFX98fYTzCiNev0s0M9vwX+5kmQ2gqHxDmJg6wuUj1zSxJx/nAB9C/06B38l08jrNxti7oVuxQA== X-Google-Smtp-Source: AGHT+IGX3DvXjDbHYopRmRPCSKZBiiNt0INr9FOKcEjbiqk7KRr5LMPy/wA6KYnM0MfSJG0iVx1h X-Received: by 2002:a05:6358:54a2:b0:199:28ad:1447 with SMTP id e5c5f4694b2df-19f69d4b234mr271084155d.10.1718203616018; Wed, 12 Jun 2024 07:46:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718203615; cv=pass; d=google.com; s=arc-20160816; b=NGZrxx4MdQgyRAV1jh5Caf0H9kLYz1s1pOHzizDIPG66BILIyiXgz1bUPQnNOVeati Uet1wt6HzCnUVu7Plwdac9Q0YEHlUlhyfBRJ+FY24lJ/CKVRzRNSepqXXXMRmBtEb+Pd 5/Gv5NjV6rrt4tb3tSHw2bQAx4oauZxIIcfEaxTqjjiv4c7GSjy9VSVsecvLBI05wqVT //yKUeDF8ff9PnprwQdNCHktGrP5xtWK0/Kk9nlxTgdwci/fWN5BnnEc3dqSvfVSZdWi tEFHF7uNT+q29R64k8h/u91HBVyQl/345sZ6aUTn6muU4lVobwIluif0lin0NtZs2IBZ MtxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=aWKH9ag+h9oHnF7zEaK48xS0RGoQ6c+mbn5LpBaoL3Q=; fh=ywI0kkyz9oQI2zEN/dq6YIJ8wiK1+k8RqO4d28PM/GQ=; b=niZl+TajPr75E5SjrZqk3VmJ41IS9ddmhxfAY24Ll5dbx06kTmCUQdHsi/JBUZS9yr T6FapDUWnmQNLHscL9HrNEnyHQYYB5UWLGuAjV6eO5ndbzsUgS1crGh4g9ibvz+W/ZrN XogpbDQJ4EJ2Ew+EkrJGicGD4xhA2giPNvHGEZyzWBz7qrPW8fVdJLsyDkYcKFnoC0oH qBdl9XMBt7TjtsV/cOIUKnxVWMetAxJI4+2CZoawTcbXK62q3H1LK7b/BjrukFW8I5qy a7cHe8NFqULf88J/ekuwUZ0fX3P09+Ls/D8GxN2FAee458dryleLNzkt5+bdck7fVlEf UGxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AOoV2lLC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-211694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211694-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6fcbe6e6294si535263a12.66.2024.06.12.07.46.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 07:46:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AOoV2lLC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-211694-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211694-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 58B0AB21269 for ; Wed, 12 Jun 2024 14:45:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0915C17E916; Wed, 12 Jun 2024 14:45:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AOoV2lLC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B48E10E3; Wed, 12 Jun 2024 14:45:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718203539; cv=none; b=UW/n/beozudGpUO7JzSUSeeqbBmXpCxKG9XdaTWNDF/Kw3XOFWVmjKbbKs44yjd6tzsln4NlWj613XJLq/99L9CjsWM6HFr8aB7JSRhEsjVVB6pT1HjAZI98uBPAbz+xPplJej5WS6Rkr6JpUVcCCIGCv+ExZ8RVfhgiFMObpdU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718203539; c=relaxed/simple; bh=pOEh/kJuLjFT35DPlXE51th7dgbqYHf8hNYpg+yrC+w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Io0JfEFGHKkoaJn0VJABEGLJqXWieuHWnhF4VIMbRVZfuOI6/1vfgBrAithbxpEZyCi6WIIXPmbFSY9cMVdqBHaT+TyuqVvZF0209ca4Is3uqCG30Bkq1t7D4rA4ZNYh1Xx7rBCTVSwsEgmvdAc9bR+SCUFQsIuDqJRyL0BK2Ek= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AOoV2lLC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 958AAC116B1; Wed, 12 Jun 2024 14:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718203538; bh=pOEh/kJuLjFT35DPlXE51th7dgbqYHf8hNYpg+yrC+w=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=AOoV2lLC6qkQ5PrzMsaGByKx4L7vHn4zphuiD5SbvWyNv2ra6uIQ+Ht0l2OpxTt+n xmcBiyyk2hHoBx7xA2XVNOdCaxtQPlwaZeCd0EjI9GwO+wPC6A1jpgkLbhM3H6FAHD 4NEFdzNqZxcI98ewmJXhTmGsy9w+sKpix7BoVDHE+uNdRjUVCOqv/m4fbIgPEPpoAz GJi8pRxjWzIZRK3sApUs1aZIJR8HmFBDgAz4b7tszNbJdjpt7Y7v1mGy2myKQsdBZM ebTc+m1K/2HQTUN7JkQfHfOn+3mzSa6PylBHomkfCC5TEgg8+w8j+Htbh/IVM39bDH uxCyMfgb3TN2w== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 3E604CE0886; Wed, 12 Jun 2024 07:45:38 -0700 (PDT) Date: Wed, 12 Jun 2024 07:45:38 -0700 From: "Paul E. McKenney" To: Neeraj upadhyay Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Frederic Weisbecker Subject: Re: [PATCH rcu 3/6] rcu/exp: Remove superfluous full memory barrier upon first EQS snapshot Message-ID: <5bef03bd-84c4-4e9b-b045-ea023f91d772@paulmck-laptop> Reply-To: paulmck@kernel.org References: <81f4e616-8125-4934-a8e2-fd5beae90995@paulmck-laptop> <20240604222652.2370998-3-paulmck@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Jun 12, 2024 at 02:14:14PM +0530, Neeraj upadhyay wrote: > On Wed, Jun 5, 2024 at 3:58 AM Paul E. McKenney wrote: > > > > From: Frederic Weisbecker > > > > When the grace period kthread checks the extended quiescent state > > counter of a CPU, full ordering is necessary to ensure that either: > > > > * If the GP kthread observes the remote target in an extended quiescent > > state, then that target must observe all accesses prior to the current > > grace period, including the current grace period sequence number, once > > it exits that extended quiescent state. > > > > or: > > > > * If the GP kthread observes the remote target NOT in an extended > > quiescent state, then the target further entering in an extended > > quiescent state must observe all accesses prior to the current > > grace period, including the current grace period sequence number, once > > it enters that extended quiescent state. > > > > This ordering is enforced through a full memory barrier placed right > > before taking the first EQS snapshot. However this is superfluous > > because the snapshot is taken while holding the target's rnp lock which > > provides the necessary ordering through its chain of > > smp_mb__after_unlock_lock(). > > > > Remove the needless explicit barrier before the snapshot and put a > > comment about the implicit barrier newly relied upon here. > > > > Signed-off-by: Frederic Weisbecker > > Signed-off-by: Paul E. McKenney > > --- > > kernel/rcu/tree_exp.h | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/rcu/tree_exp.h b/kernel/rcu/tree_exp.h > > index 8a1d9c8bd9f74..bec24ea6777e8 100644 > > --- a/kernel/rcu/tree_exp.h > > +++ b/kernel/rcu/tree_exp.h > > @@ -357,7 +357,13 @@ static void __sync_rcu_exp_select_node_cpus(struct rcu_exp_work *rewp) > > !(rnp->qsmaskinitnext & mask)) { > > mask_ofl_test |= mask; > > } else { > > - snap = rcu_dynticks_snap(cpu); > > + /* > > + * Full ordering against accesses prior current GP and > > + * also against current GP sequence number is enforced > > + * by current rnp locking with chained > > + * smp_mb__after_unlock_lock(). > > Again, worth mentioning the chaining sites sync_exp_reset_tree() and > this function? It might well be in both cases. Could you and Frederic propose agreed-upon appropriate changes (including the null change, if appropriate)? Thanx, Paul > Thanks > Neeraj > > > + */ > > + snap = ct_dynticks_cpu_acquire(cpu); > > if (rcu_dynticks_in_eqs(snap)) > > mask_ofl_test |= mask; > > else > > -- > > 2.40.1 > > > >