Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1832390imm; Tue, 10 Jul 2018 08:36:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfkEMD24hq1ePRpejvcgQMncgsyVbS1sbnnaI8xPfYleclfI5h4FmdZZQPI+/GUPAM9whGX X-Received: by 2002:a17:902:4c88:: with SMTP id b8-v6mr24364681ple.285.1531236978644; Tue, 10 Jul 2018 08:36:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531236978; cv=none; d=google.com; s=arc-20160816; b=ZZslcSlSqkmBbs1SMoS7GziGRdJ6zuVkPaAcbffJGyxYpqMgvfl8x/NGISEfBkER6i 50+qpbAXih+K0JfurBWWn3k8aNzAoF2oTC2ScXzEvAYAL8VcBjL8Qu7c5maaEAEW2ngM UWNLK+RjEyBPLyrc9T/jLY2pSMxCzYUhTLBlYcSsWW7fV+QTSUaGn3qg0sUCQDCV+bVo 251OLq3ThEWlSUBjf1WxE7kXmvhLGkPcTRgtZesTEN/5SevO+u8UWzQLlPjJo/2GHUx5 4BHKMQQEyET4fIiVjbqtpl+4yzm1yaY2IZKVXekxEmKkl6aOHmeZoMIIjJAzJn877/2a 6vGw== 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=xmqtYSo0zNjgG+PWoAR3It7nPGbZnzefyVYtZ+6++P4=; b=ieqUR0lSihOlJOF1xXHD1du8+0dRLI5EIdnqMgpD/ipaL6/e26NsCrde7FJ3MlpErP kSfhUtjZ94fBKGOY5TfzJJ6U8XR3sC55EF4sPCOzN/2dKVJKrvl4rDdpZK1vLeTOcYui /QxUK3ZQjvM6yqm433cLaHolQdxZV9LEuRt/A2Yaz0ztqLxYyDHom0D1vGCV3tj8VcmG ArXzka6HQKQathPQ3ywhlLDJVDTqJz4NlmHFvGn/qZhSAaj1YfFOrcNl4/EbW6kjlF3W Swd8k6Q0iyB5du28T5VtCI9msdJKjbiH5k+Xp7zm7SntIDFcTguwZGP9xQC20+pZWQRc ww2Q== 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 s9-v6si13481943pgk.384.2018.07.10.08.36.02; Tue, 10 Jul 2018 08:36:18 -0700 (PDT) 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 S934066AbeGJPer (ORCPT + 99 others); Tue, 10 Jul 2018 11:34:47 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:34360 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1754384AbeGJPeq (ORCPT ); Tue, 10 Jul 2018 11:34:46 -0400 Received: (qmail 4006 invoked by uid 2102); 10 Jul 2018 11:34:45 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 10 Jul 2018 11:34:45 -0400 Date: Tue, 10 Jul 2018 11:34:45 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Andrea Parri cc: "Paul E. McKenney" , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Will Deacon , Kernel development list Subject: Re: [PATCH v2] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire In-Reply-To: <20180710152404.GA11437@andrea> 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 On Tue, 10 Jul 2018, Andrea Parri wrote: > > > ACQUIRE operations include LOCK operations and both smp_load_acquire() > > > and smp_cond_acquire() operations. [BTW, the latter was replaced by > > > smp_cond_load_acquire() in 1f03e8d2919270 ...] > > > > > > RELEASE operations include UNLOCK operations and smp_store_release() > > > operations. [...] > > > > > > [...] after an ACQUIRE on a given variable, all memory accesses > > > preceding any prior RELEASE on that same variable are guaranteed > > > to be visible. > > > > As far as I can see, these statements remain valid. > > Interesting; ;-) What does these statement tells you ;-) when applied > to a: and b: below? > > a: WRITE_ONCE(x, 1); // "preceding any prior RELEASE..." > smp_store_release(&s, 1); > smp_load_acquire(&s); > b: WRITE_ONCE(y, 1); // "after an ACQUIRE..." The first statement tells me that b: follows an ACQUIRE. The second tells me that a: precedes a RELEASE. And the third tells me that any READ_ONCE(x) statements coming po-after b: would see x = 1 or a later value of x. (Of course, they would have to see that anyway because of the cache coherency rules.) More to the point, given: P0() { WRITE_ONCE(x, 1); a: smp_store_release(&s, 1); } P1() { b: r1 = smp_load_acquire(&s); r2 = READ_ONCE(x); } the third statement tells me that if r1 = 1 (that is, if a: is prior to b:) then r2 must be 1. Alan