Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2242265imm; Tue, 10 Jul 2018 16:16:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcopvuBCRB0iIWoxuBDiY0Z86yJkCiIRG8sz2c/vFdjZVN7Kr7zJbmEZEwQvuww92JbEyre X-Received: by 2002:a62:c00c:: with SMTP id x12-v6mr27568978pff.216.1531264599754; Tue, 10 Jul 2018 16:16:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531264599; cv=none; d=google.com; s=arc-20160816; b=SC3O2JdlqSNYlosAXQBMgAqScHmH/AvBRPOv9PwKYwrYe0LekxMAiqiKHbpuug8zqc xMEKjZQzUzxLxCTDp7y2kvGbOsSI/9/CRbE2ModSLPqpCT6O/p+evq3Wzmc+WBp5QKtQ U9+kFYGwK1zEgaTeD5c747Qg98bjJSDBv8ohr6/SAA6RA0C1PFv2FqeTAoOJgtwCzwS/ oLQr0DyIZdOB6Q5N9sAo9bWrtuNTsE2aH+dduphstiBmNMSvl28G9js5qeylT65g1rax CwRh3wxh0jQmuJCKyS/bCB9UcPfeWxZPJgiVEIK6e+xi/hEDfqJirNP3ScudelXslhCC vm7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=JYCGqiZ3uAwHQvmuujK6SBF6j+DebRK1K3+Q2l9lEdw=; b=n89hYvkOmTCLOcqv3yExH69LDxiX+gTAhahHGZdeUQJOuLTgAuAon2hoAAuQKSVrUk rD4CacFGnGhenQm/x+azA2M4mXdATSG+12F9j5+bz5Ic8DSo6xHsKC35tMoXHljAf7he TcEV2WTEaukkVNk8ESfeXL6JC30JAb54asx9azvYrwDFH08YYckRKx4uyj5px52WcFj3 QrlD4iN/IlqbXh1cAD3F6iFjSQ4MbbwxLWrrFn4PF/L+0ml4fd9cR60ReHULRLFR34d5 /IujhgaH9KaxNgoqxop9gHTZKNRsx0RWVO1g4pUK+eGNhDF01S4pWIBSQ0wAPd4XGB6U +mAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DB3aX1aG; 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 h65-v6si18932724pfg.197.2018.07.10.16.16.23; Tue, 10 Jul 2018 16:16:39 -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; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DB3aX1aG; 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 S1732365AbeGJXQY (ORCPT + 99 others); Tue, 10 Jul 2018 19:16:24 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:40686 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732253AbeGJXQX (ORCPT ); Tue, 10 Jul 2018 19:16:23 -0400 Received: by mail-wr1-f66.google.com with SMTP id t6-v6so16237702wrn.7 for ; Tue, 10 Jul 2018 16:15:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=JYCGqiZ3uAwHQvmuujK6SBF6j+DebRK1K3+Q2l9lEdw=; b=DB3aX1aGz3LyMJUfKFv3GYe6spILoRSk6+CH5Gzfwjeb6nLHD9wcsZJIsvzPhUywL2 Vd7dMIfEWFoVRfV2f4ap41tVZKo60ZvL9ZDQdzn3eBnEx6nrabLErgkYt5XyctnTG/Ep NAQ5nLHkqlkUd+Z2cXIIEKUcHj+syk0euZdOU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=JYCGqiZ3uAwHQvmuujK6SBF6j+DebRK1K3+Q2l9lEdw=; b=KFzI5bKBfBFjmeKwosQrkE2q3Rv/0nFiM/dymOGMBL2vrWS7OjGoq4ukjjwNF7dDQT 0gNyML94kBwdF3Cty8F37durqJunMrivsiHzvZryevc73jJqb87vZrkPsZVix0TEFyHZ JW4tS6pkH5BzfO/YvocYUbVh3Z3mUtRXq2zkSQ1xRLSwWpC2KsVgwZ2+ybrE/qhZNXd+ 1xObN+vDgB1jTbe7S2aEqAkeX6yGDJysyndLYKfB4UjGAZrX1kiqei6HJmVzIPBU8iIU ktCQ4UFXeg0EssQr6r4yRBjucDyCuhZ7wNtB3aikzBW1l/3sXhfGT7OJ+JAuu4IaGhji hx8g== X-Gm-Message-State: APt69E25xuhhRPvQcp2jto2v0WgyWOO6UTT1inuUrozRNxK5FrTYCbu4 7tIf9ygKwXAWFiqUAUZ/ws71YA== X-Received: by 2002:adf:a094:: with SMTP id m20-v6mr18624319wrm.125.1531264501721; Tue, 10 Jul 2018 16:15:01 -0700 (PDT) Received: from andrea ([94.230.152.15]) by smtp.gmail.com with ESMTPSA id h4-v6sm19086404wre.89.2018.07.10.16.15.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Jul 2018 16:15:01 -0700 (PDT) Date: Wed, 11 Jul 2018 01:14:55 +0200 From: Andrea Parri To: Alan Stern 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 Message-ID: <20180710231455.GA11372@andrea> References: <20180710152404.GA11437@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 10, 2018 at 11:34:45AM -0400, Alan Stern wrote: > 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.) Mmh, something like "visible from the same CPU of the ACQUIRE" probably could have helped me to reach the same conclusion. > > 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. Indeed; the "prior" is ambiguous, but yes. Andrea > > Alan >