Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp4911642rwj; Tue, 20 Dec 2022 17:14:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXsMc+bV10Lfi3ewGivm4Cnr5XQ1Igc0Ey9uhx4FQ/6bIG1AL/+qdxUI/9mlVlBIZHjF2FO7 X-Received: by 2002:a17:907:2713:b0:7c0:a36d:115b with SMTP id w19-20020a170907271300b007c0a36d115bmr3263151ejk.14.1671585255949; Tue, 20 Dec 2022 17:14:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671585255; cv=none; d=google.com; s=arc-20160816; b=pC3y1pEHJKadDmELDB03ZyrzRTUA2DbFk1BVs3qIYni5gUxwkIrMSSHHMLj9SzXT+B EnXdWR6EEDxcjz7l6ne68Mv8NJpLiomSQSDtaCFnNulRh1ee1cXfcPk5UiS4Dpqacc+T qgsXMWegO4LIUkG92a32AAqgitAkUgFC1N8rZOHbnTDEUbaUGYe6apWzdLGbk8/oW9gQ Q9B/JsbcbLpAN0jXjGb1Lv2R5hOPV4MDkzRD3NvkBzrlMxmtzYLo01LfWM4vBxLpjSkC WV5h1FHW2ADnImABLXNnhybY1iS0l59pLmDLl1qbwyP1hiAyUU7V0thbhV4M8v1OUbev gMNw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NqgZo5tp7qUPiTmE99Osu9Ildp0uPWMfDR0MG+4zHAk=; b=H8BWieEPr/2h5eGujRWBpFaW2gkKb/XhVTL3LU/KvmQEIxAC4EfeB5ZYKR0IAeBxws yo0JiPKgK02gPGqnhing1QR77B/2jeNOKK5GB7HNtlERcp/vjZ+kbqWX36fw33F44jCs LIw/WVh7FfsoZggBFVp7JslHhwUp2QPoVrA7dwgaeGi9dtK83w0GZ1eUb6Od3v3aUVNz GnuhT0q+Cy/zqMzukOiVW32uWg3u5gEw/FwNnYykAHP+FeqRHijLPB5mActybF43JFVX LsssmgcfbdpA/RmhyPxKrWc/eoQODD6BEhnBt6KNeERuzxlKIv7wQcqgSvBVGc9cvx52 TJKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=f9lU+Szr; 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 he19-20020a1709073d9300b007da4fe085bbsi14431043ejc.144.2022.12.20.17.13.59; Tue, 20 Dec 2022 17:14:15 -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=f9lU+Szr; 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 S233331AbiLUAuG (ORCPT + 68 others); Tue, 20 Dec 2022 19:50:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229448AbiLUAuE (ORCPT ); Tue, 20 Dec 2022 19:50:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45F2214020; Tue, 20 Dec 2022 16:50:03 -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 9EB4CB81AC3; Wed, 21 Dec 2022 00:50:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55BFC433EF; Wed, 21 Dec 2022 00:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671583800; bh=UQfaCMmNKemVUDC7EJVOsBtsfVKMwNk1684fgHLkLl4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f9lU+Szrwvol+FSib7YYWiFxVvwz7C3RMHTQKHFEUDlF7Jv1kVwYIHw29dJP1xldZ qBaS1zsTuIQ1RE7XBRVHburjYI6La/xr7KBiMhs0faR0gsd+rGlhn/m/3ExA7vLT5x 48Y9Jsv5osTCS0jrbQ1wiE8SdO2TIyeGSn7ucCgGQeAaeGcuDWUY4N5Je7X5Dhv7FS dmmnUmZRvI5fM4J/sCIdA5XZFtfg4DHvFnlR7N0ujT2PnAqwzlm06kVHIh4Xtwem1i l2g3PSvLW1Tnn7emFZcQinc+w0j69QbOBj4Uxsvyv+BjVMT3m7fNg+uU9plAkpIpAH OBEw2qRxs3vGw== Date: Wed, 21 Dec 2022 01:49:57 +0100 From: Frederic Weisbecker To: Joel Fernandes Cc: linux-kernel@vger.kernel.org, Josh Triplett , Lai Jiangshan , Mathieu Desnoyers , "Paul E. McKenney" , rcu@vger.kernel.org, Steven Rostedt Subject: Re: [RFC 0/2] srcu: Remove pre-flip memory barrier Message-ID: <20221221004957.GA29021@lothringen> References: <20221220140714.GB22763@lothringen> <20221220224459.GA25175@lothringen> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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:15:00PM -0500, Joel Fernandes wrote: > On Tue, Dec 20, 2022 at 5:45 PM Frederic Weisbecker wrote: > Agreed about (1). > > > _ In (2), E pairs with the address-dependency between idx and lock_count. > > But that is not the only reason. If that was the only reason for (2), > then there is an smp_mb() just before the next-scan post-flip before > the lock counts are read. The post-flip barrier makes sure the new idx is visible on the next READER's turn, but it doesn't protect against the fact that "READ idx then WRITE lock[idx]" may appear unordered from the update side POV if there is no barrier between the scan and the flip. If you remove the smp_mb() from the litmus test I sent, things explode.