Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F6CDC05027 for ; Sun, 19 Feb 2023 17:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231166AbjBSRNb (ORCPT ); Sun, 19 Feb 2023 12:13:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231160AbjBSRN2 (ORCPT ); Sun, 19 Feb 2023 12:13:28 -0500 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BA3BEB68 for ; Sun, 19 Feb 2023 09:13:27 -0800 (PST) Received: by mail-lj1-x233.google.com with SMTP id f16so832474ljq.6 for ; Sun, 19 Feb 2023 09:13:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=FLnCzmxIt/DonRK9GYLq9VyjsNvoMWiJE0QzVv883cU=; b=fOBczrEtv/5bv99CXGdpRptOHgsXWAD9U1VVVyr0JRfP6QawLJL82rB1qCO4zmAq+5 vZCHDUeI3vOaLji95aMc8TWy6TbGD5INfNvhK84pMglDkPgOMKDewk9j14JYhxdFpZgG BSIICRfOdzibHAxZrfpeVvyGwnj0mwQHZB5Lg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=FLnCzmxIt/DonRK9GYLq9VyjsNvoMWiJE0QzVv883cU=; b=SsIoElAZFpFF6M6WI5X086h7RxTHu0q0y8x6izala8PyD+nEItyY5dvSIUx4rWCDKO QGfB/Rzk3PnlxfkmMlxF48X+o+eJvK/ZTexJjWl9XAORJyjh71FglyZZBWsV4BZ01YA0 01AXCIiNZypCCA6Z7ahWzSlbjFjSz51YMertlp4iHi3bXgc3JzrnoPtfMO4nJxqXoJSx 4Lor3K7tA6oYIBsyEAMvQSevgqbfTiDtNEULevAcvr3z50ec0Y0xNQBsFtlSRjQplXNb RFlTxh8fGWP4EOnDuch/tCP5BLfbqdZmK7Eh1rLjE17G+n8BZRYUvsxW+jsSkm7/y+J4 otwA== X-Gm-Message-State: AO0yUKXUwIjwbRSBVmO2jgLcYB6GLtLSmbeAPIZPoUMCEkGnhehvifUU hGnllwXi7VE6g7UkZumV/NUpVtVj/gQlkTvVD1tQKw== X-Google-Smtp-Source: AK7set8BayFeZknI9LfP/O0U7moXKLwWto8roCzAE9yYJZOYS1BGfiVsyZ4pjzm2DdO3cwz8ZgT6RLXu9c90eDn3YOA= X-Received: by 2002:a05:651c:3de:b0:294:764a:330d with SMTP id f30-20020a05651c03de00b00294764a330dmr618109ljp.3.1676826805896; Sun, 19 Feb 2023 09:13:25 -0800 (PST) MIME-Version: 1.0 References: <20230213015506.778246-1-joel@joelfernandes.org> In-Reply-To: From: Joel Fernandes Date: Sun, 19 Feb 2023 12:13:14 -0500 Message-ID: Subject: Re: [PATCH] tools/memory-model: Add details about SRCU read-side critical sections To: Alan Stern Cc: linux-kernel@vger.kernel.org, Boqun Feng , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Peter Zijlstra , Will Deacon , Jonas Oberhauser , Akira Yokosawa , Andrea Parri , Daniel Lustig , David Howells , Jonas Oberhauser , linux-arch@vger.kernel.org, Nicholas Piggin , "Paul E. McKenney" , =?UTF-8?Q?Paul_Heidekr=C3=BCger?= , Will Deacon Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 19, 2023 at 12:11 PM Joel Fernandes wrote: > > On Sun, Feb 19, 2023 at 11:48 AM Alan Stern wrote: > > > > On Mon, Feb 13, 2023 at 01:55:06AM +0000, Joel Fernandes (Google) wrote: [...] > > + A: idx1 = srcu_read_lock(&s); > > + B: srcu_read_unlock(&s, idx1); > > + C: idx2 = srcu_read_lock(&s); > > + D: srcu_read_unlock(&s, idx2); > > + > > +it would appear that B was a store to a temporary variable (i.e., s) > > +and C was a load from that variable, thereby allowing carry-srcu-data > > +to extend a data dependency from A to D and giving the impression > > +that D was the srcu-unlock event matching A's srcu-lock. > > Even though it may be redundant: would it be possible to also mention > (after this paragraph) that this case forms an undesirable "->rf" link > between B and C, which then causes us to link A and D as a result? > > A[srcu-lock] ->data B[once] ->rf C[once] ->data D[srcu-unlock]. Apologies, I meant here, care must be taken to avoid: A[srcu-lock] ->data B[srcu-unlock] ->rf C[srcu-lock] ->data D[srcu-unlock]. Thanks, - Joel