Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5351704rdb; Wed, 13 Dec 2023 06:27:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTb3xHmUhGjHUtvP5+69iMEz1afoEDiWfu5ykzCdz4jY25xFD7E3ew9f98v9ckdLRduBgR X-Received: by 2002:a17:903:1d2:b0:1d0:d15c:8baa with SMTP id e18-20020a17090301d200b001d0d15c8baamr4878656plh.83.1702477650450; Wed, 13 Dec 2023 06:27:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702477650; cv=none; d=google.com; s=arc-20160816; b=Ul1a1ajARgB3X+OjBDc/MOh2RMxaU1U6vUUl1tLZuXoqlCMha465VXs5/uL5iL4/cZ 1vgCQpxYwimT/VBJUys2gKnMFmwjPS9AmcSXIsRI05rQBTLwoN5CTF9jOpUBafaWdUMi Jdc5xiQQveTL/LKxaa0VJcbUCkNmASMI7zSXpR9s4LpJqKK3PGLnbKzQKDezJMYia4C9 If2+BoCeoFgqO8GbT+Mf8XZly3FsybFVFDv9RsUnvyot6QWtfNvPNHC9ZaFX/T9rvmN/ m2lvcJXkiud2nXpxwQdmF9yT8i221BSwTjBoTjBStAIyhdZUwuVfI/9TmhDBd1AWfe4m JCTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=F2tUcIBSYXXfAdv/AVfpRmmC9S7RY2jXn+X6NSmZ8AA=; fh=1TciPmz+bJheW8zPvNOG+3XkMUlpKlhqg6DD6ywFPsc=; b=y4WxiXPYSJWuJaMxiyOh+Qba0yukT4RUXcoOEFUbItc0nKRiOU0wxDpzev+LMXwP5q YW0WqvOhSRcmRl+CDrDuSOESLPah1dcTITvOsykTWJBf9NzVIV20FtyAtid6vy08qnvH uZF8fXzvZMpnn6UjQS+O4NfcBBGnAijJ7+tcYpIaX6QbE+ZthUAvZvLH2X4jIqMwNs0C yow7G54EdXWj7BpuE/zx4M8YknwRPxoSR22o7VgrEBYoBAzUPmeu8dJvb/zRvL7kpmTX /ilzHT0R+Ivnp4dQRG5b4fX6GmhWl35a3CckzyrRw+mupAodVGdh0ymqhDU4kW/4vYt/ UhJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=KZ11MPuq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id m5-20020a170902db0500b001d015cec684si9999630plx.238.2023.12.13.06.27.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 06:27:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=KZ11MPuq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4E4618031E2D; Wed, 13 Dec 2023 06:27:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1441913AbjLMO1S (ORCPT + 99 others); Wed, 13 Dec 2023 09:27:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54126 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1441849AbjLMO1Q (ORCPT ); Wed, 13 Dec 2023 09:27:16 -0500 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6934EB9 for ; Wed, 13 Dec 2023 06:27:22 -0800 (PST) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2cc3647bf06so9444011fa.2 for ; Wed, 13 Dec 2023 06:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; t=1702477641; x=1703082441; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=F2tUcIBSYXXfAdv/AVfpRmmC9S7RY2jXn+X6NSmZ8AA=; b=KZ11MPuq44aMOtWEpezE+8BgwdGQFRdMsFC5TBVE+SAnPtWRaAwJxR+0UPbfveY8oW HvA9GctCp/UtSJpb6tJIMROZZpUPLpZuLXdX8PvlnIbrnR2RTWC+enX/SlVmjqjK9Ufw goz/TJTMuctiWLv8ehkKfYNNUKJZtX0wq2LFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702477641; x=1703082441; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=F2tUcIBSYXXfAdv/AVfpRmmC9S7RY2jXn+X6NSmZ8AA=; b=m3+Cjwb8c9NzV9B2jTo4cwiXKm89rvYsJc5o6soJmf7P9kM+Bigwc1PyIqPzVVwbcX CXuc2YJkwOMD8DFnTYK3ZGEKefflwRmFUqR5gWUw3DkwL5+HVOkgQl5JYBs0Ie6FJJea C69vfhWsud28x7bRGps7pvBmEeRgg7pL9JYszyKLejBOdgtD+O2YoebGUAA7p7lB9NEY VEtxFAPfcPycI0jEXKRTWmfOalkbTeiiz9lgB5vfMJjM8I1UBVRXzugxnMfzizzAiw7g 7VdEIx20rr2MaZOYeVtMixP4tnXI+44zsj8ll2lUM4vZC5g4golBclrEQj2+hd7AWx5+ dPUw== X-Gm-Message-State: AOJu0YwtX+AL6AMIUTFT+JOlwZNZSVWImEMtvTDxIlfUXOta93uIHcY3 DU2hXLtvFaIzGjLn3nGTEsCRx180MaHRUq92oAAxsA== X-Received: by 2002:a05:651c:b23:b0:2cb:2c27:593c with SMTP id b35-20020a05651c0b2300b002cb2c27593cmr2670296ljr.20.1702477640535; Wed, 13 Dec 2023 06:27:20 -0800 (PST) MIME-Version: 1.0 References: <20231212174750.GA11886@neeraj.linux> <20231212174817.11919-3-neeraj.iitr10@gmail.com> In-Reply-To: <20231212174817.11919-3-neeraj.iitr10@gmail.com> From: Joel Fernandes Date: Wed, 13 Dec 2023 09:27:09 -0500 Message-ID: Subject: Re: [PATCH rcu 3/3] srcu: Explain why callbacks invocations can't run concurrently To: "Neeraj Upadhyay (AMD)" Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, rostedt@goodmis.org, paulmck@kernel.org, Neeraj.Upadhyay@amd.com, Frederic Weisbecker Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 13 Dec 2023 06:27:29 -0800 (PST) On Tue, Dec 12, 2023 at 12:48=E2=80=AFPM 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_stru= ct *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 :) - Joel