Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1725373imm; Tue, 10 Jul 2018 06:58:39 -0700 (PDT) X-Google-Smtp-Source: AAOMgpds1XU9PtTpdQAroivhkpzzMYDc17nPNJQlqjZlEAGr60/lO2ggVl5ZIf3wuxgQnJX1G1RS X-Received: by 2002:a63:fd06:: with SMTP id d6-v6mr19714548pgh.348.1531231119456; Tue, 10 Jul 2018 06:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531231119; cv=none; d=google.com; s=arc-20160816; b=cikPl563comfcFCYTvBI9KC7DE3+xQlv7EkYUU/5I+nYpG9Qu+BsUmWOGB8i9ThV1w wUrghSc/ixfNMbuVkefFhspJLr9qxyroI5a7us3ElBINMUH2sdozj75vPJ3HYHnf6wKR 0Od1wkJCzEkwbwEpxMsg1ajMt1aQjX/nz72RNggDewS/YPj87MCyTYA0G5oGBZVBcGEs oAfiePhIXnwPmbuOWwzXdYoQ7aG4RYuSgz2+Vy3D7HE0H5AMzz8xmjgXp8QQuL1PJ8lU L9Sg5NjWlPCBI73Ix+K8WU9ylpXIcz4H+kCfhhP97wXfQ+l6JheH63V1aOWZRqXRV5Qg 3QUw== 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=g5d9eBGRioXxvhRi+wc0qkr/4/P343ZFapzPZONAzA0=; b=XXipGGxRb+GfcNkt9grvlhIHWbna+RZM+uzNsW/8mhwGnjOmIqZSwtrLCDWpNPPDK8 cx3vEG2olEOmPoPhGJaeOGYhwWiKzTkJg3KSRYOeAOL+BZr39A5ZvFcfo44OdhRGNZWX wagNZK5j3LjhvWz6bSvvQlFcZwimEzlKtpEx2bcmu+2CM8BMaObWxzVSCBzxyvT8MLrU bnBkgLs7PQhKmAezz/qG6aHJHzRyDDtKEIG0D009MqKkgdjqfyBZP80URzJS0+IvuxwX ZY3Xa9qp00NSkkb+jzafnTaTIuNCG93vooQkE0t7KZ/KGKonv6QOi4lnbxLQAO+lKt7s M8Xg== 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 q2-v6si16715845plh.136.2018.07.10.06.58.15; Tue, 10 Jul 2018 06:58: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; 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 S933449AbeGJN5T (ORCPT + 99 others); Tue, 10 Jul 2018 09:57:19 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:33642 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S933255AbeGJN5S (ORCPT ); Tue, 10 Jul 2018 09:57:18 -0400 Received: (qmail 1601 invoked by uid 2102); 10 Jul 2018 09:57:17 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 10 Jul 2018 09:57:17 -0400 Date: Tue, 10 Jul 2018 09:57:17 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: "Paul E. McKenney" cc: LKMM Maintainers -- Akira Yokosawa , Andrea Parri , 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: <20180709214514.GJ3593@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 On Mon, 9 Jul 2018, Paul E. McKenney wrote: > On Mon, Jul 09, 2018 at 04:01:57PM -0400, Alan Stern wrote: > > More than one kernel developer has expressed the opinion that the LKMM > > should enforce ordering of writes by locking. In other words, given > > the following code: > > > > WRITE_ONCE(x, 1); > > spin_unlock(&s): > > spin_lock(&s); > > WRITE_ONCE(y, 1); > > > > the stores to x and y should be propagated in order to all other CPUs, > > even though those other CPUs might not access the lock s. In terms of > > the memory model, this means expanding the cumul-fence relation. > > > > Locks should also provide read-read (and read-write) ordering in a > > similar way. Given: > > > > READ_ONCE(x); > > spin_unlock(&s); > > spin_lock(&s); > > READ_ONCE(y); // or WRITE_ONCE(y, 1); > > > > the load of x should be executed before the load of (or store to) y. > > The LKMM already provides this ordering, but it provides it even in > > the case where the two accesses are separated by a release/acquire > > pair of fences rather than unlock/lock. This would prevent > > architectures from using weakly ordered implementations of release and > > acquire, which seems like an unnecessary restriction. The patch > > therefore removes the ordering requirement from the LKMM for that > > case. > > > > All the architectures supported by the Linux kernel (including RISC-V) > > do provide this ordering for locks, albeit for varying reasons. > > Therefore this patch changes the model in accordance with the > > developers' wishes. > > > > Signed-off-by: Alan Stern > > Nice! > > However, it doesn't apply against current -rcu. Am I missing a patch? > Or is this supposed to apply against origin/lkmm? I wrote it based on 4.18-rc. However, I can rebase it against your current dev branch. Alan