Received: by 10.223.185.116 with SMTP id b49csp1048007wrg; Wed, 21 Feb 2018 11:10:04 -0800 (PST) X-Google-Smtp-Source: AH8x226B9chyN6oUdsm6t/3vOfg65HpvkdcnfvTT7FMaonr565PtNKtpievFU0w/5V2j1x1rfGSd X-Received: by 2002:a17:902:4a0c:: with SMTP id w12-v6mr521487pld.192.1519240204127; Wed, 21 Feb 2018 11:10:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519240204; cv=none; d=google.com; s=arc-20160816; b=V5qRDNbtz7xbH2Da9WUwnhOF4OUTjHRwRZq64o4k9xWTOxV66Nc1z/4VHxadL+LBaQ +7jo9dDKGFDfZuAQH6OqFv4OGalwcxcaDXGVGqro/fsJ9EJzJFXpQfFmfy2YLN3bpc4X edkhrNYdNehuXhsHQ9rrFO8jrXFVHJ6WO4mmrVZMa5/0Sa104qAGAFHNUaRtYw0kQIaw rofv85eEWKKTtqdPjBBqa9NLuRcKPpQBZyLBYqdrNn38jWYmSEH/TNdRxNGwo9w4kbtr G48ozLVBokNhgzmyb5R+IaU0dAxyHsXvKSLbNII0aeyp8dmw1rMuHKWe7XSoeY518BYj ImDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:in-reply-to :subject:cc:to:from:date:arc-authentication-results; bh=9WCJElrkOqQMj6LKErGPtr6P0fP7Mamv5nGJawicHa4=; b=lpzLPTQI6qN1RDti5l8UNAIVDzqUpfHlhQyHRRgo/B4LSWT6QPpI6QQdl6puh+vxR8 kox6MiOrPmhVy6M0arzY5h8o7yjY34R123weO5tdewpMa4y/RMhWVbdOHiare0NGfoon OiOTpoRy4C7q4P9J5NuJyWFzsNmwgkTtwzqqV/Kcfq7MYtLAtHk+/0QAVpdNzNeRq/m1 aR/741so4gBD8XKEFPHnBYrEirTW4f8fPTbGPK9JloezA1aKB+osRviBOAfiR2Uv5OeJ ZuCmRnr6cn8Ie/9FfyW2jjlsuRO8DvVAXloXh7PHF9GVvj0ZNhjYbWZqOAMKrChvLHS7 CywQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 99-v6si1468072pla.603.2018.02.21.11.09.49; Wed, 21 Feb 2018 11:10:04 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932262AbeBURP6 (ORCPT + 99 others); Wed, 21 Feb 2018 12:15:58 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:33982 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754432AbeBURP5 (ORCPT ); Wed, 21 Feb 2018 12:15:57 -0500 Received: (qmail 5137 invoked by uid 2102); 21 Feb 2018 12:15:56 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 21 Feb 2018 12:15:56 -0500 Date: Wed, 21 Feb 2018 12:15:56 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Paul E. McKenney" cc: Andrea Parri , Akira Yokosawa , Kernel development list , , Will Deacon , , , , , Jade Alglave , Luc Maranget , Patrick Bellasi Subject: [PATCH] tools/memory-model: update: remove rb-dep, smp_read_barrier_depends, and lockless_dereference In-Reply-To: <20180221160602.GD3617@linux.vnet.ibm.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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") --- 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} ; }