Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1204316pxb; Sat, 4 Sep 2021 03:17:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz02KNkjznR2v9KYKS6bqJ8lloW/+9p7FHWVl53MJXurzAlqB0d/XmQ0iethpT2SCyh4ZLC X-Received: by 2002:a92:ce50:: with SMTP id a16mr657896ilr.65.1630750623602; Sat, 04 Sep 2021 03:17:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630750623; cv=none; d=google.com; s=arc-20160816; b=YGjUsGzxAb7bD/7Jxd8Kun32psZ0olxXCj2m2GKL2h+L3XiYl4BHgWm4KWK0oUw/Qk VGFEsY1shmu2HrZIcNMwtG+6xKkFfFjxP0gcI7JWqGAGO+bn7aVJmBHBOdUJW/Dz0za+ As+nmJRHyZEb2J5z9tLgu7nsxZwo5PFiZ3rbML4SA6WQx/H+G36xL4kE6xyzk+iemktE /C3RlcpO68O842hj93s9zxv3Bcglu++1/SJwMwk3zQ9cjjHfQxYyURhQqvRal93/twLl RnydrQWyH631y77rOUALVDTmurCpTOdRa34bCBmxTEs9hVbsZ4Z9nLBqq/pPR0IBmrqz Rj+Q== 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=zEr8Lbr9wQ3RfxgktRFywCR1x79QNbubTTty1+FgQv8=; b=L4XsLRNJ4OwkrU6ra/dFE4KaIQEw6l+/uOZdosj1jbOcIMp3ZDemFuK7ZvlMTnnxzy eTZYQ+ShgGiVAnnjcD9GX7QVFQYkXEOydadiGKYcG209jg5dbct0KwLLAzJoDK9SFAwh vAdsokxpsgVYD/RhFa39VNgoAE+ppxqO0zK2+erGXbzFeeiQlwWqdVDZPXgpEslQexC8 OBp01/ICRUybd+pTznTIOilN7+xJy8WlB1UpeRfyXHe4hOgjO4I4v/ikS87tGO6E/idT 5r4gMZXEc1cBPd4I6Mrtg43O2MY7bZeSf3++s7KBMsbppJOuZmOB54WSMqZxADAz2iXo RHlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="i+oae/o5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t195si2069044iof.69.2021.09.04.03.16.52; Sat, 04 Sep 2021 03:17:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="i+oae/o5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351021AbhIDKQb (ORCPT + 99 others); Sat, 4 Sep 2021 06:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235758AbhIDKQa (ORCPT ); Sat, 4 Sep 2021 06:16:30 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68CD9C061575 for ; Sat, 4 Sep 2021 03:15:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zEr8Lbr9wQ3RfxgktRFywCR1x79QNbubTTty1+FgQv8=; b=i+oae/o5GXNNdzIciEbGbHPoH3 witsMQivlXzFdYRXF7zcmw0EwSzYTuQ+fKKU96NJhIMvURf7VWa9LmlmEusFeRtC4hceSmwiRVuvI ljmu/mi4YyfIsZoYWuSd/ag4jBa/n84LPiNVuDqJOrc44ZQ2f6k36ekIp7MLj5PZv7txu3BgYOLvy BsW9O5sJgWbF3WkveQCudFjpzjDMX8WjL6RKF4ZHRfJV9Njal6eSRYbFiKh8z6RhrHS6Jwuwyw/53 LE/CyDeyycbOKvvI8FIcnlaXCDg+RpNGyJSl2zuUPalxBkFgjnBL9oHdpUk+rR7i0+jZLUy/5Yg7h HyJDk+SA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMSgw-005EDH-2W; Sat, 04 Sep 2021 10:14:38 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id A032F986283; Sat, 4 Sep 2021 12:14:29 +0200 (CEST) Date: Sat, 4 Sep 2021 12:14:29 +0200 From: Peter Zijlstra To: Boqun Feng 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: <20210904101429.GB4323@worktop.programming.kicks-ass.net> References: <20210901150627.620830-1-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?