Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1021344imm; Wed, 11 Jul 2018 15:36:37 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcVWq0OrGCLGP0g653MlsKUpa/zWNTx0TwW9N7bjSFwLBAUUl7dCJ8tjsru4nRIXtnaNh6Z X-Received: by 2002:a65:6094:: with SMTP id t20-v6mr432551pgu.264.1531348597232; Wed, 11 Jul 2018 15:36:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531348597; cv=none; d=google.com; s=arc-20160816; b=pgijL5JrTBi9+OAVzpxYuAq4UVnFmpwe2/uM6K1R8/4UPHoYfxlJFzLkj/Hy/sW4Kn QYGnafwnJ2gatKPEd3ZOxS13LgUIPln+DOeJyXjRBWbTKfdQG7Wu9Sd9Kjz1jqFlTetz fdyhrkUEiLFe3NXNIsRQKxXRnr/CqlVnBFD+PBjWhZCBUgRHR6ZznyB7mbJWh1wAIfI9 qpoHibNVxhRZfm9RTMaEqTkBwjLpB/AJT6ykrDNY+jzKfOGyX/x46SW4M0w5veYjAj6B +tKoBZA1Xxe0/11QNS+Ea3Xnc5tJ3LYbmRAI+pYTjde4drQP1KQM0FNT7n9ULuv4acl2 fDqw== 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=cvxQwc8CGh8Y6dzq1i6hAVLrUPeugDRu3vUfcZIcsxw=; b=SxTziNmvdSi/D5W0sihb5KW3pEIChfrwenzQFjzt0Hq/2BVuN0YF78R3MuMoAipyE6 puICazwdMmq6kBohZCGbp8D2ROxX+jLZpA62QfK7kwWDHJM6em/i84WjSFSDhMLhsyxS xH4nEWf0ebA6zB/Xvbn5w4CKMafGJH1tz0SfTxodfyzRUba2KXd3xpo9amZXXcOM3t9J KXns+qHAQ4J5yaVceVPbj/rKhmah4fHAI53H+8WUPMEcnvi4dZ82oIOEyUwqiNRViz8k Vhh3ICwPRjIgupvVEmdlxX4qQFZIFhvNpCnh9SdiZl0ay/vmHNjP/gp3dIGZfxN1v+Gp dNjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bySd643V; 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 c2-v6si20058332plb.77.2018.07.11.15.36.21; Wed, 11 Jul 2018 15:36:37 -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=bySd643V; 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 S2389635AbeGKQW2 (ORCPT + 99 others); Wed, 11 Jul 2018 12:22:28 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42341 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733263AbeGKQW2 (ORCPT ); Wed, 11 Jul 2018 12:22:28 -0400 Received: by mail-wr1-f67.google.com with SMTP id p1-v6so18762583wrs.9 for ; Wed, 11 Jul 2018 09:17:24 -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=cvxQwc8CGh8Y6dzq1i6hAVLrUPeugDRu3vUfcZIcsxw=; b=bySd643Vj/t54Z9kgKGQi5KgQEjh1/s3ENv7O5YaIcvhYqQh0dWlRghhlcfqZF6+GS AmGshn/cZhHS0sCEPH8cVTg5TPlevQtA2ibPa+6q7Y4PnVJSw+C1u/ixGz08z0Uw8HKv yhtBPgyImbGILy5K2VyTqRAbfEXSRKbld+tdo= 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=cvxQwc8CGh8Y6dzq1i6hAVLrUPeugDRu3vUfcZIcsxw=; b=d1VXCI9Szbf5z33I/O/WVBOtphtMYsHY8IWGX30FwAqOITIGFMgslnMlC68X8eXlYA 4C7bHWxcGWVFs7CS7xbgnydB71nLG/23o7DR+Vf+Wj09p7LOU2ZS6RrrPPXYHtfqHAx2 uel9yK1XEY1TAkLBB3WnVYHHH9P0+bJnr7yGf87TTZFkxc3v7g6Ijy7/xRDC3jU79SPn PF3dzD3tGMWwJW4AwHFa9X+p/BSci4QZot1RtG06QKBQAjl60RKbMYKWVoHQXh5rHCLa hks7Dp6k/UIu1Vfj5A5bVd13mU48sExihdD9Vg79+RNg/abQEQkTPWgd7lu1BwCMvcWo Xelw== X-Gm-Message-State: APt69E0dWcIMW1f1euiScB2csL+/77bUhzLNKg13aL9VezfYjyYEXrh1 HhVHcwn3uUINx3PCpuAKQVE/WA== X-Received: by 2002:adf:f50e:: with SMTP id q14-v6mr19814384wro.241.1531325844023; Wed, 11 Jul 2018 09:17:24 -0700 (PDT) Received: from andrea (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id 6-v6sm3335106wmi.26.2018.07.11.09.17.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 09:17:23 -0700 (PDT) Date: Wed, 11 Jul 2018 18:17:17 +0200 From: Andrea Parri To: "Paul E. McKenney" Cc: Will Deacon , Alan Stern , LKMM Maintainers -- Akira Yokosawa , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Peter Zijlstra , Kernel development list Subject: Re: [PATCH v3] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire Message-ID: <20180711161717.GA14635@andrea> References: <20180710162555.GV3593@linux.vnet.ibm.com> <20180711094344.GE13963@arm.com> <20180711154211.GT3593@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711154211.GT3593@linux.vnet.ibm.com> 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 Wed, Jul 11, 2018 at 08:42:11AM -0700, Paul E. McKenney wrote: > On Wed, Jul 11, 2018 at 10:43:45AM +0100, Will Deacon wrote: > > Hi Alan, > > > > On Tue, Jul 10, 2018 at 02:18:13PM -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 > > > > Thanks, I'm happy with this version of the patch: > > > > Reviewed-by: Will Deacon > > I have applied your Reviewed-by, and thank you both! > > Given that this is a non-trivial change and given that I am posting > for -tip acceptance in a few days, I intend to send this one not > to the upcoming merge window, but to the one after that. > > Please let me know if there is an urgent need for this to go into the > v4.19 merge window. I raised some concerns in my review to v2; AFAICT, these concerns have not been resolved: so, until then, please feel free to add my NAK. ;-) Andrea > > Thanx, Paul >