Received: by 10.223.185.116 with SMTP id b49csp1223485wrg; Wed, 21 Feb 2018 14:30:24 -0800 (PST) X-Google-Smtp-Source: AH8x226sTLfDFXNox3x12J8A5L9V88cgCoDdnNwOabRZgPtQ41zNpUiP7AjzaFdPflEUs06dkuG6 X-Received: by 2002:a17:902:8349:: with SMTP id z9-v6mr4396858pln.163.1519252224580; Wed, 21 Feb 2018 14:30:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519252224; cv=none; d=google.com; s=arc-20160816; b=ZiPdcVtB3vHm3iPv7IwX5ENhrLmwRYZUdn7tz9bCbVwwRoj1ERkWMsTldp2awnq9bu c+ATZZAxHt1vPSulk8rWHIjNZn9n0lWZzJlkNj0XghLS8snjFwpan6EP2PJIs08szAWS UzNHylhJCjrZL8r9Z5tRU+PbHtf50wdF3cALhL78X/fzjMsQhNGi1DPOq7TQ59tQru6o uKRXaMpy6IYIg83Ah3upEZvyFGnrfRZ9ad2HUR5yoz8SR4e0TxNR9uHYiB3QE82zZlzc zParGMvH4igE6wDy2jd2mm3xuJZ07+aeyzXrvYVBPHoBoFrByRRVG+bA0bi/irINdAej EHMQ== 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=sFcPAlEFaoJYOgSgeMOS31/LLvZFRoCXzEsrTfLcyfY=; b=lFQ6Va8UnhgzR1Gv2+g7s8+dXLdB7tfG717hFWB7T4xI6MKVFe17IfZSi11LMRRxWM FMqoE/+qEIh6TK6O5wiQ9WIyUvs3Q5huWY/3B+FSoTXKt4cXW5YXNRRGm9Kijgi6LLdN QU5hNkJR9/Vc9E1QG3SyTvxnoFW7zlZy5Ek/9APfa+dko6u6plja/T9QMWwob3DMtAM3 UF2UnuTbefqsBK1mZR/kBwiRNAoeCph6EcYxhstg8ZSUeQzrdwW/DBfVtw8rACLMdfRG J0OJ4LRGJY56+wkiQgDNg4WK7pKRObteKCxCDHsi0DNbHgYoF+/SwNFkf8JZt3Is7Ylh 0WxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aHXU5Kbj; 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 i12si213535pgp.7.2018.02.21.14.30.09; Wed, 21 Feb 2018 14:30:24 -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=aHXU5Kbj; 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 S1751379AbeBUW3I (ORCPT + 99 others); Wed, 21 Feb 2018 17:29:08 -0500 Received: from mail-pl0-f65.google.com ([209.85.160.65]:33384 "EHLO mail-pl0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750790AbeBUW3H (ORCPT ); Wed, 21 Feb 2018 17:29:07 -0500 Received: by mail-pl0-f65.google.com with SMTP id x18so1746538pln.0 for ; Wed, 21 Feb 2018 14:29:07 -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=sFcPAlEFaoJYOgSgeMOS31/LLvZFRoCXzEsrTfLcyfY=; b=aHXU5KbjtnE0jrxa4E91tqk5NPowA8iY+AeZmNok/64THo86NuDB4g3UOYcM61GD93 P98uir07vjQNioNFDfFmfPNqfX8o96eT9WU9sOfzEUa9NwLfrpva7gN4w+ZzEWaWHWeu /FU7oqseAN/4R56yRNr+Bi7XxNC+qUf4TjoUEsUkgdFJmt50S1YlLwDYcG6D+ZuvTCdH rjqJbC4rkQLrr79D2Wwb9S2DgbKGbdLd5abLmDPBUOrkZKDqYdtS51DqQRlmc6HIu8HI 26UPGudsLlXz6S2Aj0+M9VeCiJxUnI41bCzlgyse70I5JQSI7Co00s9/p4AHfn1MWuHX aH5A== 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=sFcPAlEFaoJYOgSgeMOS31/LLvZFRoCXzEsrTfLcyfY=; b=TkCwKOCI+QD3Q/QYU5C6XAZGIJYxlyqe0dE93Dkq6lsRMPd0cJvvuadjY57vjqZRcE bjU9xMPTDLlS7Ha4fR7XC+lII9Y6tz5YxnDo9IBxVVn/Ekm1OUEpboUepVS5ZWOToE2c 3tpeMsxp8oM/wxk6Jfk7ki5qX5KBF7U2j3z7G6y8cHnUIRQl3ZGJBNXl6P0hRrKTbdqX U2IENAYi2USFa+GGv90XC8fkTF4M+Ak/yhiUQcr03gC3gEDUV3lXu6YA3M2rQBaI0/ai plj2S62pCDE8+NqZsq5iYIZek2Y+lIDomHQXyrH6UKVucKxA8OR1DCZO7RwKGMbhRyCi duRA== X-Gm-Message-State: APf1xPAjWecuvTF8Kb9TKS0hzu61imku98hoXW8Wr7g4upxLJFDhF917 X3bbtU+E+9zlMx/CpNZ3cco= X-Received: by 2002:a17:902:ba95:: with SMTP id k21-v6mr436554pls.111.1519252146721; Wed, 21 Feb 2018 14:29:06 -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 k8sm32845045pfi.121.2018.02.21.14.29.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Feb 2018 14:29:06 -0800 (PST) Subject: Re: [PATCH] tools/memory-model: update: remove rb-dep, smp_read_barrier_depends, and lockless_dereference To: Alan Stern , "Paul E. McKenney" 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: From: Akira Yokosawa Message-ID: <74dbcbd4-6034-0be9-7674-ccb058de6177@gmail.com> Date: Thu, 22 Feb 2018 07:29:02 +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: 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/22 2:15, Alan Stern wrote: > 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 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. > > 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") > The change itself looks good to me. Acked-by: Akira Yokosawa Thanks, Akira > --- > > tools/memory-model/Documentation/cheatsheet.txt | 6 +++--- > tools/memory-model/Documentation/explanation.txt | 4 ++-- > tools/memory-model/linux-kernel.def | 2 +- > 3 files changed, 6 insertions(+), 6 deletions(-) > > Index: usb-4.x/tools/memory-model/Documentation/cheatsheet.txt > =================================================================== > --- usb-4.x.orig/tools/memory-model/Documentation/cheatsheet.txt > +++ usb-4.x/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 > Index: usb-4.x/tools/memory-model/Documentation/explanation.txt > =================================================================== > --- usb-4.x.orig/tools/memory-model/Documentation/explanation.txt > +++ usb-4.x/tools/memory-model/Documentation/explanation.txt > @@ -826,7 +826,7 @@ A-cumulative; they only affect the propa > 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 > other properties which we discuss later. > > > @@ -1138,7 +1138,7 @@ final effect is that even though the two > 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 > Index: usb-4.x/tools/memory-model/linux-kernel.def > =================================================================== > --- usb-4.x.orig/tools/memory-model/linux-kernel.def > +++ usb-4.x/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} ; } >