Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5484782rdb; Wed, 13 Dec 2023 09:54:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEhX8omNqQ4Cm7USfWWYvJ24c94E61L3GUbszzmvRMWfGJhelT6Soi9wtl7MoEMvZtmZdp+ X-Received: by 2002:a17:90b:1a8b:b0:28a:d5f6:88de with SMTP id ng11-20020a17090b1a8b00b0028ad5f688demr2463332pjb.39.1702490048106; Wed, 13 Dec 2023 09:54:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702490048; cv=none; d=google.com; s=arc-20160816; b=X4Q5vPIOn1UafG0enxjdNIIfyrx8jXhzgnQ/nBqvz/hqRYKyYHJUjcX0w0AElmAftB SZ+doScnEacjt/RzKUQBXh5GHQSVV3ZHhX27MuY1F+7gS3B1Gq3IcVAQrrENiIThXqBe ocesVrhSVyMtCjWQyrGpIA+ZWqGMm/xjw6E6Pj/ZtWmObnAhNow7g/SDm+Ep4pfLFEFC q0zrFvFz45QAr874WqAG4aDd3W3atn3Mttor3XddtdQ3eUJ6Ae3ibtntltcjtR7eznHk 1PPtBHNsDAA0sy8nEpDz66yOv8l5vlHnDJJw4bCSdi4ekmfXNJk9nh8mNjDJ1drIyG2a zxqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=OGNAXVdRNLDRS+lAozgUGL4tUXXW2w2bj9qXubd6Gpo=; fh=e/OFF91UXV41WM2De3X8gfB/ERAqNJd5LmXwqMoI0dY=; b=jJYZN5/V8DBxiKN+rYrW7ONLWztCAhrEPiQshbq/qCqf5I/FjAic5pwxKnsbHYzpt0 R8Ey8ZPlzxPUoplLNFao4B7TTgN09NmBSVlbsgktCboE2kuF9cOSC55lUNO20lYg0Qnf Safytad2xfJE0Hx9Ib92BaOJ9zlyBbmRGdOimaEneiuWZfOhI7d8HYQMkWx6vUsv/Tob IWB11ZF/VcHizlcujJwFlAXi28VNy0zQk7p9VXR1aX6A+S7tvc9wOpg4l2fBvVh9vHkM W8aEq8ZI9AgwE3XAVPWy4Iy0DVaLEpQvsE+SR+S/xcCrSZXM3SLZB1+D9Ebfb4yzyCjT pxzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HPEGxOVq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q7-20020a17090a68c700b002886a242d11si9978078pjj.130.2023.12.13.09.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 09:54:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HPEGxOVq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3B252802A3D2; Wed, 13 Dec 2023 09:54:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233264AbjLMRwa (ORCPT + 99 others); Wed, 13 Dec 2023 12:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229480AbjLMRw3 (ORCPT ); Wed, 13 Dec 2023 12:52:29 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56BC883 for ; Wed, 13 Dec 2023 09:52:36 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D417FC433C9; Wed, 13 Dec 2023 17:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702489955; bh=G8gvqaJsOovAzWijVF1YdUmeoDhtEd9YvOcb1wcEgyU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=HPEGxOVqEPYzu9pJjVZcoo82HDOw/caZfbV9FSxs8AQWqKyPwGyeFgp42e6sQQ238 4ACpX2Ak+es2Skes9Ioc3/Fwz9FEU+22ab9Gus9b+1ivgcK6BYLXoVob/rZiQXx/1Z DZAUpmNvv1FN3z3MWmAMLavrJosUlZAqDAI4niCYKvbl0qAPkiiQ5igFkYNunWer55 aVIbQz4XZ+xEtYiBV+GVMDPWkObufFFMz0gkvK+06cJNMeY9TB9dHdzqwgREC3PLX6 525HXKyOhPsU7UQLH8QCes3DBEoGVjfM/tMz/pGBY+QDsPk50IlTTgp8ucH8rMUTcs kQ1h7+dNinSUA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 690CFCE0C4D; Wed, 13 Dec 2023 09:52:35 -0800 (PST) Date: Wed, 13 Dec 2023 09:52:35 -0800 From: "Paul E. McKenney" To: Joel Fernandes Cc: "Neeraj Upadhyay (AMD)" , rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, Neeraj.Upadhyay@amd.com, Frederic Weisbecker Subject: Re: [PATCH rcu 3/3] srcu: Explain why callbacks invocations can't run concurrently Message-ID: <2b2c1573-337d-409b-a8ee-daeff096c7f4@paulmck-laptop> Reply-To: paulmck@kernel.org References: <20231212174750.GA11886@neeraj.linux> <20231212174817.11919-3-neeraj.iitr10@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 13 Dec 2023 09:54:04 -0800 (PST) On Wed, Dec 13, 2023 at 09:27:09AM -0500, Joel Fernandes wrote: > On Tue, Dec 12, 2023 at 12:48 PM Neeraj Upadhyay (AMD) > wrote: > > > > From: Frederic Weisbecker > > > > If an SRCU barrier is queued while callbacks are running and a new > > callbacks invocator for the same sdp were to run concurrently, the > > RCU barrier might execute too early. As this requirement is non-obvious, > > make sure to keep a record. > > > > Signed-off-by: Frederic Weisbecker > > Reviewed-by: Joel Fernandes (Google) > > Signed-off-by: Paul E. McKenney > > Signed-off-by: Neeraj Upadhyay (AMD) > > --- > > kernel/rcu/srcutree.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c > > index 2bfc8ed1eed2..0351a4e83529 100644 > > --- a/kernel/rcu/srcutree.c > > +++ b/kernel/rcu/srcutree.c > > @@ -1715,6 +1715,11 @@ static void srcu_invoke_callbacks(struct work_struct *work) > > WARN_ON_ONCE(!rcu_segcblist_segempty(&sdp->srcu_cblist, RCU_NEXT_TAIL)); > > rcu_segcblist_advance(&sdp->srcu_cblist, > > rcu_seq_current(&ssp->srcu_sup->srcu_gp_seq)); > > + /* > > + * Although this function is theoretically re-entrant, concurrent > > + * callbacks invocation is disallowed to avoid executing an SRCU barrier > > + * too early. > > + */ > > Side comment: > I guess even without the barrier reasoning, it is best not to allow > concurrent CB execution anyway since it diverges from the behavior of > straight RCU :) Good point! But please do not forget item 12 on the list in checklist.rst. ;-) (Which I just updated to include the other call_rcu*() functions.) Thanx, Paul