Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp869692imm; Wed, 11 Jul 2018 12:24:20 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdKAmWBAvEWljOvfezn15NLblNuQjrUlOwarBfaJjdH5JIIfc8dJ7mE1ojY0zQhm6RFlkoh X-Received: by 2002:a63:a543:: with SMTP id r3-v6mr27774101pgu.336.1531337059978; Wed, 11 Jul 2018 12:24:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531337059; cv=none; d=google.com; s=arc-20160816; b=cApgGvJ/Gf6kaihfuuLK8Xn4FX6MdG181Ia0VtPcfnFVjKpXWaT7PAjv6aUT/OTEqQ tq9Fj6IO9RgJ4ixXiIWPK+U1XhSxDgww9s9x7OrFLSYqUZ+b+fntSkzlkjjtkcoW2z0A LRaTOa8qpH1UNde/5kX0y3c8ck3aqOffDink3kXRZpHNYPI7OKr8iNyllFiWCKq8cpHG Uy+WBFu5M6zCAnm/JGm6A7O0w0VITBYa0DkhsvDHOPLMcG+5+Gj/7T+E8mkI5MD7B+CW gBoH2dmo1/m/wgBQl6jR9U0sl5ba2/haxethFxdc6IlXwFLdukiyBcIB128WnMsoA9Sb PEdA== 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=BZN3vSzwuk9ehsjZrTfUrc0SUulBrta6AXACSHaNtd0=; b=l0UL5ljaQNWzEiyujNAMbMVYk342piH0TsmeijSjwzUyGUH6tOCgOY4BObLLFLs+3W iCSKaM/WZudfvg6Ao7B/sQsrdhdlnTB0H/N6elm0l9oUAHtsls6GiuZH+L/1M/KQdUmY WtZRkWxaOD92qorTFuSrC6pPt994H6a5Tj+Ftc5oUPlwrbC3xNVS6ySRnaxym/3J+N88 1UOkVTjdD95wg+PNv8Dmnayqnd2XDpd5AkoC/t30nwjggF+mD1F6HSNt4/hcmhbPFOrX UiXbakMubyCpTQFkewz9J5xCeybK/FODonUrRQ05k7dAWz/ycA+NaV8PrloDo1W7/x/U 0pEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qoo67VBb; 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 g75-v6si18071280pfb.37.2018.07.11.12.24.04; Wed, 11 Jul 2018 12:24:19 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=qoo67VBb; 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 S2389783AbeGKQk3 (ORCPT + 99 others); Wed, 11 Jul 2018 12:40:29 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52846 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388017AbeGKQk2 (ORCPT ); Wed, 11 Jul 2018 12:40:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=BZN3vSzwuk9ehsjZrTfUrc0SUulBrta6AXACSHaNtd0=; b=qoo67VBbHyk6IKDubRCTTNtND onuqIFXZDZtDlzAUf8ifCo3AfFkQT3a3CfrtRsEOUlZbfe/T5iqs2C7zRQcILEAySGWpu6769H5o5 uCvwp+H7xkqE483N7YiGMXMM4ERzmn0f3fYo6LiT9KHFTuZH0DE3ng6Y0bDUPp06+VmwNwVv2ZZZY b64/GYterthRw6P+2zdXcikAICpwcWQccf8UaTsKu8BuOwzuHpScpYPGps7E2Aa6lanxnzfZ44n/6 /R3iG8fuM3JBIBUXlCJtx3U/F1ajJwQQDyh5cvKkLJRvEa1t2WOovzeafC1127rtu6VXH9zDuKrdK Mcv8qmCCg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fdI4x-0005jr-9N; Wed, 11 Jul 2018 16:34:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8DC8B20298BAC; Wed, 11 Jul 2018 18:34:56 +0200 (CEST) Date: Wed, 11 Jul 2018 18:34:56 +0200 From: Peter Zijlstra To: Will Deacon Cc: Alan Stern , "Paul E. McKenney" , LKMM Maintainers -- Akira Yokosawa , Andrea Parri , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , Kernel development list Subject: Re: [PATCH v3] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire Message-ID: <20180711163456.GL2476@hirez.programming.kicks-ass.net> References: <20180710162555.GV3593@linux.vnet.ibm.com> <20180711094344.GE13963@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180711094344.GE13963@arm.com> User-Agent: Mutt/1.10.0 (2018-05-17) 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 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 Me too! Thanks Alan. Acked-by: Peter Zijlstra (Intel)