From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D498EC433EF for ; Sat, 4 Sep 2021 10:20:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A52ED61054 for ; Sat, 4 Sep 2021 10:20:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351104AbhIDKVt (ORCPT ); Sat, 4 Sep 2021 06:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235997AbhIDKVs (ORCPT ); Sat, 4 Sep 2021 06:21:48 -0400 Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4CCEC061575 for ; Sat, 4 Sep 2021 03:20:47 -0700 (PDT) Received: by mail-il1-x131.google.com with SMTP id w7so1198921ilj.12 for ; Sat, 04 Sep 2021 03:20:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zMOftv/83ksuRT5Xktk1zpfmTyaENLJu2cQlWbtiaDE=; b=WCde3TKv0IvIfOj6O2lcr8r01dg5QeOy+4Aahgbxjh/2+yz8dZ4ViFInjybw+YuVK0 zqlfIYy6jES9ALb1pEZq3yFSZ/kTSdFc1xD4c+QatsqqlA/i2OzjKKZN9P8dFy2ArtcM 1/ik/LPomN4uGmq05W8BnC7OZ7GCH6qOq2SVBqGu28tLdpMAP5SMT3+wjEIGfxIUX0ww ucm191w4yet5JmiLM1MWILFdRZS6+7b9LJoDrzQDhRWICjBqgOOj0qtvMlSB6NST6q5Z +WW7gNcVLlafblF+pzwmttJdOQK28Pdanp30PWQgEBwozBFIMxHCKUjTJAPmP+RwJcZp 6oJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zMOftv/83ksuRT5Xktk1zpfmTyaENLJu2cQlWbtiaDE=; b=bL5SeWjdGSYgc7OrdIssdZ63VQNRW2kNi/QLtziYbj1sobU0+QrxmS2Bz3DAPB2GjU lf8213o8/1aok1cgoSp/Lo/093F+ok2AqDXYcJsehUEylUE0kMnFp84r9KYnIMy1udNO YJC8hJYxRJBJhENodISqPEJo1IcUVDXTAIernFkjy7Q5cGp/yVfjlr40ihc4yBJTU+26 QMc3hJX7lutB8R4xtM9yiMckAIjX72qGcwqKh9JKF/i6J5945RdokdrQQlgGZakH+5IO BGTDz1er9wWyRTjCWZFojgGqN4+7auopqetYsMx2dHUDWMCfi/4L1JY69K7a9ebkGrvL SVCA== X-Gm-Message-State: AOAM530Wzsnaaz4oZ00HEYzDoo1+YZAeMEsRSrXgrPukDsiItPUm8i5o EivWsw5osNEZdTM5GcJY24seAuDPYDI/Ur7n X-Google-Smtp-Source: ABdhPJwfq77gRt1TzlnwaIQfHh9pOqvU39yAekZbnQNYVapnJ0xjOb65tRRkJniXqoUYjyy5NYLjvQ== X-Received: by 2002:a92:1306:: with SMTP id 6mr2100663ilt.183.1630750847167; Sat, 04 Sep 2021 03:20:47 -0700 (PDT) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id v5sm1209324iln.42.2021.09.04.03.20.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Sep 2021 03:20:46 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id 10C4927C0054; Sat, 4 Sep 2021 06:20:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 04 Sep 2021 06:20:46 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvledgvdelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhquhhn ucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrfgrth htvghrnhepvdelieegudfggeevjefhjeevueevieetjeeikedvgfejfeduheefhffggedv geejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepsg hoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieeg qddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigi hmvgdrnhgrmhgv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 4 Sep 2021 06:20:44 -0400 (EDT) Date: Sat, 4 Sep 2021 18:19:27 +0800 From: Boqun Feng To: Peter Zijlstra Cc: Thomas Gleixner , Ingo Molnar , Juri Lelli , Steven Rostedt , Davidlohr Bueso , Will Deacon , Waiman Long , Sebastian Andrzej Siewior , Mike Galbraith , Daniel Bristot de Oliveira , LKML Subject: Re: [RFC] locking: rwbase: Take care of ordering guarantee for fastpath reader Message-ID: References: <20210901150627.620830-1-boqun.feng@gmail.com> <20210904101429.GB4323@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210904101429.GB4323@worktop.programming.kicks-ass.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 04, 2021 at 12:14:29PM +0200, Peter Zijlstra wrote: > On Fri, Sep 03, 2021 at 10:50:58PM +0800, Boqun Feng wrote: > > > * ordering, either is strong enough to provide ACQUIRE order > > > * for the above load of @readers. > > > */ > > > rwbase_set_and_save_current_state(state); > > > raw_spin_lock_irqsave(&rtm->wait_lock, flags); > > > > > > while (readers) { > > > ... > > > readers = atomic_read(&rwb->readers); > > > > The above should be _acquire(), right? Pairs with the last reader > > exiting the critical section and dec ->readers to 0. If so, it > > undermines the necessity of the restructure? > > This is the one that's followed by set_current_state(), no? You're right. I was missing that ;-/ Regards, Boqun >