Received: by 10.223.185.116 with SMTP id b49csp2241779wrg; Sat, 24 Feb 2018 14:48:17 -0800 (PST) X-Google-Smtp-Source: AH8x224LEORDEkPRAq1BAPvJbIuWD3n0EmmKf5h6reTmdu4T7UGA+FXIIMZlQDeO2IHLurufyUFW X-Received: by 2002:a17:902:6782:: with SMTP id g2-v6mr6080555plk.19.1519512497055; Sat, 24 Feb 2018 14:48:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519512497; cv=none; d=google.com; s=arc-20160816; b=yhGFOsiXctn7hBsiHkz0jUhz9Qli/paseVDH+Uo+BPO6YcB34aM3rQeUpceLvdmQNX /1Z4w0ljznBr1Omnsj4YEdsAwhXCQE1ikNMqKIUesLdrTpvQ3gfXMD6b5kW8QU0sAfiy Vu5NzoCleSfYLwZu3W1WcaaQX5ePdy83RVwT6/nvd5QjNRS0hf7k2oVvv/9oc1C610Ev oFLZuOlQ27hUJFrI4/hS+vF2bCzR+htaOCw9rj1lAczpqCa5BLwwFhTjbFZZ2LsL5v/f LRGIjdlmCH9w55nEobrUaFQMAwArWoTIK7A+vOYEaqngKQN1CfuaXNPHcbF8W8fALsyz ZmGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=1bFuDW2H9Ek5d2FPsCMF8Vhv/XfZGSASG4KwsMAWNH4=; b=I7Wl2dDBY1tpB2cqPkhPf422dxUKIEnMph9RP8ZKzahzcfs1ScD3plV9PVAEeo+6f0 WqmGU9Vzq/ZXU6NAX1tq5kGu3UfuY8lnZ15SRurO0bGWQwbs8ruDP5WxAvzRWSiDOZyo PLZfQrbnVqi/VzO0BKURIauT5kBgkjE2ejJsPI9c/42aUlzhgycGrlO6oocupiMP8HyZ vXFpOtAQQfho43cvkjCbiOvz1L9tah1nHmQjPlEvQjp77M+KOMr+hBbJtnbWELmXRlX9 r6/uIKf7hTuPqq4xTO+zHim+vtbstlqiOrURuXK0O2Bfbu+hKde/JF+N0JhilqNc2noZ EFnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HBB1RABj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i10-v6si4289333plr.670.2018.02.24.14.48.02; Sat, 24 Feb 2018 14:48:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HBB1RABj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751522AbeBXWr3 (ORCPT + 99 others); Sat, 24 Feb 2018 17:47:29 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:37729 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751449AbeBXWr2 (ORCPT ); Sat, 24 Feb 2018 17:47:28 -0500 Received: by mail-pg0-f67.google.com with SMTP id y26so4753421pgv.4 for ; Sat, 24 Feb 2018 14:47:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=1bFuDW2H9Ek5d2FPsCMF8Vhv/XfZGSASG4KwsMAWNH4=; b=HBB1RABjQ89iGxtaz+K7JpxIzbDrLOsMG7Tvk+g+peD/pmf4VkEo5ijzISQ+H4jJiN 7Qc5h+y80mXik5iyUg4jePFlRnVV4gXOgCcKMke/qOf/jjcI5emjz1YEDO7RS7RCTnCO 6Wg7u9wZ8baikqKIWY0RUIK+7W5lVcd+DV21SHP+70CYMZv7o0DKvrdBJIJ94JXXp7ea e6lPyToS76ZKglNNKVSh5iRlXjNStgri4GLHbDfB4mBn2ieSRbEphfFtQOkUKuPg4Kp2 PZQvktreU4HdpOdwFUPdLUhm4BmLU5j4NLzf90QBjWqoe72Noj8CgJI4gaRHOKs959p1 KOOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1bFuDW2H9Ek5d2FPsCMF8Vhv/XfZGSASG4KwsMAWNH4=; b=TnrObtVX3iPZcKmkactvh/HIc7V9AS8S8Y0mU46WS0PCw9NwX6TxCUtRShgG2Kfg0B zpCbM/Bn3fmSJgVD7ppXJNgpuY/nyTLdM/nuQC+jE7vCMeQlw0k12KCyXjwj7IRYOKU2 BGEmn0boihtEWnWHUQa1gvhj51Eaxm7xat2mQJ7s9DLcHaxeFGktb6WyJsCfJlaPgvT/ QafashV3R2w0FkP/1mCYLbiM4rwTqj3mFqGBVRROsuuMeXs3QMswj2Wyr6Skae1bq4BM hNEBOq0TCb9YjKmqM3kJttBjaRYdDN7Cx5LfaWxGr1J+FyYGDhbH2UbPKwIWeAOnUzyT BChw== X-Gm-Message-State: APf1xPBrUgiDxNa6XmJ8zrx74Sg4ugSAgyxTzfhv+p6akjy48G742xsv HpN3OA7hZpV/30wJ3p+T/Bw= X-Received: by 10.98.194.219 with SMTP id w88mr6033718pfk.26.1519512447428; Sat, 24 Feb 2018 14:47:27 -0800 (PST) Received: from [192.168.11.4] (KD106167171201.ppp-bb.dion.ne.jp. [106.167.171.201]) by smtp.gmail.com with ESMTPSA id 63sm8493546pgi.71.2018.02.24.14.47.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Feb 2018 14:47:26 -0800 (PST) Subject: Re: [PATCH] tools/memory-model: update: remove rb-dep, smp_read_barrier_depends, and lockless_dereference To: "Paul E. McKenney" , Alan Stern Cc: Andrea Parri , Kernel development list , mingo@kernel.org, Will Deacon , peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, Jade Alglave , Luc Maranget , Patrick Bellasi , Akira Yokosawa References: <20180224143658.GA3556@andrea> <20180224180814.GV2855@linux.vnet.ibm.com> From: Akira Yokosawa Message-ID: Date: Sun, 25 Feb 2018 07:47:23 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180224180814.GV2855@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/02/24 10:08:14 -0800, Paul E. McKenney wrote: > On Sat, Feb 24, 2018 at 11:49:20AM -0500, Alan Stern wrote: >> On Sat, 24 Feb 2018, Andrea Parri wrote: >> >>> On Fri, Feb 23, 2018 at 07:30:13PM -0800, Paul E. McKenney wrote: >>>> On Sat, Feb 24, 2018 at 12:22:24PM +0900, Akira Yokosawa wrote: >>>>> On 2018/02/22 07:29:02 +0900, Akira Yokosawa wrote: >>>>>> On 2018/02/22 2:15, Alan Stern wrote: >>> >>> [...] >>> >>>>>>> >>>>>>> Akira pointed out some typos in the original patch, and he noted that >>>>>>> cheatsheet.txt should be updated to indicate how unsuccessful RMW >>>>>>> operations relate to address dependencies. >>>>>> >>>>>> My point was to separate unannotated loads from READ_ONCE(), if the >>>>>> cheatsheet should concern such accesses as well. >>>>>> Unsuccessful RMW operations were brought up by Andrea. >>>>>> >>>>> >>>>> Paul, can you amend above paragraph in the change log to something like: >>>>> >>>>> Akira pointed out some typos in the original patch, and he noted that >>>>> cheatsheet.txt should be updated to indicate READ_ONCE() implies >>>>> address dependency, which invited Andrea's observation that it should >>>>> also be updated to indicate how unsuccessful RMW operations relate to >>>>> address dependencies. >>>>> >>>>> , if Alan and Andrea are OK with the amendment. >>>>> >>>>> Also, please append my Acked-by. >>>>> >>>>> Acked-by: Akira Yokosawa >>>> >>>> I can still amend this, and have added your Acked-by. If Alan and Andrea >>>> OK with your change, I will apply that also. >>> >>> LGTM. Thanks, >> >> Me too. > > Very good, how about this for the new version? > > Thanx, Paul > > ------------------------------------------------------------------------ > > commit 21ede43970e50b7397420f17ed08bb02c187e2eb > Author: Alan Stern > Date: Wed Feb 21 12:15:56 2018 -0500 > > tools/memory-model: Update: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference > > Commit bf28ae562744 ("tools/memory-model: Remove rb-dep, > smp_read_barrier_depends, and lockless_dereference") was accidentally > merged too early, while it was still in RFC form. This patch adds in > the missing pieces. > > Akira pointed out some typos in the original patch, and he noted that > cheatsheet.txt should indicate that READ_ONCE() now implies an address > dependency. Andrea suggested documenting the relationship betwwen > unsuccessful RMW operations and address dependencies. Looks good. But I've found a remaining typo in the patch. See below. > > Andrea pointed out that the macro for rcu_dereference() in linux.def > should now use the "once" annotation instead of "deref". He also > suggested that the comments should mention commit 5a8897cc7631 > ("locking/atomics/alpha: Add smp_read_barrier_depends() to > _release()/_relaxed() atomics") as an important precursor, and he > contributed commit cb13b424e986 ("locking/xchg/alpha: Add > unconditional memory barrier to cmpxchg()"), another prerequisite. > > Signed-off-by: Alan Stern > Suggested-by: Akira Yokosawa > Suggested-by: Andrea Parri > Fixes: bf28ae562744 ("tools/memory-model: Remove rb-dep, smp_read_barrier_depends, and lockless_dereference") > Acked-by: Andrea Parri > Acked-by: Akira Yokosawa > Signed-off-by: Paul E. McKenney > > diff --git a/tools/memory-model/Documentation/cheatsheet.txt b/tools/memory-model/Documentation/cheatsheet.txt > index 04e458acd6d4..956b1ae4aafb 100644 > --- a/tools/memory-model/Documentation/cheatsheet.txt > +++ b/tools/memory-model/Documentation/cheatsheet.txt > @@ -1,11 +1,11 @@ > Prior Operation Subsequent Operation > --------------- --------------------------- > C Self R W RWM Self R W DR DW RMW SV > - __ ---- - - --- ---- - - -- -- --- -- > + -- ---- - - --- ---- - - -- -- --- -- > > Store, e.g., WRITE_ONCE() Y Y > -Load, e.g., READ_ONCE() Y Y Y > -Unsuccessful RMW operation Y Y Y > +Load, e.g., READ_ONCE() Y Y Y Y > +Unsuccessful RMW operation Y Y Y Y > rcu_dereference() Y Y Y Y > Successful *_acquire() R Y Y Y Y Y Y > Successful *_release() C Y Y Y W Y > diff --git a/tools/memory-model/Documentation/explanation.txt b/tools/memory-model/Documentation/explanation.txt > index dae8b8cb2ad3..889fabef7d83 100644 > --- a/tools/memory-model/Documentation/explanation.txt > +++ b/tools/memory-model/Documentation/explanation.txt > @@ -826,7 +826,7 @@ A-cumulative; they only affect the propagation of stores that are > executed on C before the fence (i.e., those which precede the fence in > program order). > > -read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have > +read_read_lock(), rcu_read_unlock(), and synchronize_rcu() fences have rcu_read_lock() Don't ask why I missed this in the first place... Paul, can you fix this directly? Thanks, Akira > other properties which we discuss later. > > > @@ -1138,7 +1138,7 @@ final effect is that even though the two loads really are executed in > program order, it appears that they aren't. > > This could not have happened if the local cache had processed the > -incoming stores in FIFO order. In constrast, other architectures > +incoming stores in FIFO order. By contrast, other architectures > maintain at least the appearance of FIFO order. > > In practice, this difficulty is solved by inserting a special fence > diff --git a/tools/memory-model/linux-kernel.def b/tools/memory-model/linux-kernel.def > index 5dfb9c7f3462..397e4e67e8c8 100644 > --- a/tools/memory-model/linux-kernel.def > +++ b/tools/memory-model/linux-kernel.def > @@ -13,7 +13,7 @@ WRITE_ONCE(X,V) { __store{once}(X,V); } > smp_store_release(X,V) { __store{release}(*X,V); } > smp_load_acquire(X) __load{acquire}(*X) > rcu_assign_pointer(X,V) { __store{release}(X,V); } > -rcu_dereference(X) __load{deref}(X) > +rcu_dereference(X) __load{once}(X) > > // Fences > smp_mb() { __fence{mb} ; } >