Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4813841rwj; Tue, 20 Dec 2022 15:37:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvqTFV2BZXABvSb8WZMlEKyyRj+izfZDABNbpu+ESkVi4NRSTgTEeczGrwOK/ik19ykMGbV X-Received: by 2002:a17:90a:6406:b0:223:ae41:39e2 with SMTP id g6-20020a17090a640600b00223ae4139e2mr14477457pjj.28.1671579420742; Tue, 20 Dec 2022 15:37:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671579420; cv=none; d=google.com; s=arc-20160816; b=SnVNoOdDx2F6c+n6KDRdmZ5xbUcWgCF2Rr2j2rbJmszDaOosha3CDUqdxPMDElXfU9 L6D1SjLfmCT+6J/cDUsN3wRvwD3MOri1t2IEDJr+BIufE+/wONbwp9x5h95w4zfHPr6V yILlUihjlK7ODFbC05ObiBa9ER9d6TaTSstEzAJnFiSfuxnGe+iChu9f3C8Sc6hqjR09 aGyRJzSZXHJr+BNRWnuq1Nbfx0NF90DQr31C6JzZungWI0e/OIepJxO5pF0iwIao74OI xEkWTz3HrjyKXwHooIescxPnaKzRBj5XRywpA4O5TsbSA9w3QP8xZ1bi1ktDHC3B+o/J HGhA== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=hHL7tkL4dpGwJWR16kVMP2orpGprRPHC7XsaDDmZkeo=; b=eFAkrZ3YrKUg2TpiBqQOTOLD26LKvXzfdCTMSbkvD2+bTpq0g0zHbp4GxrV6eiDKQa fh3GqhA1oAiFHGSG6M45K1TPIn32hKhE5Tb1MxNSCfOaiZN8Sue6qTGDNIhR24cIZtJw SQrnumCHc6/Q6gBh0yqP2mp3vCkJ/pHA8dF6Yi0q4coQUdikyOHwo7D9uDKIv+fGPgwU NTVAuhd39jGyIaDl8ZPDbvpEjbH6WCff0v/0/gGVVJrMB0celuc5T+GOgEFW2F+tKPnd ErsV7WiFRiOpQ0MEC5Rum/BC8UnDBWsAxCzO5ii/kX8A2632AvS5HeWtOsEPVrUPrdOx L9tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RqNJad/C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s187-20020a6377c4000000b004779a46d07csi16012233pgc.183.2022.12.20.15.36.51; Tue, 20 Dec 2022 15:37:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RqNJad/C"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234075AbiLTXFb (ORCPT + 68 others); Tue, 20 Dec 2022 18:05:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229756AbiLTXF2 (ORCPT ); Tue, 20 Dec 2022 18:05:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51CBC1EEE9; Tue, 20 Dec 2022 15:05:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 06CDFB81A52; Tue, 20 Dec 2022 23:05:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33817C433EF; Tue, 20 Dec 2022 23:05:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671577524; bh=rMikaFC2i5Sq8/9qOrsykFHBkwjk4NkB/GCAN55ieQs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RqNJad/CCU03ruRHzQo7qvBQAg7VQXCk/2vjESpO4UYBvAC/iXKzGWLh/vRm0Ux8R hSR/kEOkd1tathgoc2IEVK1sHHkPzNjR7NY90mSVL9P4yRqADXeBmxhEi8VIQDQtuK M8cr2Eb8VsHAMlUGWfZh+cUB3s3SHRfroZMYooXxowDvcK4WY3knu7Vfhbb8GGiI0G qBfTYan4+wAp5k/44/hzb4E1KorBALZzpL3YKn3ZMTnoJ9D27yFHdsVpEtpV/welb6 3bYcDX0KKzGDCF8yAUu/lYr/YmwaEyz9Hm4qw+w8NpAHV7PBsS4XR78JWN7GbW6YrW qDJBOtt0LRRxw== Date: Wed, 21 Dec 2022 00:05:21 +0100 From: Frederic Weisbecker To: Joel Fernandes Cc: Mathieu Desnoyers , linux-kernel@vger.kernel.org, Josh Triplett , Lai Jiangshan , "Paul E. McKenney" , rcu@vger.kernel.org, Steven Rostedt Subject: Re: [RFC 0/2] srcu: Remove pre-flip memory barrier Message-ID: <20221220230521.GC26563@lothringen> References: <6438d903-ab97-48c7-c338-9f0bc2686f94@efficios.com> <7A9876BA-C375-42A7-A5C9-FD940D2898D7@joelfernandes.org> <5bd5ee4a-710a-96bc-abe8-772b2e60f478@efficios.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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Tue, Dec 20, 2022 at 07:06:57PM +0000, Joel Fernandes wrote: > On Tue, Dec 20, 2022 at 7:01 PM Mathieu Desnoyers > wrote: > > > > On 2022-12-20 13:29, Joel Fernandes wrote: > > > > > > > > I do want to finish my memory barrier studies of SRCU over the holidays since I have been deep in the hole with that already. Back to the post flip memory barrier here since I think now even that might not be needed… > > > > I strongly suspect the memory barrier after flip is useless for the same > > reasons I mentioned explaining why the barrier before the flip is useless. > > > > However, we need to double-check that we have memory barriers at the > > beginning and end of synchronize_srcu, and between load of "unlock" > > counters and load of "lock" counters. > > > > Where is the barrier at the beginning of synchronize_srcu ? > > I believe we don't need another memory barrier at the beginning of > synchronize_srcu() (but this part of my SRCU study is still pending > ;)) . The grace period guarantee (read-side critical sections don't > span the GP) is already enforced by the memory barrier between > scanning for all unlocks, and scanning for all locks (Paired with > corresponding memory barriers on the read-side). > > Accordingly, before we scan all locks and match lock == unlock, there > is an smp_mb(). Why is that not sufficient? That's not enough, you still need a barrier between the updater's pre-GP accesses and the scans, so that post-GP read side sees the updater's pre-GP accesses: UPDATER READER ------- ------ WRITE A WRITE srcu_read_lock smp_mb() //rcu_seq_snap() smp_mb() READ srcu_read_lock //scans READ A Thanks. > > Thanks, > > - Joel > > > > > Thanks, > > > > Mathieu > > > > -- > > Mathieu Desnoyers > > EfficiOS Inc. > > https://www.efficios.com > >